4444import org .opensearch .sql .planner .Planner ;
4545import org .opensearch .sql .planner .logical .LogicalPlan ;
4646import org .opensearch .sql .planner .physical .PhysicalPlan ;
47+ import org .opensearch .transport .client .node .NodeClient ;
4748
4849/** The low level interface of core engine. */
4950@ RequiredArgsConstructor
@@ -59,6 +60,7 @@ public class QueryService {
5960
6061 private DataSourceService dataSourceService ;
6162 private Settings settings ;
63+ private NodeClient nodeClient ;
6264
6365 /** Execute the {@link UnresolvedPlan}, using {@link ResponseListener} to get response.<br> */
6466 public void execute (
@@ -94,8 +96,7 @@ public void executeWithCalcite(
9496 (PrivilegedAction <Void >)
9597 () -> {
9698 CalcitePlanContext context =
97- CalcitePlanContext .create (
98- buildFrameworkConfig (), queryType , dataSourceService .getNodeClient ());
99+ CalcitePlanContext .create (buildFrameworkConfig (), queryType , nodeClient );
99100 RelNode relNode = analyze (plan , context );
100101 RelNode optimized = optimize (relNode );
101102 RelNode calcitePlan = convertToCalcitePlan (optimized );
@@ -127,8 +128,7 @@ public void explainWithCalcite(
127128 (PrivilegedAction <Void >)
128129 () -> {
129130 CalcitePlanContext context =
130- CalcitePlanContext .create (
131- buildFrameworkConfig (), queryType , dataSourceService .getNodeClient ());
131+ CalcitePlanContext .create (buildFrameworkConfig (), queryType , nodeClient );
132132 RelNode relNode = analyze (plan , context );
133133 RelNode optimized = optimize (relNode );
134134 RelNode calcitePlan = convertToCalcitePlan (optimized );
0 commit comments