Skip to content

Commit b431c7a

Browse files
committed
Fixes for Calcite 1.38.0
1 parent 51d8cad commit b431c7a

File tree

8 files changed

+14
-21
lines changed

8 files changed

+14
-21
lines changed

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# limitations under the License.
1717
#
1818
set -e
19-
VERSION=1.37.0
19+
VERSION=1.38.0
2020

2121
# Java 21 doesn't suppport Java 8
2222
if [ -d /Library/Java/JavaVirtualMachines/sapmachine-jdk-17.0.11.jdk/Contents/Home ]; then

core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ Enumerable<MetaTable> tables(String catalog) {
422422

423423
Enumerable<MetaTable> tables(final MetaSchema schema_, LikePattern tableNamePattern) {
424424
final CalciteMetaSchema schema = (CalciteMetaSchema) schema_;
425-
return Linq4j.asEnumerable(schema.calciteSchema.getTableNames())
425+
return Linq4j.asEnumerable(schema.calciteSchema.getTableNames(tableNamePattern))
426426
.select(name -> {
427427
final Table table =
428428
requireNonNull(schema.calciteSchema.getTable(name, true),

core/src/main/java/org/apache/calcite/prepare/RelOptTableImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ public static MySchemaPlus create(Path path) {
506506
}
507507

508508
@Deprecated @Override public @Nullable Table getTable(String name) {
509-
return schema.getTable(name);
509+
return tables().get(name);
510510
}
511511

512512
@Deprecated @Override public Set<String> getTableNames() {

core/src/test/java/org/apache/calcite/test/JdbcTest.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,6 @@ private void checkResultSetMetaData(Connection connection, String sql)
12201220
final CalciteConnection calciteConnection =
12211221
connection.unwrap(CalciteConnection.class);
12221222
final SchemaPlus rootSchema = calciteConnection.getRootSchema();
1223-
<<<<<<< HEAD
12241223
final SchemaPlus foodmart = rootSchema.subSchemas().get("foodmart");
12251224
assertThat(foodmart, notNullValue());
12261225
final JdbcTable timeByDay =
@@ -8762,14 +8761,8 @@ public FoodmartJdbcSchema(DataSource dataSource, SqlDialect dialect,
87628761
super(dataSource, dialect, convention, catalog, schema);
87638762
}
87648763

8765-
<<<<<<< HEAD
87668764
public final Table customer =
8767-
requireNonNull(getTable("customer"));
8768-
||||||| parent of c54b3c271 (EXPB-2551 Speed up schema lookup for huge schemas)
8769-
public final Table customer = getTable("customer");
8770-
=======
8771-
public final Table customer = tables().get("customer");
8772-
>>>>>>> c54b3c271 (EXPB-2551 Speed up schema lookup for huge schemas)
8765+
requireNonNull(tables().get("customer"));
87738766
}
87748767

87758768
public static class Customer {

core/src/test/java/org/apache/calcite/test/LatticeTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ private static CalciteAssert.AssertThat modelWithLattices(
208208
final SchemaPlus schema = c.getRootSchema();
209209
final SchemaPlus adhoc =
210210
requireNonNull(schema.subSchemas().get("adhoc"));
211-
assertThat(adhoc.getTableNames().contains("EMPLOYEES"), is(true));
211+
assertThat(adhoc.tables().get("EMPLOYEES") != null, is(true));
212212
final CalciteSchema adhocSchema =
213213
requireNonNull(adhoc.unwrap(CalciteSchema.class));
214214
final Map.Entry<String, CalciteSchema.LatticeEntry> entry =
@@ -239,8 +239,8 @@ private static CalciteAssert.AssertThat modelWithLattices(
239239
.doWithConnection(c -> {
240240
final SchemaPlus schema = c.getRootSchema();
241241
final SchemaPlus adhoc =
242-
requireNonNull(schema.getSubSchema("adhoc"));
243-
assertThat(adhoc.getTableNames().contains("EMPLOYEES"), is(true));
242+
requireNonNull(schema.subSchemas().get("adhoc"));
243+
assertThat(adhoc.tables().get("EMPLOYEES") != null, is(true));
244244
final CalciteSchema adhocSchema =
245245
requireNonNull(adhoc.unwrap(CalciteSchema.class));
246246
final Map.Entry<String, CalciteSchema.LatticeEntry> entry =
@@ -271,7 +271,7 @@ private static CalciteAssert.AssertThat modelWithLattices(
271271
final SchemaPlus schema = c.getRootSchema();
272272
final SchemaPlus adhoc =
273273
requireNonNull(schema.subSchemas().get("adhoc"));
274-
assertThat(adhoc.getTableNames().contains("EMPLOYEES"), is(true));
274+
assertThat(adhoc.tables().get("EMPLOYEES") != null, is(true));
275275
final CalciteSchema adhocSchema =
276276
requireNonNull(adhoc.unwrap(CalciteSchema.class));
277277
final Map.Entry<String, CalciteSchema.LatticeEntry> entry =

druid/src/test/java/org/apache/calcite/test/DruidAdapter2IT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2626,7 +2626,7 @@ private void testCountWithApproxDistinct(boolean approx, String sql,
26262626
@Test void testTableMapReused() {
26272627
AbstractSchema schema =
26282628
new DruidSchema("http://localhost:8082", "http://localhost:8081", true);
2629-
assertSame(schema.getTable("wikiticker"), schema.getTable("wikiticker"));
2629+
assertSame(schema.tables().get("wikiticker"), schema.tables().get("wikiticker"));
26302630
}
26312631

26322632
@Test void testPushEqualsCastDimension() {

druid/src/test/java/org/apache/calcite/test/DruidAdapterIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3115,7 +3115,7 @@ private void testCountWithApproxDistinct(boolean approx, String sql, String expe
31153115
* */
31163116
@Test void testTableMapReused() {
31173117
AbstractSchema schema = new DruidSchema("http://localhost:8082", "http://localhost:8081", true);
3118-
assertSame(schema.getTable("wikipedia"), schema.getTable("wikipedia"));
3118+
assertSame(schema.tables().get("wikipedia"), schema.tables().get("wikipedia"));
31193119
}
31203120

31213121
@Test void testPushEqualsCastDimension() {

server/src/main/java/org/apache/calcite/server/ServerDdlExecutor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public void execute(SqlDropObject drop,
330330
Table materializedView =
331331
schema != null
332332
&& drop.getKind() == SqlKind.DROP_MATERIALIZED_VIEW
333-
? schema.plus().getTable(objectName)
333+
? schema.plus().tables().get(objectName)
334334
: null;
335335

336336
existed = schema != null && schema.removeTable(objectName);
@@ -382,7 +382,7 @@ public void execute(SqlTruncateTable truncate,
382382
final Pair<@Nullable CalciteSchema, String> pair =
383383
schema(context, true, truncate.name);
384384
if (pair.left == null
385-
|| pair.left.plus().getTable(pair.right) == null) {
385+
|| pair.left.plus().tables().get(pair.right) == null) {
386386
throw SqlUtil.newContextException(truncate.name.getParserPosition(),
387387
RESOURCE.tableNotFound(pair.right));
388388
}
@@ -401,7 +401,7 @@ public void execute(SqlCreateMaterializedView create,
401401
final Pair<@Nullable CalciteSchema, String> pair =
402402
schema(context, true, create.name);
403403
if (pair.left != null
404-
&& pair.left.plus().getTable(pair.right) != null) {
404+
&& pair.left.plus().tables().get(pair.right) != null) {
405405
// Materialized view exists.
406406
if (!create.ifNotExists) {
407407
// They did not specify IF NOT EXISTS, so give error.
@@ -588,7 +588,7 @@ public void execute(SqlCreateTableLike create,
588588
final Pair<@Nullable CalciteSchema, String> pair =
589589
schema(context, true, create.name);
590590
requireNonNull(pair.left); // TODO: should not assume parent schema exists
591-
if (pair.left.plus().getTable(pair.right) != null) {
591+
if (pair.left.plus().tables().get(pair.right) != null) {
592592
// Table exists.
593593
if (create.ifNotExists) {
594594
return;

0 commit comments

Comments
 (0)