Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CALCITE-6693] Add Source SQL Dialect to RelToSqlConverterTest #4050

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions core/src/main/java/org/apache/calcite/prepare/PlannerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.apache.calcite.sql.SqlOperatorTable;
import org.apache.calcite.sql.parser.SqlParseException;
import org.apache.calcite.sql.parser.SqlParser;
import org.apache.calcite.sql.parser.SqlParser.Config;
import org.apache.calcite.sql.util.SqlOperatorTables;
import org.apache.calcite.sql.validate.SqlValidator;
import org.apache.calcite.sql2rel.RelDecorrelator;
Expand Down Expand Up @@ -117,14 +118,14 @@ public PlannerImpl(FrameworkConfig config) {
this.convertletTable = config.getConvertletTable();
this.executor = config.getExecutor();
this.context = config.getContext();
this.connectionConfig = connConfig(context, parserConfig);
this.connectionConfig = connConfig(context, parserConfig, sqlValidatorConfig);
this.typeSystem = config.getTypeSystem();
reset();
}

/** Gets a user-defined config and appends default connection values. */
private static CalciteConnectionConfig connConfig(Context context,
SqlParser.Config parserConfig) {
Config parserConfig, SqlValidator.Config sqlValidatorConfig) {
CalciteConnectionConfigImpl config =
context.maybeUnwrap(CalciteConnectionConfigImpl.class)
.orElse(CalciteConnectionConfig.DEFAULT);
Expand All @@ -138,6 +139,11 @@ private static CalciteConnectionConfig connConfig(Context context,
config.set(CalciteConnectionProperty.CONFORMANCE,
String.valueOf(parserConfig.conformance()));
}
if (!config.isSet(CalciteConnectionProperty.DEFAULT_NULL_COLLATION)) {
config =
config.set(CalciteConnectionProperty.DEFAULT_NULL_COLLATION,
String.valueOf(sqlValidatorConfig.defaultNullCollation()));
}
return config;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class RelToSqlConverterStructsTest {

private RelToSqlConverterTest.Sql sql(String sql) {
return new RelToSqlConverterTest.Sql(CalciteAssert.SchemaSpec.MY_DB, sql,
CalciteSqlDialect.DEFAULT, SqlParser.Config.DEFAULT, ImmutableSet.of(),
CalciteSqlDialect.DEFAULT, CalciteSqlDialect.DEFAULT,
SqlParser.Config.DEFAULT, ImmutableSet.of(),
UnaryOperator.identity(), null, ImmutableList.of());
}

Expand Down
Loading
Loading