Skip to content

Commit 1582966

Browse files
committed
Replace custom ConformanceDelegate with Calcite's SqlDelegatingConformance
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
1 parent 19faa38 commit 1582966

2 files changed

Lines changed: 9 additions & 18 deletions

File tree

core/src/main/java/org/opensearch/sql/calcite/CalciteRelNodeVisitor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1833,7 +1833,7 @@ public RexNode visitOver(RexOver over) {
18331833
over.ignoreNulls());
18341834
}
18351835
}))
1836-
.toList();
1836+
.collect(Collectors.toList());
18371837
}
18381838

18391839
private static RexFieldCollation relCollationToRexCollation(

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

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import com.google.common.collect.ImmutableMap;
99
import java.util.Map;
10-
import lombok.experimental.Delegate;
1110
import org.apache.calcite.rel.type.RelDataType;
1211
import org.apache.calcite.sql.SqlAlienSystemTypeNameSpec;
1312
import org.apache.calcite.sql.SqlCall;
@@ -17,6 +16,7 @@
1716
import org.apache.calcite.sql.dialect.SparkSqlDialect;
1817
import org.apache.calcite.sql.parser.SqlParserPos;
1918
import org.apache.calcite.sql.validate.SqlConformance;
19+
import org.apache.calcite.sql.validate.SqlDelegatingConformance;
2020
import org.checkerframework.checker.nullness.qual.Nullable;
2121
import org.opensearch.sql.calcite.utils.OpenSearchTypeUtil;
2222

@@ -93,21 +93,12 @@ private void unparseFunction(
9393

9494
@Override
9595
public SqlConformance getConformance() {
96-
return new ConformanceDelegate(super.getConformance());
97-
}
98-
99-
/** SqlConformance delegator that enables liberal mode for LEFT SEMI/ANTI JOIN support. */
100-
private static class ConformanceDelegate implements SqlConformance {
101-
@Delegate private final SqlConformance delegate;
102-
103-
ConformanceDelegate(SqlConformance delegate) {
104-
this.delegate = delegate;
105-
}
106-
107-
@Override
108-
public boolean isLiberal() {
109-
// This allows SQL feature LEFT ANTI JOIN & LEFT SEMI JOIN
110-
return true;
111-
}
96+
return new SqlDelegatingConformance(super.getConformance()) {
97+
@Override
98+
public boolean isLiberal() {
99+
// This allows SQL feature LEFT ANTI JOIN & LEFT SEMI JOIN
100+
return true;
101+
}
102+
};
112103
}
113104
}

0 commit comments

Comments
 (0)