Skip to content

Commit

Permalink
Add proposed changes from review
Browse files Browse the repository at this point in the history
  • Loading branch information
kramerul committed Jun 7, 2021
1 parent 2295736 commit bcba99c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Expand Up @@ -16,6 +16,7 @@
*/
package org.apache.calcite.adapter.jdbc;

import org.apache.calcite.plan.Convention;
import org.apache.calcite.plan.RelOptCluster;
import org.apache.calcite.plan.RelOptTable;
import org.apache.calcite.plan.RelTraitSet;
Expand All @@ -30,6 +31,8 @@

import static org.apache.calcite.linq4j.Nullness.castNonNull;

import static java.util.Objects.requireNonNull;

/**
* Relational expression representing a scan of a table in a JDBC data source.
*/
Expand Down Expand Up @@ -58,7 +61,8 @@ protected JdbcTableScan(
}

@Override public RelNode withHints(List<RelHint> hintList) {
Convention convention = requireNonNull(getConvention(), "getConvention()");
return new JdbcTableScan(getCluster(), hintList, getTable(), jdbcTable,
(JdbcConvention) getConvention());
(JdbcConvention) convention);
}
}
Expand Up @@ -533,7 +533,7 @@ public Result visit(TableScan e) {
SqlNode node = identifier;
if (e instanceof Hintable) {
final ImmutableList<RelHint> hints = e.getHints();
if (hints != null && ! hints.isEmpty()) {
if (! hints.isEmpty()) {
SqlParserPos pos = identifier.getParserPosition();
node = new SqlTableRef(pos, identifier,
nodeListOf(pos, hints.stream().map(h -> RelToSqlConverter.toSqlHint(h, pos))));
Expand Down
Expand Up @@ -563,7 +563,7 @@ class JdbcAdapterTest {
return builder
.scan("foodmart", "expense_fact")
.hints(RelHint.builder("PLACEHOLDERS")
.hintOptions(ImmutableMap.of("a", "b"))
.hintOption("a", "b")
.build())
.project(builder.field("store_id"))
.build();
Expand Down

0 comments on commit bcba99c

Please sign in to comment.