Skip to content

Commit 1ffd721

Browse files
committed
Align null order in collation (1783/2018)
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
1 parent f5b4c62 commit 1ffd721

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

core/src/main/java/org/opensearch/sql/calcite/validate/TypeChecker.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package org.opensearch.sql.calcite.validate;
77

8+
import org.apache.calcite.config.NullCollation;
89
import org.apache.calcite.jdbc.CalcitePrepare;
910
import org.apache.calcite.jdbc.CalciteSchema;
1011
import org.apache.calcite.prepare.CalciteCatalogReader;
@@ -13,7 +14,6 @@
1314
import org.apache.calcite.server.CalciteServerStatement;
1415
import org.apache.calcite.sql.SqlOperatorTable;
1516
import org.apache.calcite.sql.type.SqlTypeCoercionRule;
16-
import org.apache.calcite.sql.validate.SqlConformanceEnum;
1717
import org.apache.calcite.sql.validate.SqlValidator;
1818
import org.apache.calcite.sql.validate.implicit.TypeCoercion;
1919
import org.apache.calcite.tools.FrameworkConfig;
@@ -53,7 +53,9 @@ public static SqlValidator getValidator(
5353
.withTypeCoercionRules(getTypeCoercionRule())
5454
.withTypeCoercionFactory(TypeChecker::createTypeCoercion)
5555
// Use lenient conformance for PPL compatibility
56-
.withConformance(SqlConformanceEnum.LENIENT);
56+
.withConformance(OpenSearchSparkSqlDialect.DEFAULT.getConformance())
57+
// Use Spark SQL's NULL collation (NULLs sorted LOW/FIRST)
58+
.withDefaultNullCollation(NullCollation.LOW);
5759
return new PplValidator(
5860
operatorTable, catalogReader, OpenSearchTypeFactory.TYPE_FACTORY, validatorConfig);
5961
}

0 commit comments

Comments
 (0)