Skip to content

Commit 16c27d9

Browse files
committed
Update sargFromJson method in ExtendedRelJson
- this fix testRand, where desrialization of sarg does not restore its type - todo: update the toRex in ExtendedRelJson to the align with the latest version Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
1 parent d532ff7 commit 16c27d9

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

core/src/main/java/org/opensearch/sql/executor/QueryService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@
1919
import org.apache.calcite.plan.RelOptCluster;
2020
import org.apache.calcite.plan.RelOptTable;
2121
import org.apache.calcite.plan.RelTraitDef;
22-
import org.apache.calcite.prepare.CalciteCatalogReader;
2322
import org.apache.calcite.plan.hep.HepPlanner;
2423
import org.apache.calcite.plan.hep.HepProgram;
2524
import org.apache.calcite.plan.hep.HepProgramBuilder;
25+
import org.apache.calcite.prepare.CalciteCatalogReader;
2626
import org.apache.calcite.rel.RelCollation;
2727
import org.apache.calcite.rel.RelCollations;
2828
import org.apache.calcite.rel.RelNode;
2929
import org.apache.calcite.rel.RelRoot;
3030
import org.apache.calcite.rel.core.Sort;
3131
import org.apache.calcite.rel.logical.LogicalSort;
3232
import org.apache.calcite.rel.rel2sql.SqlImplementor;
33-
import org.apache.calcite.runtime.CalciteContextException;
3433
import org.apache.calcite.rel.rules.FilterMergeRule;
34+
import org.apache.calcite.runtime.CalciteContextException;
3535
import org.apache.calcite.schema.SchemaPlus;
3636
import org.apache.calcite.sql.SqlIdentifier;
3737
import org.apache.calcite.sql.SqlNode;

opensearch/src/main/java/org/opensearch/sql/opensearch/storage/serde/ExtendedRelJson.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ RexNode toRex(RelInput relInput, @PolyNull Object o) {
500500
}
501501
final RelDataType type = toType(typeFactory, get(map, "type"));
502502
if (literal instanceof Map && ((Map<?, ?>) literal).containsKey("rangeSet")) {
503-
Sarg sarg = sargFromJson((Map) literal);
503+
Sarg sarg = sargFromJson((Map) literal, type);
504504
return rexBuilder.makeSearchArgumentLiteral(sarg, type);
505505
}
506506
if (type.getSqlTypeName() == SqlTypeName.SYMBOL) {
@@ -515,7 +515,7 @@ RexNode toRex(RelInput relInput, @PolyNull Object o) {
515515
return rexBuilder.makeNullLiteral(type);
516516
}
517517
final RelDataType type = toType(typeFactory, get(map, "type"));
518-
Sarg sarg = sargFromJson((Map) sargObject);
518+
Sarg sarg = sargFromJson((Map) sargObject, type);
519519
return rexBuilder.makeSearchArgumentLiteral(sarg, type);
520520
}
521521
if (map.containsKey("dynamicParam")) {

0 commit comments

Comments
 (0)