|
16 | 16 | import java.util.function.BiFunction; |
17 | 17 | import lombok.Getter; |
18 | 18 | import lombok.Setter; |
19 | | -import org.apache.calcite.plan.RelOptCluster; |
20 | | -import org.apache.calcite.plan.RelOptSchema; |
21 | 19 | import org.apache.calcite.rex.RexCorrelVariable; |
22 | 20 | import org.apache.calcite.rex.RexLambdaRef; |
23 | 21 | import org.apache.calcite.rex.RexNode; |
24 | 22 | import org.apache.calcite.tools.FrameworkConfig; |
25 | 23 | import org.apache.calcite.tools.RelBuilder; |
26 | | -import org.apache.calcite.tools.RelBuilderFactory; |
27 | 24 | import org.opensearch.sql.ast.expression.UnresolvedExpression; |
28 | 25 | import org.opensearch.sql.calcite.utils.CalciteToolsHelper; |
29 | 26 | import org.opensearch.sql.common.setting.Settings; |
@@ -75,25 +72,6 @@ private CalcitePlanContext(FrameworkConfig config, SysLimit sysLimit, QueryType |
75 | 72 | this.rexLambdaRefMap = new HashMap<>(); |
76 | 73 | } |
77 | 74 |
|
78 | | - private CalcitePlanContext( |
79 | | - FrameworkConfig config, |
80 | | - Integer querySizeLimit, |
81 | | - QueryType queryType, |
82 | | - Connection connection, |
83 | | - RelBuilder relBuilder, |
84 | | - ExtendedRexBuilder rexBuilder, |
85 | | - FunctionProperties functionProperties, |
86 | | - Map<String, RexLambdaRef> rexLambdaRefMap) { |
87 | | - this.config = config; |
88 | | - this.querySizeLimit = querySizeLimit; |
89 | | - this.queryType = queryType; |
90 | | - this.connection = connection; |
91 | | - this.relBuilder = relBuilder; |
92 | | - this.rexBuilder = rexBuilder; |
93 | | - this.functionProperties = functionProperties; |
94 | | - this.rexLambdaRefMap = rexLambdaRefMap; |
95 | | - } |
96 | | - |
97 | 75 | public RexNode resolveJoinCondition( |
98 | 76 | UnresolvedExpression expr, |
99 | 77 | BiFunction<UnresolvedExpression, CalcitePlanContext, RexNode> transformFunction) { |
@@ -127,35 +105,6 @@ public CalcitePlanContext clone() { |
127 | 105 | return new CalcitePlanContext(config, sysLimit, queryType); |
128 | 106 | } |
129 | 107 |
|
130 | | - /** |
131 | | - * A deep copy to create a totally same one calciteContext |
132 | | - * |
133 | | - * @return a deep clone calcite context and current context |
134 | | - */ |
135 | | - public CalcitePlanContext deepClone() { |
136 | | - RelOptCluster cluster = this.relBuilder.getCluster(); |
137 | | - RelBuilderFactory factory = RelBuilder.proto(config.getContext()); |
138 | | - RelOptSchema schema = |
139 | | - this.relBuilder.getCluster().getPlanner().getContext().unwrap(RelOptSchema.class); |
140 | | - RelBuilder siblingRelBuilder = factory.create(cluster, schema); |
141 | | - siblingRelBuilder.push(this.relBuilder.peek()); // Add current logical plan as base |
142 | | - CalcitePlanContext clone = |
143 | | - new CalcitePlanContext( |
144 | | - config, |
145 | | - querySizeLimit, |
146 | | - queryType, |
147 | | - connection, |
148 | | - siblingRelBuilder, |
149 | | - new ExtendedRexBuilder(siblingRelBuilder.getRexBuilder()), |
150 | | - functionProperties, |
151 | | - rexLambdaRefMap); |
152 | | - clone.inCoalesceFunction = this.inCoalesceFunction; |
153 | | - clone.isProjectVisited = this.isProjectVisited; |
154 | | - clone.isResolvingJoinCondition = this.isResolvingJoinCondition; |
155 | | - clone.isResolvingSubquery = this.isResolvingSubquery; |
156 | | - return clone; |
157 | | - } |
158 | | - |
159 | 108 | public static CalcitePlanContext create( |
160 | 109 | FrameworkConfig config, SysLimit sysLimit, QueryType queryType) { |
161 | 110 | return new CalcitePlanContext(config, sysLimit, queryType); |
|
0 commit comments