diff --git a/core/src/main/java/org/apache/calcite/jdbc/Driver.java b/core/src/main/java/org/apache/calcite/jdbc/Driver.java index c5d2c0e206c..3d7ac155d2c 100644 --- a/core/src/main/java/org/apache/calcite/jdbc/Driver.java +++ b/core/src/main/java/org/apache/calcite/jdbc/Driver.java @@ -69,7 +69,7 @@ public Driver() { /** Creates a Driver with a factory for {@code CalcitePrepare} objects; * if the factory is null, the driver will call - * {@link #createPrepareFactory()}. */ + * {@link CalcitePrepare#DEFAULT_FACTORY}. */ protected Driver(@Nullable Supplier prepareFactory) { this.prepareFactory = prepareFactory; } @@ -101,13 +101,12 @@ public CalcitePrepare createPrepare() { if (prepareFactory != null) { return prepareFactory.get(); } - return createPrepareFactory().apply(); + return CalcitePrepare.DEFAULT_FACTORY.apply(); } /** Returns a factory with which to create a {@link CalcitePrepare}. * - *

Now deprecated; if you wish to use a custom prepare, overrides of this - * method will still work, but we prefer that you call + *

Now deprecated; if you wish to use a custom prepare, please call * {@link #withPrepareFactory(Supplier)} * or override {@link #createPrepare()}. */ @Deprecated // to be removed before 2.0 diff --git a/core/src/test/java/org/apache/calcite/test/JdbcTest.java b/core/src/test/java/org/apache/calcite/test/JdbcTest.java index 0dcc797d4e1..cd77f8b26c0 100644 --- a/core/src/test/java/org/apache/calcite/test/JdbcTest.java +++ b/core/src/test/java/org/apache/calcite/test/JdbcTest.java @@ -47,7 +47,6 @@ import org.apache.calcite.linq4j.Ord; import org.apache.calcite.linq4j.QueryProvider; import org.apache.calcite.linq4j.Queryable; -import org.apache.calcite.linq4j.function.Function0; import org.apache.calcite.plan.RelOptPlanner; import org.apache.calcite.plan.RelOptUtil; import org.apache.calcite.prepare.CalcitePrepareImpl; @@ -902,17 +901,7 @@ private void checkTableFunctionInModel(Class clazz) { checkMockDdl(counter, true, driver2.withPrepareFactory(() -> new CountingPrepare(counter))); - // MockDdlDriver2 implements commit if we override its createPrepareFactory - // method. The method is deprecated but override still needs to work. - checkMockDdl(counter, true, - new MockDdlDriver2(counter) { - @SuppressWarnings("deprecation") - @Override protected Function0 createPrepareFactory() { - return () -> new CountingPrepare(counter); - } - }); - - // MockDdlDriver2 implements commit if we override its createPrepareFactory + // MockDdlDriver2 implements commit if we override its createPrepare // method. checkMockDdl(counter, true, new MockDdlDriver2(counter) {