This is an automated email from the ASF dual-hosted git repository.
zhehu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/main by this push:
new b1c09c665c [CALCITE-6754] Remove deprecated method calling in Driver
b1c09c665c is described below
commit b1c09c665cee42447f6cf519aec54d7c7d930247
Author: Zhe Hu <[email protected]>
AuthorDate: Tue Dec 24 22:01:44 2024 +0800
[CALCITE-6754] Remove deprecated method calling in Driver
---
core/src/main/java/org/apache/calcite/jdbc/Driver.java | 7 +++----
core/src/test/java/org/apache/calcite/test/JdbcTest.java | 13 +------------
2 files changed, 4 insertions(+), 16 deletions(-)
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 c5d2c0e206..3d7ac155d2 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 class Driver extends UnregisteredDriver {
/** 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<CalcitePrepare> prepareFactory) {
this.prepareFactory = prepareFactory;
}
@@ -101,13 +101,12 @@ public class Driver extends UnregisteredDriver {
if (prepareFactory != null) {
return prepareFactory.get();
}
- return createPrepareFactory().apply();
+ return CalcitePrepare.DEFAULT_FACTORY.apply();
}
/** Returns a factory with which to create a {@link CalcitePrepare}.
*
- * <p>Now deprecated; if you wish to use a custom prepare, overrides of this
- * method will still work, but we prefer that you call
+ * <p>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 f378fcca44..053d7595e0 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.Linq4j;
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;
@@ -903,17 +902,7 @@ public class JdbcTest {
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<CalcitePrepare> 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) {