From 0d45702000a153171bd339a8d00041ede82d3ea6 Mon Sep 17 00:00:00 2001 From: Joao Boto Date: Thu, 8 Aug 2024 15:35:51 +0200 Subject: [PATCH 1/3] [FLINK-36009] Move ContinuousUnBoundingSettings to source --- .../core/datastream/source/JdbcSource.java | 2 +- .../datastream/source/JdbcSourceBuilder.java | 2 +- .../config}/ContinuousUnBoundingSettings.java | 4 +- .../enumerator/JdbcSourceEnumerator.java | 2 +- .../source/JdbcSourceBuilderTest.java | 2 +- .../source/JdbcSourceStreamRelatedITCase.java | 2 +- .../utils/ContinuousUnBoundingSettings.java | 42 +++++++++++++++++++ 7 files changed, 49 insertions(+), 7 deletions(-) rename flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/{utils => core/datastream/source/config}/ContinuousUnBoundingSettings.java (95%) create mode 100644 flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/utils/ContinuousUnBoundingSettings.java diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSource.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSource.java index eef58c07d..c1989d466 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSource.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSource.java @@ -40,7 +40,7 @@ import org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplit; import org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplitSerializer; import org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider; -import org.apache.flink.connector.jdbc.utils.ContinuousUnBoundingSettings; +import org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings; import org.apache.flink.core.io.SimpleVersionedSerializer; import org.apache.flink.util.Preconditions; diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilder.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilder.java index 451082a05..9be29e983 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilder.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilder.java @@ -29,7 +29,7 @@ import org.apache.flink.connector.jdbc.datasource.connections.SimpleJdbcConnectionProvider; import org.apache.flink.connector.jdbc.split.JdbcParameterValuesProvider; import org.apache.flink.connector.jdbc.split.JdbcSlideTimingParameterProvider; -import org.apache.flink.connector.jdbc.utils.ContinuousUnBoundingSettings; +import org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings; import org.apache.flink.types.Row; import org.apache.flink.util.Preconditions; import org.apache.flink.util.StringUtils; diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/utils/ContinuousUnBoundingSettings.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/config/ContinuousUnBoundingSettings.java similarity index 95% rename from flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/utils/ContinuousUnBoundingSettings.java rename to flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/config/ContinuousUnBoundingSettings.java index db951ab60..da4a8d928 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/utils/ContinuousUnBoundingSettings.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/config/ContinuousUnBoundingSettings.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package org.apache.flink.connector.jdbc.utils; +package org.apache.flink.connector.jdbc.core.datastream.source.config; import org.apache.flink.annotation.PublicEvolving; @@ -31,7 +31,7 @@ * continuous discovery and streaming mode. */ @PublicEvolving -public final class ContinuousUnBoundingSettings implements Serializable { +public class ContinuousUnBoundingSettings implements Serializable { private static final long serialVersionUID = 1L; diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumerator.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumerator.java index 9ebf389ad..57b10d7c6 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumerator.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumerator.java @@ -23,7 +23,7 @@ import org.apache.flink.api.connector.source.SplitEnumerator; import org.apache.flink.api.connector.source.SplitEnumeratorContext; import org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplit; -import org.apache.flink.connector.jdbc.utils.ContinuousUnBoundingSettings; +import org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings; import org.apache.flink.util.Preconditions; import org.slf4j.Logger; diff --git a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilderTest.java b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilderTest.java index 36130033e..c53bba5e4 100644 --- a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilderTest.java +++ b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilderTest.java @@ -26,7 +26,7 @@ import org.apache.flink.connector.jdbc.split.JdbcNumericBetweenParametersProvider; import org.apache.flink.connector.jdbc.split.JdbcParameterValuesProvider; import org.apache.flink.connector.jdbc.split.JdbcSlideTimingParameterProvider; -import org.apache.flink.connector.jdbc.utils.ContinuousUnBoundingSettings; +import org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings; import org.apache.flink.types.Row; import org.junit.jupiter.api.Test; diff --git a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceStreamRelatedITCase.java b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceStreamRelatedITCase.java index 445f6ba98..b70a2de7a 100644 --- a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceStreamRelatedITCase.java +++ b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceStreamRelatedITCase.java @@ -31,7 +31,7 @@ import org.apache.flink.connector.jdbc.derby.DerbyTestBase; import org.apache.flink.connector.jdbc.split.JdbcSlideTimingParameterProvider; import org.apache.flink.connector.jdbc.testutils.JdbcITCaseBase; -import org.apache.flink.connector.jdbc.utils.ContinuousUnBoundingSettings; +import org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings; import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; import org.apache.flink.streaming.api.functions.KeyedProcessFunction; import org.apache.flink.streaming.api.functions.sink.SinkFunction; diff --git a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/utils/ContinuousUnBoundingSettings.java b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/utils/ContinuousUnBoundingSettings.java new file mode 100644 index 000000000..af88960f6 --- /dev/null +++ b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/utils/ContinuousUnBoundingSettings.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.connector.jdbc.utils; + +import org.apache.flink.annotation.PublicEvolving; + +import java.io.Serializable; +import java.time.Duration; +import java.util.Objects; + +import static org.apache.flink.util.Preconditions.checkNotNull; + +/** + * Settings describing how to do continuous file discovery and enumeration for the file source's + * continuous discovery and streaming mode. + * + * @deprecated Use {@link org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings} + */ +@PublicEvolving +@Deprecated +public final class ContinuousUnBoundingSettings extends org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings { + + public ContinuousUnBoundingSettings(Duration initialDiscoveryDelay, Duration discoveryInterval) { + super(initialDiscoveryDelay, discoveryInterval); + } +} From 9e44d50ad10d1a52cdff9ad9b39ae37daf077b36 Mon Sep 17 00:00:00 2001 From: Joao Boto Date: Wed, 28 Aug 2024 22:36:57 +0200 Subject: [PATCH 2/3] [FLINK-36009] Create architecture module to test all --- .../0c7b60d6-a12c-432d-8a72-747cabaeb7ed | 0 .../0f94f11b-9bc8-445a-8be8-e7dfd8a384b0 | 0 .../4bca2274-65a9-4a61-81ef-767d58233ea0 | 0 .../596bd7eb-1ed5-4963-a56a-941766d61233 | 0 .../6b9ab1b0-c14d-4667-bab5-407b81fba98b | 0 .../b10c194a-0517-4744-830f-81abfb71ab18 | 0 .../d45c3af5-52c6-45fd-9926-75e75e77473a | 0 .../f242ee43-a122-4d2f-a291-6439cdb9029f | 0 .../f2faddb7-ac11-4947-ac31-59d16e454201 | 288 ++++++++++++++++++ .../archunit-violations/stored.rules | 3 +- flink-connector-jdbc-architecture/pom.xml | 117 +++++++ .../ProductionCodeArchitectureTest.java | 3 +- .../TestCodeArchitectureTest.java | 3 +- .../src/test/resources/archunit.properties | 0 flink-connector-jdbc-core/pom.xml | 7 - .../core/datastream/source/JdbcSource.java | 2 +- .../datastream/source/JdbcSourceBuilder.java | 2 +- .../enumerator/JdbcSourceEnumerator.java | 2 +- .../source/JdbcSourceBuilderTest.java | 2 +- .../source/JdbcSourceStreamRelatedITCase.java | 2 +- flink-connector-jdbc-cratedb/pom.xml | 7 - flink-connector-jdbc-db2/pom.xml | 7 - flink-connector-jdbc-mysql/pom.xml | 7 - flink-connector-jdbc-oceanbase/pom.xml | 8 - flink-connector-jdbc-oracle/pom.xml | 7 - flink-connector-jdbc-postgres/pom.xml | 7 - .../dialect/CompatiblePostgresDialect.java | 4 +- .../CompatiblePostgresDialectConverter.java | 4 +- flink-connector-jdbc-sqlserver/pom.xml | 7 - flink-connector-jdbc-trino/pom.xml | 7 - .../utils/ContinuousUnBoundingSettings.java | 14 +- pom.xml | 36 +-- 32 files changed, 428 insertions(+), 118 deletions(-) rename {flink-connector-jdbc-core => flink-connector-jdbc-architecture}/archunit-violations/0c7b60d6-a12c-432d-8a72-747cabaeb7ed (100%) rename {flink-connector-jdbc-core => flink-connector-jdbc-architecture}/archunit-violations/0f94f11b-9bc8-445a-8be8-e7dfd8a384b0 (100%) rename {flink-connector-jdbc-core => flink-connector-jdbc-architecture}/archunit-violations/4bca2274-65a9-4a61-81ef-767d58233ea0 (100%) rename {flink-connector-jdbc-core => flink-connector-jdbc-architecture}/archunit-violations/596bd7eb-1ed5-4963-a56a-941766d61233 (100%) rename {flink-connector-jdbc-core => flink-connector-jdbc-architecture}/archunit-violations/6b9ab1b0-c14d-4667-bab5-407b81fba98b (100%) rename {flink-connector-jdbc-core => flink-connector-jdbc-architecture}/archunit-violations/b10c194a-0517-4744-830f-81abfb71ab18 (100%) rename {flink-connector-jdbc-core => flink-connector-jdbc-architecture}/archunit-violations/d45c3af5-52c6-45fd-9926-75e75e77473a (100%) rename {flink-connector-jdbc-core => flink-connector-jdbc-architecture}/archunit-violations/f242ee43-a122-4d2f-a291-6439cdb9029f (100%) create mode 100644 flink-connector-jdbc-architecture/archunit-violations/f2faddb7-ac11-4947-ac31-59d16e454201 rename {flink-connector-jdbc-core => flink-connector-jdbc-architecture}/archunit-violations/stored.rules (85%) create mode 100644 flink-connector-jdbc-architecture/pom.xml rename {flink-connector-jdbc-core/src/test/java/org/apache/flink => flink-connector-jdbc-architecture/src/test/java/org/apache/flink/connector/jdbc}/architecture/ProductionCodeArchitectureTest.java (92%) rename {flink-connector-jdbc-core/src/test/java/org/apache/flink => flink-connector-jdbc-architecture/src/test/java/org/apache/flink/connector/jdbc}/architecture/TestCodeArchitectureTest.java (92%) rename {flink-connector-jdbc-core => flink-connector-jdbc-architecture}/src/test/resources/archunit.properties (100%) diff --git a/flink-connector-jdbc-core/archunit-violations/0c7b60d6-a12c-432d-8a72-747cabaeb7ed b/flink-connector-jdbc-architecture/archunit-violations/0c7b60d6-a12c-432d-8a72-747cabaeb7ed similarity index 100% rename from flink-connector-jdbc-core/archunit-violations/0c7b60d6-a12c-432d-8a72-747cabaeb7ed rename to flink-connector-jdbc-architecture/archunit-violations/0c7b60d6-a12c-432d-8a72-747cabaeb7ed diff --git a/flink-connector-jdbc-core/archunit-violations/0f94f11b-9bc8-445a-8be8-e7dfd8a384b0 b/flink-connector-jdbc-architecture/archunit-violations/0f94f11b-9bc8-445a-8be8-e7dfd8a384b0 similarity index 100% rename from flink-connector-jdbc-core/archunit-violations/0f94f11b-9bc8-445a-8be8-e7dfd8a384b0 rename to flink-connector-jdbc-architecture/archunit-violations/0f94f11b-9bc8-445a-8be8-e7dfd8a384b0 diff --git a/flink-connector-jdbc-core/archunit-violations/4bca2274-65a9-4a61-81ef-767d58233ea0 b/flink-connector-jdbc-architecture/archunit-violations/4bca2274-65a9-4a61-81ef-767d58233ea0 similarity index 100% rename from flink-connector-jdbc-core/archunit-violations/4bca2274-65a9-4a61-81ef-767d58233ea0 rename to flink-connector-jdbc-architecture/archunit-violations/4bca2274-65a9-4a61-81ef-767d58233ea0 diff --git a/flink-connector-jdbc-core/archunit-violations/596bd7eb-1ed5-4963-a56a-941766d61233 b/flink-connector-jdbc-architecture/archunit-violations/596bd7eb-1ed5-4963-a56a-941766d61233 similarity index 100% rename from flink-connector-jdbc-core/archunit-violations/596bd7eb-1ed5-4963-a56a-941766d61233 rename to flink-connector-jdbc-architecture/archunit-violations/596bd7eb-1ed5-4963-a56a-941766d61233 diff --git a/flink-connector-jdbc-core/archunit-violations/6b9ab1b0-c14d-4667-bab5-407b81fba98b b/flink-connector-jdbc-architecture/archunit-violations/6b9ab1b0-c14d-4667-bab5-407b81fba98b similarity index 100% rename from flink-connector-jdbc-core/archunit-violations/6b9ab1b0-c14d-4667-bab5-407b81fba98b rename to flink-connector-jdbc-architecture/archunit-violations/6b9ab1b0-c14d-4667-bab5-407b81fba98b diff --git a/flink-connector-jdbc-core/archunit-violations/b10c194a-0517-4744-830f-81abfb71ab18 b/flink-connector-jdbc-architecture/archunit-violations/b10c194a-0517-4744-830f-81abfb71ab18 similarity index 100% rename from flink-connector-jdbc-core/archunit-violations/b10c194a-0517-4744-830f-81abfb71ab18 rename to flink-connector-jdbc-architecture/archunit-violations/b10c194a-0517-4744-830f-81abfb71ab18 diff --git a/flink-connector-jdbc-core/archunit-violations/d45c3af5-52c6-45fd-9926-75e75e77473a b/flink-connector-jdbc-architecture/archunit-violations/d45c3af5-52c6-45fd-9926-75e75e77473a similarity index 100% rename from flink-connector-jdbc-core/archunit-violations/d45c3af5-52c6-45fd-9926-75e75e77473a rename to flink-connector-jdbc-architecture/archunit-violations/d45c3af5-52c6-45fd-9926-75e75e77473a diff --git a/flink-connector-jdbc-core/archunit-violations/f242ee43-a122-4d2f-a291-6439cdb9029f b/flink-connector-jdbc-architecture/archunit-violations/f242ee43-a122-4d2f-a291-6439cdb9029f similarity index 100% rename from flink-connector-jdbc-core/archunit-violations/f242ee43-a122-4d2f-a291-6439cdb9029f rename to flink-connector-jdbc-architecture/archunit-violations/f242ee43-a122-4d2f-a291-6439cdb9029f diff --git a/flink-connector-jdbc-architecture/archunit-violations/f2faddb7-ac11-4947-ac31-59d16e454201 b/flink-connector-jdbc-architecture/archunit-violations/f2faddb7-ac11-4947-ac31-59d16e454201 new file mode 100644 index 000000000..891af17c0 --- /dev/null +++ b/flink-connector-jdbc-architecture/archunit-violations/f2faddb7-ac11-4947-ac31-59d16e454201 @@ -0,0 +1,288 @@ +Class extends class in (AbstractJdbcCatalog.java:0) +Class extends class in (JdbcFilterPushdownPreparedStatementVisitor.java:0) +Constructor (java.lang.String, java.lang.String, int, java.util.Properties)> calls method in (JdbcConnectionOptions.java:50) +Constructor (java.lang.String, java.lang.String, int, java.util.Properties)> calls method in (JdbcConnectionOptions.java:53) +Constructor (java.lang.String, java.lang.String, int, java.util.Properties)> calls method in (JdbcConnectionOptions.java:57) +Constructor (boolean, int, boolean, java.util.Optional, boolean)> calls method in (JdbcExactlyOnceOptions.java:75) +Constructor (long, int, int)> calls method in (JdbcExecutionOptions.java:38) +Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)> calls constructor (java.lang.String, java.lang.String)> in (AbstractJdbcCatalog.java:123) +Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)> calls method in (AbstractJdbcCatalog.java:126) +Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)> calls method in (AbstractJdbcCatalog.java:134) +Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)> calls method in (AbstractJdbcCatalog.java:136) +Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)> calls method in (AbstractJdbcCatalog.java:125) +Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)> calls method in (AbstractJdbcCatalog.java:133) +Constructor (org.apache.flink.table.types.logical.RowType)> calls method in (AbstractDialectConverter.java:60) +Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions, org.apache.flink.connector.jdbc.datasource.statements.JdbcQueryStatement, org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer, org.apache.flink.connector.base.DeliveryGuarantee, java.util.Collection, org.apache.flink.api.connector.sink2.Sink$InitContext)> calls method in (JdbcWriter.java:95) +Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions, org.apache.flink.connector.jdbc.datasource.statements.JdbcQueryStatement, org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer, org.apache.flink.connector.base.DeliveryGuarantee, java.util.Collection, org.apache.flink.api.connector.sink2.Sink$InitContext)> calls method in (JdbcWriter.java:100) +Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions, org.apache.flink.connector.jdbc.datasource.statements.JdbcQueryStatement, org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer, org.apache.flink.connector.base.DeliveryGuarantee, java.util.Collection, org.apache.flink.api.connector.sink2.Sink$InitContext)> calls method in (JdbcWriter.java:101) +Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions, org.apache.flink.connector.jdbc.datasource.statements.JdbcQueryStatement, org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer, org.apache.flink.connector.base.DeliveryGuarantee, java.util.Collection, org.apache.flink.api.connector.sink2.Sink$InitContext)> calls method in (JdbcWriter.java:122) +Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions, org.apache.flink.connector.jdbc.datasource.statements.JdbcQueryStatement, org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer, org.apache.flink.connector.base.DeliveryGuarantee, java.util.Collection, org.apache.flink.api.connector.sink2.Sink$InitContext)> calls method in (JdbcWriter.java:123) +Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions, org.apache.flink.connector.jdbc.datasource.statements.JdbcQueryStatement, org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer, org.apache.flink.connector.base.DeliveryGuarantee, java.util.Collection, org.apache.flink.api.connector.sink2.Sink$InitContext)> calls method in (JdbcWriter.java:82) +Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions, org.apache.flink.connector.jdbc.datasource.statements.JdbcQueryStatement, org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer, org.apache.flink.connector.base.DeliveryGuarantee, java.util.Collection, org.apache.flink.api.connector.sink2.Sink$InitContext)> calls method in (JdbcWriter.java:84) +Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions, org.apache.flink.connector.jdbc.datasource.statements.JdbcQueryStatement, org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer, org.apache.flink.connector.base.DeliveryGuarantee, java.util.Collection, org.apache.flink.api.connector.sink2.Sink$InitContext)> calls method in (JdbcWriter.java:92) +Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions, org.apache.flink.connector.jdbc.datasource.statements.JdbcQueryStatement, org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer, org.apache.flink.connector.base.DeliveryGuarantee, java.util.Collection, org.apache.flink.api.connector.sink2.Sink$InitContext)> calls method in (JdbcWriter.java:102) +Constructor (org.apache.flink.configuration.Configuration, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.core.datastream.source.enumerator.JdbcSqlSplitEnumeratorBase$Provider, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings)> calls method in (JdbcSource.java:78) +Constructor (org.apache.flink.configuration.Configuration, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.core.datastream.source.enumerator.JdbcSqlSplitEnumeratorBase$Provider, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings)> calls method in (JdbcSource.java:79) +Constructor (org.apache.flink.configuration.Configuration, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.core.datastream.source.enumerator.JdbcSqlSplitEnumeratorBase$Provider, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings)> calls method in (JdbcSource.java:80) +Constructor (org.apache.flink.configuration.Configuration, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.core.datastream.source.enumerator.JdbcSqlSplitEnumeratorBase$Provider, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings)> calls method in (JdbcSource.java:81) +Constructor (org.apache.flink.configuration.Configuration, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.core.datastream.source.enumerator.JdbcSqlSplitEnumeratorBase$Provider, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings)> calls method in (JdbcSource.java:84) +Constructor (java.time.Duration, java.time.Duration)> calls method in (ContinuousUnBoundingSettings.java:44) +Constructor (org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplitSerializer)> calls method in (JdbcSourceEnumStateSerializer.java:47) +Constructor (org.apache.flink.api.connector.source.SplitEnumeratorContext, org.apache.flink.connector.jdbc.core.datastream.source.enumerator.JdbcSqlSplitEnumeratorBase, org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings, java.util.List)> calls method in (JdbcSourceEnumerator.java:61) +Constructor (org.apache.flink.api.connector.source.SplitEnumeratorContext, org.apache.flink.connector.jdbc.core.datastream.source.enumerator.JdbcSqlSplitEnumeratorBase, org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings, java.util.List)> calls method in (JdbcSourceEnumerator.java:62) +Constructor (org.apache.flink.api.connector.source.SplitEnumeratorContext, org.apache.flink.connector.jdbc.core.datastream.source.enumerator.JdbcSqlSplitEnumeratorBase, org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings, java.util.List)> calls method in (JdbcSourceEnumerator.java:68) +Constructor (java.util.List, java.util.List, java.util.List, java.io.Serializable)> calls method in (JdbcSourceEnumeratorState.java:47) +Constructor (java.util.List, java.util.List, java.util.List, java.io.Serializable)> calls method in (JdbcSourceEnumeratorState.java:48) +Constructor (java.util.List, java.util.List, java.util.List, java.io.Serializable)> calls method in (JdbcSourceEnumeratorState.java:49) +Constructor (java.io.Serializable, java.lang.String, org.apache.flink.connector.jdbc.split.JdbcParameterValuesProvider)> calls method in (SqlTemplateSplitEnumerator.java:54) +Constructor (org.apache.flink.api.connector.source.SourceReaderContext, org.apache.flink.configuration.Configuration, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor)> calls method in (JdbcSourceSplitReader.java:117) +Constructor (org.apache.flink.api.connector.source.SourceReaderContext, org.apache.flink.configuration.Configuration, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor)> calls method in (JdbcSourceSplitReader.java:104) +Constructor (org.apache.flink.api.connector.source.SourceReaderContext, org.apache.flink.configuration.Configuration, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor)> calls method in (JdbcSourceSplitReader.java:105) +Constructor (org.apache.flink.api.connector.source.SourceReaderContext, org.apache.flink.configuration.Configuration, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor)> calls method in (JdbcSourceSplitReader.java:106) +Constructor (org.apache.flink.api.connector.source.SourceReaderContext, org.apache.flink.configuration.Configuration, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor)> calls method in (JdbcSourceSplitReader.java:107) +Constructor (org.apache.flink.api.connector.source.SourceReaderContext, org.apache.flink.configuration.Configuration, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor)> calls method in (JdbcSourceSplitReader.java:112) +Constructor (org.apache.flink.api.connector.source.SourceReaderContext, org.apache.flink.configuration.Configuration, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor)> calls method in (JdbcSourceSplitReader.java:120) +Constructor (org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplit)> calls method in (JdbcSourceSplitState.java:38) +Constructor (java.util.function.Function)> calls constructor ()> in (JdbcFilterPushdownPreparedStatementVisitor.java:52) +Constructor (org.apache.flink.connector.jdbc.internal.options.InternalJdbcConnectionOptions, int, [Ljava.lang.String;, [Lorg.apache.flink.table.types.DataType;, [Ljava.lang.String;, org.apache.flink.table.types.logical.RowType, java.util.List, [Ljava.io.Serializable;)> calls method in (JdbcRowDataLookupFunction.java:95) +Constructor (org.apache.flink.connector.jdbc.internal.options.InternalJdbcConnectionOptions, int, [Ljava.lang.String;, [Lorg.apache.flink.table.types.DataType;, [Ljava.lang.String;, org.apache.flink.table.types.logical.RowType, java.util.List, [Ljava.io.Serializable;)> calls method in (JdbcRowDataLookupFunction.java:82) +Constructor (org.apache.flink.connector.jdbc.internal.options.InternalJdbcConnectionOptions, int, [Ljava.lang.String;, [Lorg.apache.flink.table.types.DataType;, [Ljava.lang.String;, org.apache.flink.table.types.logical.RowType, java.util.List, [Ljava.io.Serializable;)> calls method in (JdbcRowDataLookupFunction.java:83) +Constructor (org.apache.flink.connector.jdbc.internal.options.InternalJdbcConnectionOptions, int, [Ljava.lang.String;, [Lorg.apache.flink.table.types.DataType;, [Ljava.lang.String;, org.apache.flink.table.types.logical.RowType, java.util.List, [Ljava.io.Serializable;)> calls method in (JdbcRowDataLookupFunction.java:84) +Constructor (org.apache.flink.connector.jdbc.internal.options.InternalJdbcConnectionOptions, int, [Ljava.lang.String;, [Lorg.apache.flink.table.types.DataType;, [Ljava.lang.String;, org.apache.flink.table.types.logical.RowType, java.util.List, [Ljava.io.Serializable;)> calls method in (JdbcRowDataLookupFunction.java:85) +Constructor (org.apache.flink.connector.jdbc.internal.options.InternalJdbcConnectionOptions, int, [Ljava.lang.String;, [Lorg.apache.flink.table.types.DataType;, [Ljava.lang.String;, org.apache.flink.table.types.logical.RowType, java.util.List, [Ljava.io.Serializable;)> calls method in (JdbcRowDataLookupFunction.java:86) +Constructor (org.apache.flink.connector.jdbc.internal.options.InternalJdbcConnectionOptions, int, [Ljava.lang.String;, [Lorg.apache.flink.table.types.DataType;, [Ljava.lang.String;, org.apache.flink.table.types.logical.RowType, java.util.List, [Ljava.io.Serializable;)> calls method in (JdbcRowDataLookupFunction.java:87) +Constructor (org.apache.flink.connector.jdbc.internal.options.InternalJdbcConnectionOptions, int, [Ljava.lang.String;, [Lorg.apache.flink.table.types.DataType;, [Ljava.lang.String;, org.apache.flink.table.types.logical.RowType, java.util.List, [Ljava.io.Serializable;)> has parameter of type <[Lorg.apache.flink.table.types.DataType;> in (JdbcRowDataLookupFunction.java:0) +Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)> is annotated with in (CrateDBCatalog.java:0) +Constructor (java.util.function.Supplier, java.lang.Integer)> calls method in (SimpleXaConnectionProvider.java:81) +Constructor (int, [B, [B)> calls method in (XidImpl.java:46) +Constructor (int, [B, [B)> calls method in (XidImpl.java:47) +Constructor (org.apache.flink.connector.jdbc.internal.JdbcOutputFormat)> calls method in (GenericJdbcSinkFunction.java:44) +Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.internal.JdbcOutputFormat$StatementExecutorFactory)> calls method in (JdbcOutputFormat.java:87) +Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.internal.JdbcOutputFormat$StatementExecutorFactory)> calls method in (JdbcOutputFormat.java:88) +Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.internal.JdbcOutputFormat$StatementExecutorFactory)> calls method in (JdbcOutputFormat.java:89) +Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.internal.JdbcOutputFormat$StatementExecutorFactory, org.apache.flink.connector.jdbc.internal.JdbcOutputFormat$StatementExecutorFactory)> is annotated with in (TableJdbcUpsertOutputFormat.java:0) +Constructor (java.lang.String, java.lang.String, java.lang.String, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, java.util.function.Function, java.util.function.Function)> calls method in (InsertOrUpdateJdbcExecutor.java:76) +Constructor (java.lang.String, java.lang.String, java.lang.String, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, java.util.function.Function, java.util.function.Function)> calls method in (InsertOrUpdateJdbcExecutor.java:77) +Constructor (java.lang.String, java.lang.String, java.lang.String, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, java.util.function.Function, java.util.function.Function)> calls method in (InsertOrUpdateJdbcExecutor.java:78) +Constructor (java.lang.String, java.lang.String, java.lang.String, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, java.util.function.Function, java.util.function.Function)> calls method in (InsertOrUpdateJdbcExecutor.java:79) +Constructor (java.lang.String, java.lang.String, java.lang.String, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, java.util.function.Function, java.util.function.Function)> calls method in (InsertOrUpdateJdbcExecutor.java:80) +Constructor (java.lang.String, java.lang.String, java.lang.String, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, java.util.function.Function, java.util.function.Function)> calls method in (InsertOrUpdateJdbcExecutor.java:81) +Constructor (java.lang.String, java.lang.String, java.lang.String, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, java.util.function.Function, java.util.function.Function)> calls method in (InsertOrUpdateJdbcExecutor.java:82) +Constructor (java.lang.String, java.lang.String, java.lang.String, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, java.util.function.Function, java.util.function.Function)> calls method in (InsertOrUpdateJdbcExecutor.java:83) +Constructor (org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, java.util.function.Function)> calls method in (TableInsertOrUpdateStatementExecutor.java:64) +Constructor (org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, java.util.function.Function)> calls method in (TableInsertOrUpdateStatementExecutor.java:65) +Constructor (org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, java.util.function.Function)> calls method in (TableInsertOrUpdateStatementExecutor.java:66) +Constructor (org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, java.util.function.Function)> calls method in (TableInsertOrUpdateStatementExecutor.java:67) +Constructor (org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, java.util.function.Function)> calls method in (TableInsertOrUpdateStatementExecutor.java:68) +Constructor (org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, java.util.function.Function)> calls method in (TableInsertOrUpdateStatementExecutor.java:69) +Constructor (org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter)> calls method in (TableSimpleStatementExecutor.java:48) +Constructor (org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter)> calls method in (TableSimpleStatementExecutor.java:49) +Constructor (java.lang.String, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialect, [Ljava.lang.String;, [I, [Ljava.lang.String;)> calls method in (JdbcDmlOptions.java:51) +Constructor (java.lang.String, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialect, [Ljava.lang.String;, [I, [Ljava.lang.String;)> calls method in (JdbcDmlOptions.java:52) +Constructor (java.lang.String, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialect, [Ljava.lang.String;, [I, [Ljava.lang.String;)> calls method in (JdbcDmlOptions.java:53) +Constructor (java.lang.String, [I)> calls method in (JdbcInsertOptions.java:33) +Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)> is annotated with in (MySqlCatalog.java:0) +Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)> calls method in (MySqlCatalog.java:92) +Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)> calls method in (MySqlCatalog.java:94) +Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)> is annotated with in (PostgresCatalog.java:0) +Constructor (java.lang.String, java.lang.String)> calls method in (PostgresTablePath.java:41) +Constructor (java.lang.String, java.lang.String)> calls method in (PostgresTablePath.java:44) +Constructor (org.apache.flink.connector.jdbc.split.JdbcParameterValuesProvider, org.apache.flink.connector.jdbc.split.JdbcParameterValuesProvider)> calls method in (CompositeJdbcParameterValuesProvider.java:34) +Constructor (long, long)> calls method in (JdbcNumericBetweenParametersProvider.java:55) +Constructor (long, long, long)> calls method in (JdbcNumericBetweenParametersProvider.java:68) +Constructor (java.lang.Long, long, long, long)> calls method in (JdbcSlideTimingParameterProvider.java:46) +Constructor (java.lang.Long, long, long, long)> calls method in (JdbcSlideTimingParameterProvider.java:49) +Constructor (java.lang.Long, long, long, long)> calls method in (JdbcSlideTimingParameterProvider.java:53) +Constructor (java.lang.Long, long, long, long)> calls method in (JdbcSlideTimingParameterProvider.java:45) +Field has type <[Lorg.apache.flink.table.types.logical.LogicalType;> in (AbstractDialectConverter.java:0) +Field has type <[Lorg.apache.flink.table.types.DataType;> in (JdbcOutputFormatBuilder.java:0) +Interface extends interface in (JdbcStatementBuilder.java:0) +Method calls method in (JdbcConnectionOptions.java:116) +Method calls method in (JdbcConnectionOptions.java:117) +Method calls method in (JdbcInputFormat.java:407) +Method calls method in (AbstractJdbcCatalog.java:227) +Method calls constructor (java.util.Map, java.lang.String)> in (AbstractJdbcCatalog.java:258) +Method calls method in (AbstractJdbcCatalog.java:254) +Method calls method in (AbstractJdbcCatalog.java:200) +Method calls method in (AbstractJdbcCatalog.java:586) +Method calls method in (AbstractDialect.java:256) +Method calls method in (JdbcSinkBuilder.java:111) +Method calls method in (JdbcSinkBuilder.java:112) +Method calls method in (JdbcSinkBuilder.java:113) +Method calls method in (JdbcSinkBuilder.java:114) +Method calls method in (JdbcSinkBuilder.java:115) +Method calls method in (JdbcSinkBuilder.java:67) +Method calls method in (JdbcSinkBuilder.java:73) +Method calls method in (JdbcSinkBuilder.java:78) +Method calls method in (JdbcSinkBuilder.java:101) +Method calls method in (JdbcSinkBuilder.java:102) +Method calls method in (JdbcSinkBuilder.java:85) +Method calls method in (JdbcSinkBuilder.java:86) +Method calls method in (JdbcSinkBuilder.java:51) +Method calls constructor ([B)> in (JdbcCommitableSerializer.java:34) +Method calls constructor (int)> in (JdbcCommitableSerializer.java:27) +Method calls method in (JdbcCommitableSerializer.java:29) +Method calls method in (JdbcWriter.java:192) +Method calls constructor ([B)> in (JdbcWriterStateSerializer.java:48) +Method calls method in (JdbcWriterStateSerializer.java:62) +Method calls method in (JdbcWriterStateSerializer.java:70) +Method calls method in (JdbcWriterStateSerializer.java:60) +Method calls method in (JdbcWriterStateSerializer.java:68) +Method calls method in (JdbcWriterStateSerializer.java:57) +Method calls method in (JdbcWriterStateSerializer.java:65) +Method has parameter of type in (JdbcWriterStateSerializer.java:0) +Method calls constructor (int)> in (JdbcWriterStateSerializer.java:29) +Method calls method in (JdbcWriterStateSerializer.java:42) +Method calls method in (JdbcWriterStateSerializer.java:34) +Method calls method in (JdbcWriterStateSerializer.java:40) +Method calls method in (JdbcWriterStateSerializer.java:33) +Method calls method in (JdbcWriterStateSerializer.java:39) +Method calls method in (JdbcWriterStateSerializer.java:30) +Method calls method in (JdbcWriterStateSerializer.java:36) +Method is annotated with in (JdbcSource.java:0) +Method is annotated with in (JdbcSource.java:0) +Method is annotated with in (JdbcSource.java:0) +Method is annotated with in (JdbcSource.java:0) +Method is annotated with in (JdbcSource.java:0) +Method calls method in (JdbcSourceBuilder.java:295) +Method calls method in (JdbcSourceBuilder.java:304) +Method calls method in (JdbcSourceBuilder.java:276) +Method calls method in (JdbcSourceBuilder.java:291) +Method calls method in (JdbcSourceBuilder.java:292) +Method calls method in (JdbcSourceBuilder.java:289) +Method calls method in (JdbcSourceBuilder.java:218) +Method calls method in (JdbcSourceBuilder.java:219) +Method calls method in (JdbcSourceBuilder.java:259) +Method calls method in (JdbcSourceBuilder.java:169) +Method calls method in (JdbcSourceBuilder.java:207) +Method calls method in (JdbcSourceBuilder.java:161) +Method calls method in (JdbcSourceBuilder.java:202) +Method calls method in (JdbcSourceBuilder.java:145) +Method calls method in (JdbcSourceBuilder.java:249) +Method calls method in (JdbcSourceBuilder.java:225) +Method calls method in (JdbcSourceBuilder.java:136) +Method calls method in (JdbcSourceBuilder.java:178) +Method calls method in (JdbcSourceEnumStateSerializer.java:110) +Method calls method in (JdbcSourceEnumStateSerializer.java:70) +Method calls method in (JdbcSourceEnumStateSerializer.java:58) +Method calls method in (JdbcSourceEnumStateSerializer.java:86) +Method calls method in (SqlTemplateSplitEnumerator.java:118) +Method is annotated with in (SqlTemplateSplitEnumerator.java:0) +Method is annotated with in (SqlTemplateSplitEnumerator.java:0) +Method calls method in (JdbcSourceSplitReader.java:138) +Method calls method in (JdbcSourceSplitReader.java:165) +Method is annotated with in (JdbcSourceSplitReader.java:0) +Method is annotated with in (JdbcSourceSplitReader.java:0) +Method is annotated with in (JdbcSourceSplitReader.java:0) +Method is annotated with in (JdbcSourceSplitReader.java:0) +Method calls method in (RowResultExtractor.java:33) +Method calls method in (JdbcSourceSplit.java:71) +Method calls method in (JdbcSourceSplitSerializer.java:105) +Method calls method in (JdbcSourceSplitSerializer.java:98) +Method calls method in (JdbcSourceSplitSerializer.java:46) +Method calls method in (JdbcSourceSplitSerializer.java:80) +Method calls method in (JdbcSourceSplitSerializer.java:85) +Method calls method in (JdbcDynamicTableFactory.java:353) +Method has parameter of type <[Lorg.apache.flink.configuration.ConfigOption;> in (JdbcDynamicTableFactory.java:0) +Method gets field in (JdbcDynamicTableFactory.java:129) +Method calls method in (JdbcDynamicTableFactory.java:218) +Method gets field in (JdbcDynamicTableFactory.java:217) +Method gets field in (JdbcDynamicTableFactory.java:216) +Method gets field in (JdbcDynamicTableFactory.java:259) +Method gets field in (JdbcDynamicTableFactory.java:264) +Method gets field in (JdbcDynamicTableFactory.java:263) +Method gets field in (JdbcDynamicTableFactory.java:260) +Method gets field in (JdbcDynamicTableFactory.java:261) +Method gets field in (JdbcDynamicTableFactory.java:262) +Method calls method in (JdbcDynamicTableSink.java:84) +Method calls method in (JdbcDynamicTableSink.java:69) +Method calls method in (JdbcOutputFormatBuilder.java:81) +Method calls method in (JdbcOutputFormatBuilder.java:82) +Method calls method in (JdbcOutputFormatBuilder.java:83) +Method calls method in (JdbcOutputFormatBuilder.java:116) +Method has parameter of type <[Lorg.apache.flink.table.types.logical.LogicalType;> in (JdbcOutputFormatBuilder.java:0) +Method has parameter of type <[Lorg.apache.flink.table.types.logical.LogicalType;> in (JdbcOutputFormatBuilder.java:0) +Method has parameter of type <[Lorg.apache.flink.table.types.logical.LogicalType;> in (JdbcOutputFormatBuilder.java:0) +Method has parameter of type <[Lorg.apache.flink.table.types.logical.LogicalType;> in (JdbcOutputFormatBuilder.java:0) +Method has parameter of type <[Lorg.apache.flink.table.types.logical.LogicalType;> in (JdbcOutputFormatBuilder.java:0) +Method has parameter of type <[Lorg.apache.flink.table.types.logical.LogicalType;> in (JdbcOutputFormatBuilder.java:0) +Method has parameter of type <[Lorg.apache.flink.table.types.logical.LogicalType;> in (JdbcOutputFormatBuilder.java:0) +Method has parameter of type <[Lorg.apache.flink.table.data.RowData$FieldGetter;> in (JdbcOutputFormatBuilder.java:0) +Method has parameter of type <[Lorg.apache.flink.table.types.DataType;> in (JdbcOutputFormatBuilder.java:0) +Method calls method in (JdbcDynamicTableSource.java:101) +Method calls method in (JdbcRowDataInputFormat.java:356) +Method has return type <[Lorg.apache.flink.core.io.InputSplit;> in (JdbcRowDataInputFormat.java:0) +Method calls constructor ([Lorg.apache.flink.core.io.InputSplit;)> in (JdbcRowDataInputFormat.java:287) +Method has parameter of type <[Lorg.apache.flink.core.io.InputSplit;> in (JdbcRowDataInputFormat.java:0) +Method is annotated with in (JdbcRowDataLookupFunction.java:0) +Method calls method in (CrateDBTablePath.java:43) +Method calls method in (SimpleJdbcConnectionProvider.java:87) +Method calls method in (PoolingXaConnectionProvider.java:109) +Method calls method in (PoolingXaConnectionProvider.java:79) +Method calls method in (PoolingXaConnectionProvider.java:202) +Method calls method in (PoolingXaConnectionProvider.java:91) +Method calls method in (SimpleXaConnectionProvider.java:261) +Method is annotated with in (SimpleXaConnectionProvider.java:0) +Method calls method in (SimpleXaConnectionProvider.java:128) +Method calls method in (SimpleXaConnectionProvider.java:101) +Method calls method in (SimpleXaConnectionProvider.java:87) +Method calls method in (SimpleXaConnectionProvider.java:246) +Method calls method in (XaTransaction.java:121) +Method calls method in (XaTransaction.java:122) +Method calls method in (XaTransaction.java:135) +Method calls method in (XaTransaction.java:130) +Method calls method in (XaTransaction.java:86) +Method calls method in (XaTransaction.java:151) +Method calls constructor ([B)> in (TransactionId.java:96) +Method calls method in (TransactionId.java:101) +Method calls method in (TransactionId.java:98) +Method calls method in (TransactionId.java:99) +Method calls method in (TransactionId.java:100) +Method calls constructor ([B)> in (TransactionId.java:83) +Method calls constructor ([B)> in (TransactionId.java:87) +Method calls method in (TransactionId.java:85) +Method calls method in (TransactionId.java:88) +Method calls method in (TransactionId.java:89) +Method calls constructor (int)> in (TransactionId.java:172) +Method calls method in (TransactionId.java:175) +Method calls method in (TransactionId.java:173) +Method calls method in (TransactionId.java:174) +Method calls method in (TransactionId.java:169) +Method calls constructor (int)> in (TransactionId.java:158) +Method calls method in (TransactionId.java:161) +Method calls method in (TransactionId.java:159) +Method calls method in (TransactionId.java:160) +Method calls method in (TransactionId.java:110) +Method has parameter of type in (TransactionId.java:0) +Method calls constructor (int)> in (TransactionId.java:183) +Method calls method in (TransactionId.java:189) +Method calls method in (TransactionId.java:184) +Method calls method in (TransactionId.java:185) +Method calls method in (TransactionId.java:186) +Method calls method in (TransactionId.java:188) +Method calls method in (TransactionId.java:187) +Method is annotated with in (JdbcOutputFormat.java:0) +Method calls constructor (java.lang.String)> in (JdbcOutputFormat.java:103) +Method calls method in (JdbcOutputFormat.java:94) +Method calls method in (RowJdbcOutputFormat.java:132) +Method calls method in (TableJdbcUpsertOutputFormat.java:152) +Method calls method in (InternalJdbcConnectionOptions.java:202) +Method calls method in (InternalJdbcConnectionOptions.java:203) +Method calls method in (InternalJdbcConnectionOptions.java:195) +Method calls method in (InternalJdbcConnectionOptions.java:196) +Method calls method in (MySqlCatalog.java:114) +Method calls method in (OceanBaseCatalog.java:108) +Method calls method in (PostgresCatalog.java:184) +Method calls method in (PostgresTablePath.java:56) +Method calls method in (PostgresDialectConverter.java:77) +Method calls method in (JdbcNumericBetweenParametersProvider.java:100) +Method calls method in (JdbcNumericBetweenParametersProvider.java:87) +Method calls method in (JdbcNumericBetweenParametersProvider.java:75) +Method calls method in (JdbcSlideTimingParameterProvider.java:76) +Method calls method in (FieldNamedPreparedStatementImpl.java:247) +Method calls method in (FieldNamedPreparedStatementImpl.java:202) +Method calls method in (FieldNamedPreparedStatementImpl.java:212) +Method calls method in (FieldNamedPreparedStatementImpl.java:187) +Method calls method in (FieldNamedPreparedStatementImpl.java:188) +Method calls method in (FieldNamedPreparedStatementImpl.java:189) +Method calls method in (JdbcUtils.java:49) \ No newline at end of file diff --git a/flink-connector-jdbc-core/archunit-violations/stored.rules b/flink-connector-jdbc-architecture/archunit-violations/stored.rules similarity index 85% rename from flink-connector-jdbc-core/archunit-violations/stored.rules rename to flink-connector-jdbc-architecture/archunit-violations/stored.rules index 0f9bf9b46..e91f57755 100644 --- a/flink-connector-jdbc-core/archunit-violations/stored.rules +++ b/flink-connector-jdbc-architecture/archunit-violations/stored.rules @@ -1,5 +1,5 @@ # -#Tue May 28 16:21:17 CEST 2024 +#Wed Aug 28 22:23:37 CEST 2024 Return\ and\ argument\ types\ of\ methods\ annotated\ with\ @Public\ must\ be\ annotated\ with\ @Public.=596bd7eb-1ed5-4963-a56a-941766d61233 Connector\ production\ code\ must\ not\ depend\ on\ non-public\ API\ outside\ of\ connector\ packages=f242ee43-a122-4d2f-a291-6439cdb9029f ITCASE\ tests\ should\ use\ a\ MiniCluster\ resource\ or\ extension=6b9ab1b0-c14d-4667-bab5-407b81fba98b @@ -8,3 +8,4 @@ Options\ for\ connectors\ and\ formats\ should\ reside\ in\ a\ consistent\ packa Tests\ inheriting\ from\ AbstractTestBase\ should\ have\ name\ ending\ with\ ITCase=0f94f11b-9bc8-445a-8be8-e7dfd8a384b0 Return\ and\ argument\ types\ of\ methods\ annotated\ with\ @PublicEvolving\ must\ be\ annotated\ with\ @Public(Evolving).=d45c3af5-52c6-45fd-9926-75e75e77473a Classes\ in\ API\ packages\ should\ have\ at\ least\ one\ API\ visibility\ annotation.=0c7b60d6-a12c-432d-8a72-747cabaeb7ed +Connector\ production\ code\ must\ depend\ only\ on\ public\ API\ when\ outside\ of\ connector\ packages=f2faddb7-ac11-4947-ac31-59d16e454201 diff --git a/flink-connector-jdbc-architecture/pom.xml b/flink-connector-jdbc-architecture/pom.xml new file mode 100644 index 000000000..3e123fcc8 --- /dev/null +++ b/flink-connector-jdbc-architecture/pom.xml @@ -0,0 +1,117 @@ + + + 4.0.0 + + org.apache.flink + flink-connector-jdbc-parent + 3.3-SNAPSHOT + + + flink-connector-jdbc-architecture + Flink : Connectors : JDBC : Architecture + + jar + + + + + org.apache.flink + flink-architecture-tests-base + ${flink.version} + test + + + org.apache.flink + flink-architecture-tests-test + ${flink.version} + test + + + org.apache.flink + flink-architecture-tests-production + ${flink.version} + test + + + + + org.apache.flink + flink-connector-jdbc + ${project.version} + test + + + org.apache.flink + flink-connector-jdbc-core + ${project.version} + test + + + org.apache.flink + flink-connector-jdbc-cratedb + ${project.version} + test + + + org.apache.flink + flink-connector-jdbc-db2 + ${project.version} + test + + + org.apache.flink + flink-connector-jdbc-mysql + ${project.version} + test + + + org.apache.flink + flink-connector-jdbc-oceanbase + ${project.version} + test + + + org.apache.flink + flink-connector-jdbc-oracle + ${project.version} + test + + + org.apache.flink + flink-connector-jdbc-postgres + ${project.version} + test + + + org.apache.flink + flink-connector-jdbc-sqlserver + ${project.version} + test + + + org.apache.flink + flink-connector-jdbc-trino + ${project.version} + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + + + + \ No newline at end of file diff --git a/flink-connector-jdbc-core/src/test/java/org/apache/flink/architecture/ProductionCodeArchitectureTest.java b/flink-connector-jdbc-architecture/src/test/java/org/apache/flink/connector/jdbc/architecture/ProductionCodeArchitectureTest.java similarity index 92% rename from flink-connector-jdbc-core/src/test/java/org/apache/flink/architecture/ProductionCodeArchitectureTest.java rename to flink-connector-jdbc-architecture/src/test/java/org/apache/flink/connector/jdbc/architecture/ProductionCodeArchitectureTest.java index e88416b18..d72fb5279 100644 --- a/flink-connector-jdbc-core/src/test/java/org/apache/flink/architecture/ProductionCodeArchitectureTest.java +++ b/flink-connector-jdbc-architecture/src/test/java/org/apache/flink/connector/jdbc/architecture/ProductionCodeArchitectureTest.java @@ -16,8 +16,9 @@ * limitations under the License. */ -package org.apache.flink.architecture; +package org.apache.flink.connector.jdbc.architecture; +import org.apache.flink.architecture.ProductionCodeArchitectureBase; import org.apache.flink.architecture.common.ImportOptions; import com.tngtech.archunit.core.importer.ImportOption; diff --git a/flink-connector-jdbc-core/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java b/flink-connector-jdbc-architecture/src/test/java/org/apache/flink/connector/jdbc/architecture/TestCodeArchitectureTest.java similarity index 92% rename from flink-connector-jdbc-core/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java rename to flink-connector-jdbc-architecture/src/test/java/org/apache/flink/connector/jdbc/architecture/TestCodeArchitectureTest.java index a2c75db8d..a011bce59 100644 --- a/flink-connector-jdbc-core/src/test/java/org/apache/flink/architecture/TestCodeArchitectureTest.java +++ b/flink-connector-jdbc-architecture/src/test/java/org/apache/flink/connector/jdbc/architecture/TestCodeArchitectureTest.java @@ -16,8 +16,9 @@ * limitations under the License. */ -package org.apache.flink.architecture; +package org.apache.flink.connector.jdbc.architecture; +import org.apache.flink.architecture.TestCodeArchitectureTestBase; import org.apache.flink.architecture.common.ImportOptions; import com.tngtech.archunit.core.importer.ImportOption; diff --git a/flink-connector-jdbc-core/src/test/resources/archunit.properties b/flink-connector-jdbc-architecture/src/test/resources/archunit.properties similarity index 100% rename from flink-connector-jdbc-core/src/test/resources/archunit.properties rename to flink-connector-jdbc-architecture/src/test/resources/archunit.properties diff --git a/flink-connector-jdbc-core/pom.xml b/flink-connector-jdbc-core/pom.xml index 851c1e07f..5a0a7ef4f 100644 --- a/flink-connector-jdbc-core/pom.xml +++ b/flink-connector-jdbc-core/pom.xml @@ -151,13 +151,6 @@ under the License. test - - - org.apache.flink - flink-architecture-tests-test - test - - org.testcontainers diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSource.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSource.java index c1989d466..d2c055e42 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSource.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSource.java @@ -30,6 +30,7 @@ import org.apache.flink.api.java.typeutils.ResultTypeQueryable; import org.apache.flink.configuration.Configuration; import org.apache.flink.connector.base.DeliveryGuarantee; +import org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings; import org.apache.flink.connector.jdbc.core.datastream.source.enumerator.JdbcSourceEnumStateSerializer; import org.apache.flink.connector.jdbc.core.datastream.source.enumerator.JdbcSourceEnumerator; import org.apache.flink.connector.jdbc.core.datastream.source.enumerator.JdbcSourceEnumeratorState; @@ -40,7 +41,6 @@ import org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplit; import org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplitSerializer; import org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider; -import org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings; import org.apache.flink.core.io.SimpleVersionedSerializer; import org.apache.flink.util.Preconditions; diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilder.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilder.java index 9be29e983..32c0f2b71 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilder.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilder.java @@ -23,13 +23,13 @@ import org.apache.flink.configuration.Configuration; import org.apache.flink.connector.base.DeliveryGuarantee; import org.apache.flink.connector.jdbc.JdbcConnectionOptions; +import org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings; import org.apache.flink.connector.jdbc.core.datastream.source.enumerator.SqlTemplateSplitEnumerator; import org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor; import org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider; import org.apache.flink.connector.jdbc.datasource.connections.SimpleJdbcConnectionProvider; import org.apache.flink.connector.jdbc.split.JdbcParameterValuesProvider; import org.apache.flink.connector.jdbc.split.JdbcSlideTimingParameterProvider; -import org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings; import org.apache.flink.types.Row; import org.apache.flink.util.Preconditions; import org.apache.flink.util.StringUtils; diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumerator.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumerator.java index 57b10d7c6..c545a08f5 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumerator.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumerator.java @@ -22,8 +22,8 @@ import org.apache.flink.api.connector.source.SourceEvent; import org.apache.flink.api.connector.source.SplitEnumerator; import org.apache.flink.api.connector.source.SplitEnumeratorContext; -import org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplit; import org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings; +import org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplit; import org.apache.flink.util.Preconditions; import org.slf4j.Logger; diff --git a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilderTest.java b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilderTest.java index c53bba5e4..9cdc909d3 100644 --- a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilderTest.java +++ b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilderTest.java @@ -20,13 +20,13 @@ import org.apache.flink.api.common.typeinfo.TypeHint; import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings; import org.apache.flink.connector.jdbc.core.datastream.source.enumerator.SqlTemplateSplitEnumerator; import org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor; import org.apache.flink.connector.jdbc.split.JdbcGenericParameterValuesProvider; import org.apache.flink.connector.jdbc.split.JdbcNumericBetweenParametersProvider; import org.apache.flink.connector.jdbc.split.JdbcParameterValuesProvider; import org.apache.flink.connector.jdbc.split.JdbcSlideTimingParameterProvider; -import org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings; import org.apache.flink.types.Row; import org.junit.jupiter.api.Test; diff --git a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceStreamRelatedITCase.java b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceStreamRelatedITCase.java index b70a2de7a..e60c85a3e 100644 --- a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceStreamRelatedITCase.java +++ b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceStreamRelatedITCase.java @@ -27,11 +27,11 @@ import org.apache.flink.client.program.ClusterClient; import org.apache.flink.configuration.Configuration; import org.apache.flink.connector.base.DeliveryGuarantee; +import org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings; import org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor; import org.apache.flink.connector.jdbc.derby.DerbyTestBase; import org.apache.flink.connector.jdbc.split.JdbcSlideTimingParameterProvider; import org.apache.flink.connector.jdbc.testutils.JdbcITCaseBase; -import org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings; import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; import org.apache.flink.streaming.api.functions.KeyedProcessFunction; import org.apache.flink.streaming.api.functions.sink.SinkFunction; diff --git a/flink-connector-jdbc-cratedb/pom.xml b/flink-connector-jdbc-cratedb/pom.xml index f7915a55f..b5dcc06b4 100644 --- a/flink-connector-jdbc-cratedb/pom.xml +++ b/flink-connector-jdbc-cratedb/pom.xml @@ -106,13 +106,6 @@ test - - - org.apache.flink - flink-architecture-tests-test - test - - \ No newline at end of file diff --git a/flink-connector-jdbc-db2/pom.xml b/flink-connector-jdbc-db2/pom.xml index 28d8ef1a2..18f26ce98 100644 --- a/flink-connector-jdbc-db2/pom.xml +++ b/flink-connector-jdbc-db2/pom.xml @@ -91,13 +91,6 @@ test - - - org.apache.flink - flink-architecture-tests-test - test - - \ No newline at end of file diff --git a/flink-connector-jdbc-mysql/pom.xml b/flink-connector-jdbc-mysql/pom.xml index a567366e9..5ac686f73 100644 --- a/flink-connector-jdbc-mysql/pom.xml +++ b/flink-connector-jdbc-mysql/pom.xml @@ -96,13 +96,6 @@ test - - - org.apache.flink - flink-architecture-tests-test - test - - \ No newline at end of file diff --git a/flink-connector-jdbc-oceanbase/pom.xml b/flink-connector-jdbc-oceanbase/pom.xml index 933635ff7..9412027e5 100644 --- a/flink-connector-jdbc-oceanbase/pom.xml +++ b/flink-connector-jdbc-oceanbase/pom.xml @@ -104,14 +104,6 @@ test - - - - org.apache.flink - flink-architecture-tests-test - test - - \ No newline at end of file diff --git a/flink-connector-jdbc-oracle/pom.xml b/flink-connector-jdbc-oracle/pom.xml index a5a5067d9..b8aaf3544 100644 --- a/flink-connector-jdbc-oracle/pom.xml +++ b/flink-connector-jdbc-oracle/pom.xml @@ -89,13 +89,6 @@ test - - - org.apache.flink - flink-architecture-tests-test - test - - \ No newline at end of file diff --git a/flink-connector-jdbc-postgres/pom.xml b/flink-connector-jdbc-postgres/pom.xml index b68440b66..45ef0b976 100644 --- a/flink-connector-jdbc-postgres/pom.xml +++ b/flink-connector-jdbc-postgres/pom.xml @@ -95,13 +95,6 @@ test - - - org.apache.flink - flink-architecture-tests-test - test - - diff --git a/flink-connector-jdbc-postgres/src/main/java/org/apache/flink/connector/jdbc/postgres/database/dialect/CompatiblePostgresDialect.java b/flink-connector-jdbc-postgres/src/main/java/org/apache/flink/connector/jdbc/postgres/database/dialect/CompatiblePostgresDialect.java index 12ebb29c5..fc00a87fc 100644 --- a/flink-connector-jdbc-postgres/src/main/java/org/apache/flink/connector/jdbc/postgres/database/dialect/CompatiblePostgresDialect.java +++ b/flink-connector-jdbc-postgres/src/main/java/org/apache/flink/connector/jdbc/postgres/database/dialect/CompatiblePostgresDialect.java @@ -18,13 +18,13 @@ package org.apache.flink.connector.jdbc.postgres.database.dialect; -import org.apache.flink.annotation.PublicEvolving; +import org.apache.flink.annotation.Internal; import org.apache.flink.table.types.logical.RowType; import java.util.Optional; /** JDBC dialect for PostgreSQL compatible databases. */ -@PublicEvolving +@Internal public abstract class CompatiblePostgresDialect extends PostgresDialect { private static final long serialVersionUID = 1L; diff --git a/flink-connector-jdbc-postgres/src/main/java/org/apache/flink/connector/jdbc/postgres/database/dialect/CompatiblePostgresDialectConverter.java b/flink-connector-jdbc-postgres/src/main/java/org/apache/flink/connector/jdbc/postgres/database/dialect/CompatiblePostgresDialectConverter.java index 9670652a5..f2329dd77 100644 --- a/flink-connector-jdbc-postgres/src/main/java/org/apache/flink/connector/jdbc/postgres/database/dialect/CompatiblePostgresDialectConverter.java +++ b/flink-connector-jdbc-postgres/src/main/java/org/apache/flink/connector/jdbc/postgres/database/dialect/CompatiblePostgresDialectConverter.java @@ -18,11 +18,11 @@ package org.apache.flink.connector.jdbc.postgres.database.dialect; -import org.apache.flink.annotation.PublicEvolving; +import org.apache.flink.annotation.Internal; import org.apache.flink.table.types.logical.RowType; /** JDBC converter for PostgreSQL compatible databases. */ -@PublicEvolving +@Internal public abstract class CompatiblePostgresDialectConverter extends PostgresDialectConverter { private static final long serialVersionUID = 1L; diff --git a/flink-connector-jdbc-sqlserver/pom.xml b/flink-connector-jdbc-sqlserver/pom.xml index 29103af54..e3851254f 100644 --- a/flink-connector-jdbc-sqlserver/pom.xml +++ b/flink-connector-jdbc-sqlserver/pom.xml @@ -90,13 +90,6 @@ test - - - org.apache.flink - flink-architecture-tests-test - test - - \ No newline at end of file diff --git a/flink-connector-jdbc-trino/pom.xml b/flink-connector-jdbc-trino/pom.xml index 24bc8b5ff..f60ef6625 100644 --- a/flink-connector-jdbc-trino/pom.xml +++ b/flink-connector-jdbc-trino/pom.xml @@ -100,13 +100,6 @@ test - - - org.apache.flink - flink-architecture-tests-test - test - - \ No newline at end of file diff --git a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/utils/ContinuousUnBoundingSettings.java b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/utils/ContinuousUnBoundingSettings.java index af88960f6..f25f3d1b9 100644 --- a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/utils/ContinuousUnBoundingSettings.java +++ b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/utils/ContinuousUnBoundingSettings.java @@ -20,23 +20,23 @@ import org.apache.flink.annotation.PublicEvolving; -import java.io.Serializable; import java.time.Duration; -import java.util.Objects; - -import static org.apache.flink.util.Preconditions.checkNotNull; /** * Settings describing how to do continuous file discovery and enumeration for the file source's * continuous discovery and streaming mode. * - * @deprecated Use {@link org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings} + * @deprecated Use {@link + * org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings} */ @PublicEvolving @Deprecated -public final class ContinuousUnBoundingSettings extends org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings { +public final class ContinuousUnBoundingSettings + extends org.apache.flink.connector.jdbc.core.datastream.source.config + .ContinuousUnBoundingSettings { - public ContinuousUnBoundingSettings(Duration initialDiscoveryDelay, Duration discoveryInterval) { + public ContinuousUnBoundingSettings( + Duration initialDiscoveryDelay, Duration discoveryInterval) { super(initialDiscoveryDelay, discoveryInterval); } } diff --git a/pom.xml b/pom.xml index 9c2f6b96e..96bf3a067 100644 --- a/pom.xml +++ b/pom.xml @@ -44,6 +44,7 @@ under the License. flink-connector-jdbc + flink-connector-jdbc-architecture flink-connector-jdbc-core flink-connector-jdbc-cratedb flink-connector-jdbc-db2 @@ -169,18 +170,6 @@ under the License. test - - - org.apache.flink - flink-architecture-tests-test - test - - - org.apache.flink - flink-architecture-tests-production - test - - @@ -217,29 +206,6 @@ under the License. test - - - - org.apache.flink - flink-architecture-tests-base - ${flink.version} - test - - - - org.apache.flink - flink-architecture-tests-test - ${flink.version} - test - - - - org.apache.flink - flink-architecture-tests-production - ${flink.version} - test - - com.google.code.findbugs From ee2f862fc492795a019d14de1c672b16bc2e1382 Mon Sep 17 00:00:00 2001 From: Joao Boto Date: Wed, 28 Aug 2024 22:37:40 +0200 Subject: [PATCH 3/3] [FLINK-36009] Create Precondition and VisibleForTest --- .../f2faddb7-ac11-4947-ac31-59d16e454201 | 199 +----------- .../connector/jdbc/JdbcConnectionOptions.java | 12 +- .../jdbc/JdbcExactlyOnceOptions.java | 4 +- .../connector/jdbc/JdbcExecutionOptions.java | 4 +- .../flink/connector/jdbc/JdbcInputFormat.java | 10 +- .../database/catalog/AbstractJdbcCatalog.java | 12 +- .../database/dialect/AbstractDialect.java | 4 +- .../dialect/AbstractDialectConverter.java | 2 +- .../core/datastream/sink/JdbcSinkBuilder.java | 2 +- .../datastream/sink/writer/JdbcWriter.java | 10 +- .../core/datastream/source/JdbcSource.java | 24 +- .../datastream/source/JdbcSourceBuilder.java | 38 +-- .../config/ContinuousUnBoundingSettings.java | 2 +- .../JdbcSourceEnumStateSerializer.java | 8 +- .../enumerator/JdbcSourceEnumerator.java | 8 +- .../enumerator/JdbcSourceEnumeratorState.java | 8 +- .../SqlTemplateSplitEnumerator.java | 12 +- .../source/reader/JdbcSourceSplitReader.java | 30 +- .../reader/extractor/RowResultExtractor.java | 4 +- .../source/split/JdbcSourceSplit.java | 4 +- .../split/JdbcSourceSplitSerializer.java | 2 +- .../source/split/JdbcSourceSplitState.java | 2 +- .../core/table/JdbcDynamicTableFactory.java | 4 +- .../core/table/sink/JdbcDynamicTableSink.java | 2 +- .../table/sink/JdbcOutputFormatBuilder.java | 4 +- .../table/source/JdbcDynamicTableSource.java | 4 +- .../table/source/JdbcRowDataInputFormat.java | 4 +- .../source/JdbcRowDataLookupFunction.java | 8 +- .../jdbc/core/util/Precondition.java | 290 ++++++++++++++++++ .../jdbc/core/util/VisibleForTest.java | 20 ++ .../SimpleJdbcConnectionProvider.java | 4 +- .../xa/PoolingXaConnectionProvider.java | 2 +- .../xa/SimpleXaConnectionProvider.java | 18 +- .../transactions/xa/XaTransaction.java | 8 +- .../transactions/xa/domain/TransactionId.java | 4 +- .../transactions/xa/xid/XidImpl.java | 6 +- .../internal/GenericJdbcSinkFunction.java | 4 +- .../jdbc/internal/JdbcOutputFormat.java | 6 +- .../jdbc/internal/RowJdbcOutputFormat.java | 2 +- .../internal/TableJdbcUpsertOutputFormat.java | 6 +- .../executor/InsertOrUpdateJdbcExecutor.java | 2 +- .../TableInsertOrUpdateStatementExecutor.java | 2 +- .../TableSimpleStatementExecutor.java | 2 +- .../InternalJdbcConnectionOptions.java | 8 +- .../jdbc/internal/options/JdbcDmlOptions.java | 8 +- .../internal/options/JdbcInsertOptions.java | 4 +- .../CompositeJdbcParameterValuesProvider.java | 4 +- .../JdbcNumericBetweenParametersProvider.java | 12 +- .../JdbcSlideTimingParameterProvider.java | 12 +- .../FieldNamedPreparedStatementImpl.java | 4 +- .../flink/connector/jdbc/utils/JdbcUtils.java | 4 +- .../flink/connector/jdbc/JdbcITCase.java | 2 +- .../jdbc/testutils/tables/TableBase.java | 6 +- .../jdbc/testutils/tables/TableField.java | 6 +- .../database/catalog/CrateDBCatalog.java | 4 +- .../database/catalog/CrateDBTablePath.java | 2 +- .../mysql/database/catalog/MySqlCatalog.java | 12 +- .../jdbc/mysql/testutils/MySqlContainer.java | 2 +- .../database/catalog/OceanBaseCatalog.java | 4 +- .../database/catalog/PostgresCatalog.java | 8 +- .../database/catalog/PostgresTablePath.java | 2 +- .../postgres/testutils/PostgresDatabase.java | 2 +- .../connector/jdbc/catalog/JdbcCatalog.java | 6 +- .../jdbc/catalog/JdbcCatalogUtils.java | 2 +- .../connector/jdbc/sink/JdbcSinkBuilder.java | 2 +- .../connector/jdbc/source/JdbcSource.java | 24 +- .../jdbc/source/JdbcSourceBuilder.java | 38 +-- .../connector/jdbc/xa/CheckpointAndXid.java | 4 +- .../connector/jdbc/xa/JdbcXaSinkFunction.java | 22 +- .../flink/connector/jdbc/xa/XaFacadeImpl.java | 18 +- .../jdbc/xa/XaFacadePoolingImpl.java | 2 +- .../jdbc/xa/JdbcExactlyOnceSinkE2eTest.java | 2 +- .../jdbc/xa/JdbcXaSinkMigrationTest.java | 4 +- .../jdbc/xa/JdbcXaSinkTestHelper.java | 6 +- 74 files changed, 576 insertions(+), 463 deletions(-) create mode 100644 flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/util/Precondition.java create mode 100644 flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/util/VisibleForTest.java diff --git a/flink-connector-jdbc-architecture/archunit-violations/f2faddb7-ac11-4947-ac31-59d16e454201 b/flink-connector-jdbc-architecture/archunit-violations/f2faddb7-ac11-4947-ac31-59d16e454201 index 891af17c0..a3e266e28 100644 --- a/flink-connector-jdbc-architecture/archunit-violations/f2faddb7-ac11-4947-ac31-59d16e454201 +++ b/flink-connector-jdbc-architecture/archunit-violations/f2faddb7-ac11-4947-ac31-59d16e454201 @@ -1,128 +1,15 @@ Class extends class in (AbstractJdbcCatalog.java:0) Class extends class in (JdbcFilterPushdownPreparedStatementVisitor.java:0) -Constructor (java.lang.String, java.lang.String, int, java.util.Properties)> calls method in (JdbcConnectionOptions.java:50) -Constructor (java.lang.String, java.lang.String, int, java.util.Properties)> calls method in (JdbcConnectionOptions.java:53) -Constructor (java.lang.String, java.lang.String, int, java.util.Properties)> calls method in (JdbcConnectionOptions.java:57) -Constructor (boolean, int, boolean, java.util.Optional, boolean)> calls method in (JdbcExactlyOnceOptions.java:75) -Constructor (long, int, int)> calls method in (JdbcExecutionOptions.java:38) Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)> calls constructor (java.lang.String, java.lang.String)> in (AbstractJdbcCatalog.java:123) -Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)> calls method in (AbstractJdbcCatalog.java:126) -Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)> calls method in (AbstractJdbcCatalog.java:134) -Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)> calls method in (AbstractJdbcCatalog.java:136) -Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)> calls method in (AbstractJdbcCatalog.java:125) -Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)> calls method in (AbstractJdbcCatalog.java:133) -Constructor (org.apache.flink.table.types.logical.RowType)> calls method in (AbstractDialectConverter.java:60) -Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions, org.apache.flink.connector.jdbc.datasource.statements.JdbcQueryStatement, org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer, org.apache.flink.connector.base.DeliveryGuarantee, java.util.Collection, org.apache.flink.api.connector.sink2.Sink$InitContext)> calls method in (JdbcWriter.java:95) -Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions, org.apache.flink.connector.jdbc.datasource.statements.JdbcQueryStatement, org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer, org.apache.flink.connector.base.DeliveryGuarantee, java.util.Collection, org.apache.flink.api.connector.sink2.Sink$InitContext)> calls method in (JdbcWriter.java:100) -Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions, org.apache.flink.connector.jdbc.datasource.statements.JdbcQueryStatement, org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer, org.apache.flink.connector.base.DeliveryGuarantee, java.util.Collection, org.apache.flink.api.connector.sink2.Sink$InitContext)> calls method in (JdbcWriter.java:101) -Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions, org.apache.flink.connector.jdbc.datasource.statements.JdbcQueryStatement, org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer, org.apache.flink.connector.base.DeliveryGuarantee, java.util.Collection, org.apache.flink.api.connector.sink2.Sink$InitContext)> calls method in (JdbcWriter.java:122) -Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions, org.apache.flink.connector.jdbc.datasource.statements.JdbcQueryStatement, org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer, org.apache.flink.connector.base.DeliveryGuarantee, java.util.Collection, org.apache.flink.api.connector.sink2.Sink$InitContext)> calls method in (JdbcWriter.java:123) -Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions, org.apache.flink.connector.jdbc.datasource.statements.JdbcQueryStatement, org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer, org.apache.flink.connector.base.DeliveryGuarantee, java.util.Collection, org.apache.flink.api.connector.sink2.Sink$InitContext)> calls method in (JdbcWriter.java:82) -Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions, org.apache.flink.connector.jdbc.datasource.statements.JdbcQueryStatement, org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer, org.apache.flink.connector.base.DeliveryGuarantee, java.util.Collection, org.apache.flink.api.connector.sink2.Sink$InitContext)> calls method in (JdbcWriter.java:84) -Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions, org.apache.flink.connector.jdbc.datasource.statements.JdbcQueryStatement, org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer, org.apache.flink.connector.base.DeliveryGuarantee, java.util.Collection, org.apache.flink.api.connector.sink2.Sink$InitContext)> calls method in (JdbcWriter.java:92) -Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions, org.apache.flink.connector.jdbc.datasource.statements.JdbcQueryStatement, org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer, org.apache.flink.connector.base.DeliveryGuarantee, java.util.Collection, org.apache.flink.api.connector.sink2.Sink$InitContext)> calls method in (JdbcWriter.java:102) -Constructor (org.apache.flink.configuration.Configuration, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.core.datastream.source.enumerator.JdbcSqlSplitEnumeratorBase$Provider, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings)> calls method in (JdbcSource.java:78) -Constructor (org.apache.flink.configuration.Configuration, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.core.datastream.source.enumerator.JdbcSqlSplitEnumeratorBase$Provider, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings)> calls method in (JdbcSource.java:79) -Constructor (org.apache.flink.configuration.Configuration, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.core.datastream.source.enumerator.JdbcSqlSplitEnumeratorBase$Provider, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings)> calls method in (JdbcSource.java:80) -Constructor (org.apache.flink.configuration.Configuration, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.core.datastream.source.enumerator.JdbcSqlSplitEnumeratorBase$Provider, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings)> calls method in (JdbcSource.java:81) -Constructor (org.apache.flink.configuration.Configuration, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.core.datastream.source.enumerator.JdbcSqlSplitEnumeratorBase$Provider, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings)> calls method in (JdbcSource.java:84) -Constructor (java.time.Duration, java.time.Duration)> calls method in (ContinuousUnBoundingSettings.java:44) -Constructor (org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplitSerializer)> calls method in (JdbcSourceEnumStateSerializer.java:47) -Constructor (org.apache.flink.api.connector.source.SplitEnumeratorContext, org.apache.flink.connector.jdbc.core.datastream.source.enumerator.JdbcSqlSplitEnumeratorBase, org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings, java.util.List)> calls method in (JdbcSourceEnumerator.java:61) -Constructor (org.apache.flink.api.connector.source.SplitEnumeratorContext, org.apache.flink.connector.jdbc.core.datastream.source.enumerator.JdbcSqlSplitEnumeratorBase, org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings, java.util.List)> calls method in (JdbcSourceEnumerator.java:62) -Constructor (org.apache.flink.api.connector.source.SplitEnumeratorContext, org.apache.flink.connector.jdbc.core.datastream.source.enumerator.JdbcSqlSplitEnumeratorBase, org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings, java.util.List)> calls method in (JdbcSourceEnumerator.java:68) -Constructor (java.util.List, java.util.List, java.util.List, java.io.Serializable)> calls method in (JdbcSourceEnumeratorState.java:47) -Constructor (java.util.List, java.util.List, java.util.List, java.io.Serializable)> calls method in (JdbcSourceEnumeratorState.java:48) -Constructor (java.util.List, java.util.List, java.util.List, java.io.Serializable)> calls method in (JdbcSourceEnumeratorState.java:49) -Constructor (java.io.Serializable, java.lang.String, org.apache.flink.connector.jdbc.split.JdbcParameterValuesProvider)> calls method in (SqlTemplateSplitEnumerator.java:54) -Constructor (org.apache.flink.api.connector.source.SourceReaderContext, org.apache.flink.configuration.Configuration, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor)> calls method in (JdbcSourceSplitReader.java:117) -Constructor (org.apache.flink.api.connector.source.SourceReaderContext, org.apache.flink.configuration.Configuration, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor)> calls method in (JdbcSourceSplitReader.java:104) -Constructor (org.apache.flink.api.connector.source.SourceReaderContext, org.apache.flink.configuration.Configuration, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor)> calls method in (JdbcSourceSplitReader.java:105) -Constructor (org.apache.flink.api.connector.source.SourceReaderContext, org.apache.flink.configuration.Configuration, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor)> calls method in (JdbcSourceSplitReader.java:106) -Constructor (org.apache.flink.api.connector.source.SourceReaderContext, org.apache.flink.configuration.Configuration, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor)> calls method in (JdbcSourceSplitReader.java:107) -Constructor (org.apache.flink.api.connector.source.SourceReaderContext, org.apache.flink.configuration.Configuration, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor)> calls method in (JdbcSourceSplitReader.java:112) -Constructor (org.apache.flink.api.connector.source.SourceReaderContext, org.apache.flink.configuration.Configuration, org.apache.flink.api.common.typeinfo.TypeInformation, org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.base.DeliveryGuarantee, org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor)> calls method in (JdbcSourceSplitReader.java:120) -Constructor (org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplit)> calls method in (JdbcSourceSplitState.java:38) Constructor (java.util.function.Function)> calls constructor ()> in (JdbcFilterPushdownPreparedStatementVisitor.java:52) -Constructor (org.apache.flink.connector.jdbc.internal.options.InternalJdbcConnectionOptions, int, [Ljava.lang.String;, [Lorg.apache.flink.table.types.DataType;, [Ljava.lang.String;, org.apache.flink.table.types.logical.RowType, java.util.List, [Ljava.io.Serializable;)> calls method in (JdbcRowDataLookupFunction.java:95) -Constructor (org.apache.flink.connector.jdbc.internal.options.InternalJdbcConnectionOptions, int, [Ljava.lang.String;, [Lorg.apache.flink.table.types.DataType;, [Ljava.lang.String;, org.apache.flink.table.types.logical.RowType, java.util.List, [Ljava.io.Serializable;)> calls method in (JdbcRowDataLookupFunction.java:82) -Constructor (org.apache.flink.connector.jdbc.internal.options.InternalJdbcConnectionOptions, int, [Ljava.lang.String;, [Lorg.apache.flink.table.types.DataType;, [Ljava.lang.String;, org.apache.flink.table.types.logical.RowType, java.util.List, [Ljava.io.Serializable;)> calls method in (JdbcRowDataLookupFunction.java:83) -Constructor (org.apache.flink.connector.jdbc.internal.options.InternalJdbcConnectionOptions, int, [Ljava.lang.String;, [Lorg.apache.flink.table.types.DataType;, [Ljava.lang.String;, org.apache.flink.table.types.logical.RowType, java.util.List, [Ljava.io.Serializable;)> calls method in (JdbcRowDataLookupFunction.java:84) -Constructor (org.apache.flink.connector.jdbc.internal.options.InternalJdbcConnectionOptions, int, [Ljava.lang.String;, [Lorg.apache.flink.table.types.DataType;, [Ljava.lang.String;, org.apache.flink.table.types.logical.RowType, java.util.List, [Ljava.io.Serializable;)> calls method in (JdbcRowDataLookupFunction.java:85) -Constructor (org.apache.flink.connector.jdbc.internal.options.InternalJdbcConnectionOptions, int, [Ljava.lang.String;, [Lorg.apache.flink.table.types.DataType;, [Ljava.lang.String;, org.apache.flink.table.types.logical.RowType, java.util.List, [Ljava.io.Serializable;)> calls method in (JdbcRowDataLookupFunction.java:86) -Constructor (org.apache.flink.connector.jdbc.internal.options.InternalJdbcConnectionOptions, int, [Ljava.lang.String;, [Lorg.apache.flink.table.types.DataType;, [Ljava.lang.String;, org.apache.flink.table.types.logical.RowType, java.util.List, [Ljava.io.Serializable;)> calls method in (JdbcRowDataLookupFunction.java:87) Constructor (org.apache.flink.connector.jdbc.internal.options.InternalJdbcConnectionOptions, int, [Ljava.lang.String;, [Lorg.apache.flink.table.types.DataType;, [Ljava.lang.String;, org.apache.flink.table.types.logical.RowType, java.util.List, [Ljava.io.Serializable;)> has parameter of type <[Lorg.apache.flink.table.types.DataType;> in (JdbcRowDataLookupFunction.java:0) -Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)> is annotated with in (CrateDBCatalog.java:0) -Constructor (java.util.function.Supplier, java.lang.Integer)> calls method in (SimpleXaConnectionProvider.java:81) -Constructor (int, [B, [B)> calls method in (XidImpl.java:46) -Constructor (int, [B, [B)> calls method in (XidImpl.java:47) -Constructor (org.apache.flink.connector.jdbc.internal.JdbcOutputFormat)> calls method in (GenericJdbcSinkFunction.java:44) -Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.internal.JdbcOutputFormat$StatementExecutorFactory)> calls method in (JdbcOutputFormat.java:87) -Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.internal.JdbcOutputFormat$StatementExecutorFactory)> calls method in (JdbcOutputFormat.java:88) -Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.internal.JdbcOutputFormat$StatementExecutorFactory)> calls method in (JdbcOutputFormat.java:89) -Constructor (org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider, org.apache.flink.connector.jdbc.JdbcExecutionOptions, org.apache.flink.connector.jdbc.internal.JdbcOutputFormat$StatementExecutorFactory, org.apache.flink.connector.jdbc.internal.JdbcOutputFormat$StatementExecutorFactory)> is annotated with in (TableJdbcUpsertOutputFormat.java:0) -Constructor (java.lang.String, java.lang.String, java.lang.String, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, java.util.function.Function, java.util.function.Function)> calls method in (InsertOrUpdateJdbcExecutor.java:76) -Constructor (java.lang.String, java.lang.String, java.lang.String, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, java.util.function.Function, java.util.function.Function)> calls method in (InsertOrUpdateJdbcExecutor.java:77) -Constructor (java.lang.String, java.lang.String, java.lang.String, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, java.util.function.Function, java.util.function.Function)> calls method in (InsertOrUpdateJdbcExecutor.java:78) -Constructor (java.lang.String, java.lang.String, java.lang.String, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, java.util.function.Function, java.util.function.Function)> calls method in (InsertOrUpdateJdbcExecutor.java:79) -Constructor (java.lang.String, java.lang.String, java.lang.String, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, java.util.function.Function, java.util.function.Function)> calls method in (InsertOrUpdateJdbcExecutor.java:80) -Constructor (java.lang.String, java.lang.String, java.lang.String, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, java.util.function.Function, java.util.function.Function)> calls method in (InsertOrUpdateJdbcExecutor.java:81) -Constructor (java.lang.String, java.lang.String, java.lang.String, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, java.util.function.Function, java.util.function.Function)> calls method in (InsertOrUpdateJdbcExecutor.java:82) -Constructor (java.lang.String, java.lang.String, java.lang.String, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, org.apache.flink.connector.jdbc.JdbcStatementBuilder, java.util.function.Function, java.util.function.Function)> calls method in (InsertOrUpdateJdbcExecutor.java:83) -Constructor (org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, java.util.function.Function)> calls method in (TableInsertOrUpdateStatementExecutor.java:64) -Constructor (org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, java.util.function.Function)> calls method in (TableInsertOrUpdateStatementExecutor.java:65) -Constructor (org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, java.util.function.Function)> calls method in (TableInsertOrUpdateStatementExecutor.java:66) -Constructor (org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, java.util.function.Function)> calls method in (TableInsertOrUpdateStatementExecutor.java:67) -Constructor (org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, java.util.function.Function)> calls method in (TableInsertOrUpdateStatementExecutor.java:68) -Constructor (org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter, java.util.function.Function)> calls method in (TableInsertOrUpdateStatementExecutor.java:69) -Constructor (org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter)> calls method in (TableSimpleStatementExecutor.java:48) -Constructor (org.apache.flink.connector.jdbc.statement.StatementFactory, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter)> calls method in (TableSimpleStatementExecutor.java:49) -Constructor (java.lang.String, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialect, [Ljava.lang.String;, [I, [Ljava.lang.String;)> calls method in (JdbcDmlOptions.java:51) -Constructor (java.lang.String, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialect, [Ljava.lang.String;, [I, [Ljava.lang.String;)> calls method in (JdbcDmlOptions.java:52) -Constructor (java.lang.String, org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialect, [Ljava.lang.String;, [I, [Ljava.lang.String;)> calls method in (JdbcDmlOptions.java:53) -Constructor (java.lang.String, [I)> calls method in (JdbcInsertOptions.java:33) -Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)> is annotated with in (MySqlCatalog.java:0) -Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)> calls method in (MySqlCatalog.java:92) -Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)> calls method in (MySqlCatalog.java:94) -Constructor (java.lang.ClassLoader, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)> is annotated with in (PostgresCatalog.java:0) -Constructor (java.lang.String, java.lang.String)> calls method in (PostgresTablePath.java:41) -Constructor (java.lang.String, java.lang.String)> calls method in (PostgresTablePath.java:44) -Constructor (org.apache.flink.connector.jdbc.split.JdbcParameterValuesProvider, org.apache.flink.connector.jdbc.split.JdbcParameterValuesProvider)> calls method in (CompositeJdbcParameterValuesProvider.java:34) -Constructor (long, long)> calls method in (JdbcNumericBetweenParametersProvider.java:55) -Constructor (long, long, long)> calls method in (JdbcNumericBetweenParametersProvider.java:68) -Constructor (java.lang.Long, long, long, long)> calls method in (JdbcSlideTimingParameterProvider.java:46) -Constructor (java.lang.Long, long, long, long)> calls method in (JdbcSlideTimingParameterProvider.java:49) -Constructor (java.lang.Long, long, long, long)> calls method in (JdbcSlideTimingParameterProvider.java:53) -Constructor (java.lang.Long, long, long, long)> calls method in (JdbcSlideTimingParameterProvider.java:45) Field has type <[Lorg.apache.flink.table.types.logical.LogicalType;> in (AbstractDialectConverter.java:0) Field has type <[Lorg.apache.flink.table.types.DataType;> in (JdbcOutputFormatBuilder.java:0) Interface extends interface in (JdbcStatementBuilder.java:0) -Method calls method in (JdbcConnectionOptions.java:116) -Method calls method in (JdbcConnectionOptions.java:117) -Method calls method in (JdbcInputFormat.java:407) -Method calls method in (AbstractJdbcCatalog.java:227) Method calls constructor (java.util.Map, java.lang.String)> in (AbstractJdbcCatalog.java:258) -Method calls method in (AbstractJdbcCatalog.java:254) -Method calls method in (AbstractJdbcCatalog.java:200) -Method calls method in (AbstractJdbcCatalog.java:586) -Method calls method in (AbstractDialect.java:256) -Method calls method in (JdbcSinkBuilder.java:111) -Method calls method in (JdbcSinkBuilder.java:112) -Method calls method in (JdbcSinkBuilder.java:113) -Method calls method in (JdbcSinkBuilder.java:114) -Method calls method in (JdbcSinkBuilder.java:115) -Method calls method in (JdbcSinkBuilder.java:67) -Method calls method in (JdbcSinkBuilder.java:73) -Method calls method in (JdbcSinkBuilder.java:78) -Method calls method in (JdbcSinkBuilder.java:101) -Method calls method in (JdbcSinkBuilder.java:102) -Method calls method in (JdbcSinkBuilder.java:85) -Method calls method in (JdbcSinkBuilder.java:86) -Method calls method in (JdbcSinkBuilder.java:51) Method calls constructor ([B)> in (JdbcCommitableSerializer.java:34) Method calls constructor (int)> in (JdbcCommitableSerializer.java:27) Method calls method in (JdbcCommitableSerializer.java:29) -Method calls method in (JdbcWriter.java:192) Method calls constructor ([B)> in (JdbcWriterStateSerializer.java:48) Method calls method in (JdbcWriterStateSerializer.java:62) Method calls method in (JdbcWriterStateSerializer.java:70) @@ -139,50 +26,12 @@ Method calls method in (JdbcWriterStateSerializer.java:39) Method calls method in (JdbcWriterStateSerializer.java:30) Method calls method in (JdbcWriterStateSerializer.java:36) -Method is annotated with in (JdbcSource.java:0) -Method is annotated with in (JdbcSource.java:0) -Method is annotated with in (JdbcSource.java:0) -Method is annotated with in (JdbcSource.java:0) -Method is annotated with in (JdbcSource.java:0) -Method calls method in (JdbcSourceBuilder.java:295) -Method calls method in (JdbcSourceBuilder.java:304) -Method calls method in (JdbcSourceBuilder.java:276) -Method calls method in (JdbcSourceBuilder.java:291) -Method calls method in (JdbcSourceBuilder.java:292) -Method calls method in (JdbcSourceBuilder.java:289) -Method calls method in (JdbcSourceBuilder.java:218) -Method calls method in (JdbcSourceBuilder.java:219) -Method calls method in (JdbcSourceBuilder.java:259) -Method calls method in (JdbcSourceBuilder.java:169) -Method calls method in (JdbcSourceBuilder.java:207) -Method calls method in (JdbcSourceBuilder.java:161) -Method calls method in (JdbcSourceBuilder.java:202) -Method calls method in (JdbcSourceBuilder.java:145) -Method calls method in (JdbcSourceBuilder.java:249) -Method calls method in (JdbcSourceBuilder.java:225) -Method calls method in (JdbcSourceBuilder.java:136) -Method calls method in (JdbcSourceBuilder.java:178) Method calls method in (JdbcSourceEnumStateSerializer.java:110) Method calls method in (JdbcSourceEnumStateSerializer.java:70) -Method calls method in (JdbcSourceEnumStateSerializer.java:58) -Method calls method in (JdbcSourceEnumStateSerializer.java:86) -Method calls method in (SqlTemplateSplitEnumerator.java:118) -Method is annotated with in (SqlTemplateSplitEnumerator.java:0) -Method is annotated with in (SqlTemplateSplitEnumerator.java:0) -Method calls method in (JdbcSourceSplitReader.java:138) -Method calls method in (JdbcSourceSplitReader.java:165) -Method is annotated with in (JdbcSourceSplitReader.java:0) -Method is annotated with in (JdbcSourceSplitReader.java:0) -Method is annotated with in (JdbcSourceSplitReader.java:0) -Method is annotated with in (JdbcSourceSplitReader.java:0) -Method calls method in (RowResultExtractor.java:33) -Method calls method in (JdbcSourceSplit.java:71) Method calls method in (JdbcSourceSplitSerializer.java:105) Method calls method in (JdbcSourceSplitSerializer.java:98) -Method calls method in (JdbcSourceSplitSerializer.java:46) Method calls method in (JdbcSourceSplitSerializer.java:80) Method calls method in (JdbcSourceSplitSerializer.java:85) -Method calls method in (JdbcDynamicTableFactory.java:353) Method has parameter of type <[Lorg.apache.flink.configuration.ConfigOption;> in (JdbcDynamicTableFactory.java:0) Method gets field in (JdbcDynamicTableFactory.java:129) Method calls method in (JdbcDynamicTableFactory.java:218) @@ -195,11 +44,6 @@ Method gets field in (JdbcDynamicTableFactory.java:261) Method gets field in (JdbcDynamicTableFactory.java:262) Method calls method in (JdbcDynamicTableSink.java:84) -Method calls method in (JdbcDynamicTableSink.java:69) -Method calls method in (JdbcOutputFormatBuilder.java:81) -Method calls method in (JdbcOutputFormatBuilder.java:82) -Method calls method in (JdbcOutputFormatBuilder.java:83) -Method calls method in (JdbcOutputFormatBuilder.java:116) Method has parameter of type <[Lorg.apache.flink.table.types.logical.LogicalType;> in (JdbcOutputFormatBuilder.java:0) Method has parameter of type <[Lorg.apache.flink.table.types.logical.LogicalType;> in (JdbcOutputFormatBuilder.java:0) Method has parameter of type <[Lorg.apache.flink.table.types.logical.LogicalType;> in (JdbcOutputFormatBuilder.java:0) @@ -209,28 +53,11 @@ Method has parameter of type <[Lorg.apache.flink.table.types.logical.LogicalType;> in (JdbcOutputFormatBuilder.java:0) Method has parameter of type <[Lorg.apache.flink.table.data.RowData$FieldGetter;> in (JdbcOutputFormatBuilder.java:0) Method has parameter of type <[Lorg.apache.flink.table.types.DataType;> in (JdbcOutputFormatBuilder.java:0) -Method calls method in (JdbcDynamicTableSource.java:101) -Method calls method in (JdbcRowDataInputFormat.java:356) Method has return type <[Lorg.apache.flink.core.io.InputSplit;> in (JdbcRowDataInputFormat.java:0) Method calls constructor ([Lorg.apache.flink.core.io.InputSplit;)> in (JdbcRowDataInputFormat.java:287) Method has parameter of type <[Lorg.apache.flink.core.io.InputSplit;> in (JdbcRowDataInputFormat.java:0) -Method is annotated with in (JdbcRowDataLookupFunction.java:0) -Method calls method in (CrateDBTablePath.java:43) -Method calls method in (SimpleJdbcConnectionProvider.java:87) -Method calls method in (PoolingXaConnectionProvider.java:109) -Method calls method in (PoolingXaConnectionProvider.java:79) Method calls method in (PoolingXaConnectionProvider.java:202) -Method calls method in (PoolingXaConnectionProvider.java:91) -Method calls method in (SimpleXaConnectionProvider.java:261) -Method is annotated with in (SimpleXaConnectionProvider.java:0) -Method calls method in (SimpleXaConnectionProvider.java:128) -Method calls method in (SimpleXaConnectionProvider.java:101) -Method calls method in (SimpleXaConnectionProvider.java:87) -Method calls method in (SimpleXaConnectionProvider.java:246) -Method calls method in (XaTransaction.java:121) -Method calls method in (XaTransaction.java:122) Method calls method in (XaTransaction.java:135) -Method calls method in (XaTransaction.java:130) Method calls method in (XaTransaction.java:86) Method calls method in (XaTransaction.java:151) Method calls constructor ([B)> in (TransactionId.java:96) @@ -247,7 +74,6 @@ Method calls method in (TransactionId.java:175) Method calls method in (TransactionId.java:173) Method calls method in (TransactionId.java:174) -Method calls method in (TransactionId.java:169) Method calls constructor (int)> in (TransactionId.java:158) Method calls method in (TransactionId.java:161) Method calls method in (TransactionId.java:159) @@ -261,28 +87,5 @@ Method calls method in (TransactionId.java:186) Method calls method in (TransactionId.java:188) Method calls method in (TransactionId.java:187) -Method is annotated with in (JdbcOutputFormat.java:0) Method calls constructor (java.lang.String)> in (JdbcOutputFormat.java:103) -Method calls method in (JdbcOutputFormat.java:94) -Method calls method in (RowJdbcOutputFormat.java:132) -Method calls method in (TableJdbcUpsertOutputFormat.java:152) -Method calls method in (InternalJdbcConnectionOptions.java:202) -Method calls method in (InternalJdbcConnectionOptions.java:203) -Method calls method in (InternalJdbcConnectionOptions.java:195) -Method calls method in (InternalJdbcConnectionOptions.java:196) -Method calls method in (MySqlCatalog.java:114) -Method calls method in (OceanBaseCatalog.java:108) -Method calls method in (PostgresCatalog.java:184) -Method calls method in (PostgresTablePath.java:56) -Method calls method in (PostgresDialectConverter.java:77) -Method calls method in (JdbcNumericBetweenParametersProvider.java:100) -Method calls method in (JdbcNumericBetweenParametersProvider.java:87) -Method calls method in (JdbcNumericBetweenParametersProvider.java:75) -Method calls method in (JdbcSlideTimingParameterProvider.java:76) -Method calls method in (FieldNamedPreparedStatementImpl.java:247) -Method calls method in (FieldNamedPreparedStatementImpl.java:202) -Method calls method in (FieldNamedPreparedStatementImpl.java:212) -Method calls method in (FieldNamedPreparedStatementImpl.java:187) -Method calls method in (FieldNamedPreparedStatementImpl.java:188) -Method calls method in (FieldNamedPreparedStatementImpl.java:189) -Method calls method in (JdbcUtils.java:49) \ No newline at end of file +Method calls method in (PostgresDialectConverter.java:77) \ No newline at end of file diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/JdbcConnectionOptions.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/JdbcConnectionOptions.java index 06a352db8..3856033a9 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/JdbcConnectionOptions.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/JdbcConnectionOptions.java @@ -18,7 +18,7 @@ package org.apache.flink.connector.jdbc; import org.apache.flink.annotation.PublicEvolving; -import org.apache.flink.util.Preconditions; +import org.apache.flink.connector.jdbc.core.util.Precondition; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -47,14 +47,14 @@ protected JdbcConnectionOptions( @Nullable String driverName, int connectionCheckTimeoutSeconds, @Nonnull Properties properties) { - Preconditions.checkArgument( + Precondition.checkArgument( connectionCheckTimeoutSeconds > 0, "Connection check timeout seconds shouldn't be smaller than 1"); - this.url = Preconditions.checkNotNull(url, "jdbc url is empty"); + this.url = Precondition.checkNotNull(url, "jdbc url is empty"); this.driverName = driverName; this.connectionCheckTimeoutSeconds = connectionCheckTimeoutSeconds; this.properties = - Preconditions.checkNotNull(properties, "Connection properties must be non-null"); + Precondition.checkNotNull(properties, "Connection properties must be non-null"); } public String getDbURL() { @@ -113,8 +113,8 @@ public JdbcConnectionOptionsBuilder withDriverName(String driverName) { } public JdbcConnectionOptionsBuilder withProperty(String propKey, String propVal) { - Preconditions.checkNotNull(propKey, "Connection property key mustn't be null"); - Preconditions.checkNotNull(propVal, "Connection property value mustn't be null"); + Precondition.checkNotNull(propKey, "Connection property key mustn't be null"); + Precondition.checkNotNull(propVal, "Connection property value mustn't be null"); this.properties.put(propKey, propVal); return this; } diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/JdbcExactlyOnceOptions.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/JdbcExactlyOnceOptions.java index 47332d450..04c9ed91c 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/JdbcExactlyOnceOptions.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/JdbcExactlyOnceOptions.java @@ -18,7 +18,7 @@ package org.apache.flink.connector.jdbc; import org.apache.flink.annotation.PublicEvolving; -import org.apache.flink.util.Preconditions; +import org.apache.flink.connector.jdbc.core.util.Precondition; import java.io.Serializable; import java.util.Optional; @@ -72,7 +72,7 @@ private JdbcExactlyOnceOptions( this.allowOutOfOrderCommits = allowOutOfOrderCommits; this.timeoutSec = timeoutSec.orElse(null); this.transactionPerConnection = transactionPerConnection; - Preconditions.checkArgument(this.maxCommitAttempts > 0, "maxCommitAttempts should be > 0"); + Precondition.checkArgument(this.maxCommitAttempts > 0, "maxCommitAttempts should be > 0"); } public static JdbcExactlyOnceOptions defaults() { diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/JdbcExecutionOptions.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/JdbcExecutionOptions.java index c19677b07..62471de20 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/JdbcExecutionOptions.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/JdbcExecutionOptions.java @@ -18,7 +18,7 @@ package org.apache.flink.connector.jdbc; import org.apache.flink.annotation.PublicEvolving; -import org.apache.flink.util.Preconditions; +import org.apache.flink.connector.jdbc.core.util.Precondition; import java.io.Serializable; import java.util.Objects; @@ -35,7 +35,7 @@ public class JdbcExecutionOptions implements Serializable { private final int maxRetries; private JdbcExecutionOptions(long batchIntervalMs, int batchSize, int maxRetries) { - Preconditions.checkArgument(maxRetries >= 0); + Precondition.checkArgument(maxRetries >= 0); this.batchIntervalMs = batchIntervalMs; this.batchSize = batchSize; this.maxRetries = maxRetries; diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/JdbcInputFormat.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/JdbcInputFormat.java index dacf3c6c6..d9515daa9 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/JdbcInputFormat.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/JdbcInputFormat.java @@ -19,7 +19,6 @@ package org.apache.flink.connector.jdbc; import org.apache.flink.annotation.Experimental; -import org.apache.flink.annotation.VisibleForTesting; import org.apache.flink.api.common.io.DefaultInputSplitAssigner; import org.apache.flink.api.common.io.InputFormat; import org.apache.flink.api.common.io.RichInputFormat; @@ -29,6 +28,8 @@ import org.apache.flink.configuration.Configuration; import org.apache.flink.connector.jdbc.core.datastream.source.JdbcSource; import org.apache.flink.connector.jdbc.core.datastream.source.JdbcSourceBuilder; +import org.apache.flink.connector.jdbc.core.util.Precondition; +import org.apache.flink.connector.jdbc.core.util.VisibleForTest; import org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider; import org.apache.flink.connector.jdbc.datasource.connections.SimpleJdbcConnectionProvider; import org.apache.flink.connector.jdbc.split.JdbcParameterValuesProvider; @@ -36,7 +37,6 @@ import org.apache.flink.core.io.InputSplit; import org.apache.flink.core.io.InputSplitAssigner; import org.apache.flink.types.Row; -import org.apache.flink.util.Preconditions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -325,12 +325,12 @@ public InputSplitAssigner getInputSplitAssigner(InputSplit[] inputSplits) { return new DefaultInputSplitAssigner(inputSplits); } - @VisibleForTesting + @VisibleForTest protected PreparedStatement getStatement() { return statement; } - @VisibleForTesting + @VisibleForTest protected Connection getDbConn() { return connectionProvider.getConnection(); } @@ -404,7 +404,7 @@ public JdbcInputFormatBuilder setRowTypeInfo(RowTypeInfo rowTypeInfo) { } public JdbcInputFormatBuilder setFetchSize(int fetchSize) { - Preconditions.checkArgument( + Precondition.checkArgument( fetchSize == Integer.MIN_VALUE || fetchSize > 0, "Illegal value %s for fetchSize, has to be positive or Integer.MIN_VALUE.", fetchSize); diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/database/catalog/AbstractJdbcCatalog.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/database/catalog/AbstractJdbcCatalog.java index 734245985..8ca0ed5d7 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/database/catalog/AbstractJdbcCatalog.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/database/catalog/AbstractJdbcCatalog.java @@ -20,6 +20,7 @@ import org.apache.flink.annotation.PublicEvolving; import org.apache.flink.connector.jdbc.core.table.JdbcDynamicTableFactory; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.table.api.Schema; import org.apache.flink.table.api.ValidationException; import org.apache.flink.table.catalog.AbstractCatalog; @@ -50,7 +51,6 @@ import org.apache.flink.table.expressions.Expression; import org.apache.flink.table.factories.Factory; import org.apache.flink.table.types.DataType; -import org.apache.flink.util.Preconditions; import org.apache.flink.util.StringUtils; import org.apache.flink.util.TemporaryClassLoaderContext; @@ -83,9 +83,9 @@ import static org.apache.flink.connector.jdbc.core.table.JdbcConnectorOptions.URL; import static org.apache.flink.connector.jdbc.core.table.JdbcConnectorOptions.USERNAME; import static org.apache.flink.connector.jdbc.core.table.JdbcDynamicTableFactory.IDENTIFIER; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkArgument; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkNotNull; import static org.apache.flink.table.factories.FactoryUtil.CONNECTOR; -import static org.apache.flink.util.Preconditions.checkArgument; -import static org.apache.flink.util.Preconditions.checkNotNull; /** Abstract catalog for any JDBC catalogs. */ @PublicEvolving @@ -130,7 +130,7 @@ public AbstractJdbcCatalog( this.userClassLoader = userClassLoader; this.baseUrl = baseUrl.endsWith("/") ? baseUrl : baseUrl + "/"; this.defaultUrl = getDatabaseUrl(defaultDatabase); - this.connectionProperties = Preconditions.checkNotNull(connectionProperties); + this.connectionProperties = Precondition.checkNotNull(connectionProperties); checkArgument( !StringUtils.isNullOrWhitespaceOnly(connectionProperties.getProperty(USER_KEY))); checkArgument( @@ -197,7 +197,7 @@ protected Optional getPrimaryKey( String columnName = rs.getString("COLUMN_NAME"); pkName = rs.getString("PK_NAME"); // all the PK_NAME should be the same int keySeq = rs.getInt("KEY_SEQ"); - Preconditions.checkState( + Precondition.checkState( !keySeqColumnName.containsKey(keySeq - 1), "The field(s) of primary key must be from the same table."); keySeqColumnName.put(keySeq - 1, columnName); // KEY_SEQ is 1-based index @@ -251,7 +251,7 @@ public void alterDatabase(String name, CatalogDatabase newDatabase, boolean igno public CatalogDatabase getDatabase(String databaseName) throws DatabaseNotExistException, CatalogException { - Preconditions.checkState( + Precondition.checkState( !StringUtils.isNullOrWhitespaceOnly(databaseName), "Database name must not be blank."); if (listDatabases().contains(databaseName)) { diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/database/dialect/AbstractDialect.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/database/dialect/AbstractDialect.java index bae568956..01430c9c5 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/database/dialect/AbstractDialect.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/database/dialect/AbstractDialect.java @@ -19,13 +19,13 @@ package org.apache.flink.connector.jdbc.core.database.dialect; import org.apache.flink.annotation.PublicEvolving; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.table.api.ValidationException; import org.apache.flink.table.types.logical.DecimalType; import org.apache.flink.table.types.logical.LogicalTypeRoot; import org.apache.flink.table.types.logical.RowType; import org.apache.flink.table.types.logical.TimestampType; import org.apache.flink.table.types.logical.VarBinaryType; -import org.apache.flink.util.Preconditions; import java.util.Arrays; import java.util.Optional; @@ -253,7 +253,7 @@ public static class Range { private final int max; public static Range of(int min, int max) { - Preconditions.checkArgument( + Precondition.checkArgument( min <= max, String.format( "The range min value in range %d must be <= max value %d", min, max)); diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/database/dialect/AbstractDialectConverter.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/database/dialect/AbstractDialectConverter.java index e27dd8526..7d66eda54 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/database/dialect/AbstractDialectConverter.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/database/dialect/AbstractDialectConverter.java @@ -44,7 +44,7 @@ import java.time.LocalDateTime; import java.time.LocalTime; -import static org.apache.flink.util.Preconditions.checkNotNull; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkNotNull; /** Base class for all converters that convert between JDBC object and Flink internal object. */ public abstract class AbstractDialectConverter implements JdbcDialectConverter { diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/sink/JdbcSinkBuilder.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/sink/JdbcSinkBuilder.java index 12c5a3e72..57dae0998 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/sink/JdbcSinkBuilder.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/sink/JdbcSinkBuilder.java @@ -34,7 +34,7 @@ import javax.sql.XADataSource; -import static org.apache.flink.util.Preconditions.checkNotNull; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkNotNull; /** Builder to construct {@link JdbcSink}. */ @PublicEvolving diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/sink/writer/JdbcWriter.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/sink/writer/JdbcWriter.java index be7aa49c8..a5fd6657a 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/sink/writer/JdbcWriter.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/sink/writer/JdbcWriter.java @@ -25,6 +25,7 @@ import org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions; import org.apache.flink.connector.jdbc.JdbcExecutionOptions; import org.apache.flink.connector.jdbc.core.datastream.sink.committer.JdbcCommitable; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider; import org.apache.flink.connector.jdbc.datasource.connections.xa.XaConnectionProvider; import org.apache.flink.connector.jdbc.datasource.statements.JdbcQueryStatement; @@ -33,7 +34,6 @@ import org.apache.flink.connector.jdbc.internal.JdbcOutputFormat; import org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer; import org.apache.flink.connector.jdbc.internal.executor.JdbcBatchStatementExecutor; -import org.apache.flink.util.Preconditions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,9 +45,9 @@ import java.util.Collections; import java.util.List; -import static org.apache.flink.util.Preconditions.checkArgument; -import static org.apache.flink.util.Preconditions.checkNotNull; -import static org.apache.flink.util.Preconditions.checkState; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkArgument; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkNotNull; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkState; /** * Jdbc writer that allow at-least-once (non-XA operation) and exactly-once (XA operation) @@ -189,7 +189,7 @@ public List snapshotState(long checkpointId) throws IOException return Collections.emptyList(); } - Preconditions.checkState( + Precondition.checkState( checkpointId > lastCheckpointId, "Expected %s > %s", checkpointId, diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSource.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSource.java index d2c055e42..b1aecc8d4 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSource.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSource.java @@ -19,7 +19,6 @@ package org.apache.flink.connector.jdbc.core.datastream.source; import org.apache.flink.annotation.PublicEvolving; -import org.apache.flink.annotation.VisibleForTesting; import org.apache.flink.api.common.typeinfo.TypeInformation; import org.apache.flink.api.connector.source.Boundedness; import org.apache.flink.api.connector.source.Source; @@ -40,9 +39,10 @@ import org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor; import org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplit; import org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplitSerializer; +import org.apache.flink.connector.jdbc.core.util.Precondition; +import org.apache.flink.connector.jdbc.core.util.VisibleForTest; import org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider; import org.apache.flink.core.io.SimpleVersionedSerializer; -import org.apache.flink.util.Preconditions; import javax.annotation.Nullable; @@ -75,13 +75,13 @@ public class JdbcSource TypeInformation typeInformation, @Nullable DeliveryGuarantee deliveryGuarantee, @Nullable ContinuousUnBoundingSettings continuousUnBoundingSettings) { - this.configuration = Preconditions.checkNotNull(configuration); - this.connectionProvider = Preconditions.checkNotNull(connectionProvider); - this.sqlSplitEnumeratorProvider = Preconditions.checkNotNull(sqlSplitEnumeratorProvider); - this.resultExtractor = Preconditions.checkNotNull(resultExtractor); + this.configuration = Precondition.checkNotNull(configuration); + this.connectionProvider = Precondition.checkNotNull(connectionProvider); + this.sqlSplitEnumeratorProvider = Precondition.checkNotNull(sqlSplitEnumeratorProvider); + this.resultExtractor = Precondition.checkNotNull(resultExtractor); this.deliveryGuarantee = Objects.isNull(deliveryGuarantee) ? DeliveryGuarantee.NONE : deliveryGuarantee; - this.typeInformation = Preconditions.checkNotNull(typeInformation); + this.typeInformation = Precondition.checkNotNull(typeInformation); this.continuousUnBoundingSettings = continuousUnBoundingSettings; this.boundedness = Objects.isNull(continuousUnBoundingSettings) @@ -156,27 +156,27 @@ public static JdbcSourceBuilder builder() { // ---- Visible for testing methods. --- - @VisibleForTesting + @VisibleForTest public JdbcSqlSplitEnumeratorBase.Provider getSqlSplitEnumeratorProvider() { return sqlSplitEnumeratorProvider; } - @VisibleForTesting + @VisibleForTest public TypeInformation getTypeInformation() { return typeInformation; } - @VisibleForTesting + @VisibleForTest public Configuration getConfiguration() { return configuration; } - @VisibleForTesting + @VisibleForTest public ResultExtractor getResultExtractor() { return resultExtractor; } - @VisibleForTesting + @VisibleForTest @Override public boolean equals(Object o) { if (this == o) { diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilder.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilder.java index 32c0f2b71..3f1ba2bd6 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilder.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/JdbcSourceBuilder.java @@ -26,12 +26,12 @@ import org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings; import org.apache.flink.connector.jdbc.core.datastream.source.enumerator.SqlTemplateSplitEnumerator; import org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider; import org.apache.flink.connector.jdbc.datasource.connections.SimpleJdbcConnectionProvider; import org.apache.flink.connector.jdbc.split.JdbcParameterValuesProvider; import org.apache.flink.connector.jdbc.split.JdbcSlideTimingParameterProvider; import org.apache.flink.types.Row; -import org.apache.flink.util.Preconditions; import org.apache.flink.util.StringUtils; import org.slf4j.Logger; @@ -133,7 +133,7 @@ public class JdbcSourceBuilder { } public JdbcSourceBuilder setSql(@Nonnull String sql) { - Preconditions.checkArgument( + Precondition.checkArgument( !StringUtils.isNullOrWhitespaceOnly(sql), "It's required to set the 'sql' with non-empty value."); this.sql = sql; @@ -142,7 +142,7 @@ public JdbcSourceBuilder setSql(@Nonnull String sql) { public JdbcSourceBuilder setResultExtractor(ResultExtractor resultExtractor) { this.resultExtractor = - Preconditions.checkNotNull( + Precondition.checkNotNull( resultExtractor, "It's required to set the 'resultExtractor'."); return this; } @@ -158,7 +158,7 @@ public JdbcSourceBuilder setPassword(String password) { } public JdbcSourceBuilder setDriverName(String driverName) { - Preconditions.checkArgument( + Precondition.checkArgument( !StringUtils.isNullOrWhitespaceOnly(driverName), "It's required to set the 'driverName'."); connOptionsBuilder.withDriverName(driverName); @@ -166,7 +166,7 @@ public JdbcSourceBuilder setDriverName(String driverName) { } public JdbcSourceBuilder setDBUrl(String dbURL) { - Preconditions.checkArgument( + Precondition.checkArgument( !StringUtils.isNullOrWhitespaceOnly(dbURL), "It's required to set the 'dbURL'."); connOptionsBuilder.withUrl(dbURL); return this; @@ -175,7 +175,7 @@ public JdbcSourceBuilder setDBUrl(String dbURL) { public JdbcSourceBuilder setTypeInformation( @Nonnull TypeInformation typeInformation) { this.typeInformation = - Preconditions.checkNotNull( + Precondition.checkNotNull( typeInformation, "It's required to set the 'typeInformation'."); return this; } @@ -199,12 +199,12 @@ public JdbcSourceBuilder setContinuousUnBoundingSettings( */ public JdbcSourceBuilder setJdbcParameterValuesProvider( @Nonnull JdbcParameterValuesProvider parameterValuesProvider) { - this.jdbcParameterValuesProvider = Preconditions.checkNotNull(parameterValuesProvider); + this.jdbcParameterValuesProvider = Precondition.checkNotNull(parameterValuesProvider); return this; } public JdbcSourceBuilder setDeliveryGuarantee(DeliveryGuarantee deliveryGuarantee) { - this.deliveryGuarantee = Preconditions.checkNotNull(deliveryGuarantee); + this.deliveryGuarantee = Precondition.checkNotNull(deliveryGuarantee); return this; } @@ -215,14 +215,14 @@ public JdbcSourceBuilder setConnectionCheckTimeoutSeconds( } public JdbcSourceBuilder setConnectionProperty(String propKey, String propVal) { - Preconditions.checkNotNull(propKey, "Connection property key mustn't be null"); - Preconditions.checkNotNull(propVal, "Connection property value mustn't be null"); + Precondition.checkNotNull(propKey, "Connection property key mustn't be null"); + Precondition.checkNotNull(propVal, "Connection property value mustn't be null"); connOptionsBuilder.withProperty(propKey, propVal); return this; } public JdbcSourceBuilder setSplitReaderFetchBatchSize(int splitReaderFetchBatchSize) { - Preconditions.checkArgument( + Precondition.checkArgument( splitReaderFetchBatchSize > 0, "'splitReaderFetchBatchSize' must be in range (0, %s]", Integer.MAX_VALUE); @@ -246,7 +246,7 @@ public JdbcSourceBuilder setAutoCommit(boolean autoCommit) { } public JdbcSourceBuilder setResultSetFetchSize(int resultSetFetchSize) { - Preconditions.checkArgument( + Precondition.checkArgument( resultSetFetchSize == Integer.MIN_VALUE || resultSetFetchSize > 0, "Illegal value %s for fetchSize, has to be positive or Integer.MIN_VALUE.", resultSetFetchSize); @@ -256,7 +256,7 @@ public JdbcSourceBuilder setResultSetFetchSize(int resultSetFetchSize) { public JdbcSourceBuilder setConnectionProvider( @Nonnull JdbcConnectionProvider connectionProvider) { - this.connectionProvider = Preconditions.checkNotNull(connectionProvider); + this.connectionProvider = Precondition.checkNotNull(connectionProvider); return this; } @@ -273,7 +273,7 @@ public JdbcSource build() { } if (deliveryGuarantee == DeliveryGuarantee.EXACTLY_ONCE) { - Preconditions.checkArgument( + Precondition.checkArgument( this.resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE || this.resultSetType == ResultSet.CONCUR_READ_ONLY, "The 'resultSetType' must be ResultSet.TYPE_SCROLL_INSENSITIVE or ResultSet.CONCUR_READ_ONLY when using %s", @@ -286,13 +286,13 @@ public JdbcSource build() { JdbcSourceOptions.READER_FETCH_BATCH_SIZE, splitReaderFetchBatchSize); this.configuration.set(JdbcSourceOptions.AUTO_COMMIT, autoCommit); - Preconditions.checkState( + Precondition.checkState( !StringUtils.isNullOrWhitespaceOnly(sql), "'sql' mustn't be null or empty."); - Preconditions.checkNotNull(resultExtractor, "'resultExtractor' mustn't be null."); - Preconditions.checkNotNull(typeInformation, "'typeInformation' mustn't be null."); + Precondition.checkNotNull(resultExtractor, "'resultExtractor' mustn't be null."); + Precondition.checkNotNull(typeInformation, "'typeInformation' mustn't be null."); if (Objects.nonNull(continuousUnBoundingSettings)) { - Preconditions.checkArgument( + Precondition.checkArgument( Objects.nonNull(jdbcParameterValuesProvider) && jdbcParameterValuesProvider instanceof JdbcSlideTimingParameterProvider, @@ -301,7 +301,7 @@ public JdbcSource build() { if (Objects.nonNull(jdbcParameterValuesProvider) && jdbcParameterValuesProvider instanceof JdbcSlideTimingParameterProvider) { - Preconditions.checkArgument( + Precondition.checkArgument( Objects.nonNull(continuousUnBoundingSettings), INVALID_CONTINUOUS_SLIDE_TIMING_HINT); } diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/config/ContinuousUnBoundingSettings.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/config/ContinuousUnBoundingSettings.java index da4a8d928..e8bf860d6 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/config/ContinuousUnBoundingSettings.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/config/ContinuousUnBoundingSettings.java @@ -24,7 +24,7 @@ import java.time.Duration; import java.util.Objects; -import static org.apache.flink.util.Preconditions.checkNotNull; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkNotNull; /** * Settings describing how to do continuous file discovery and enumeration for the file source's diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumStateSerializer.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumStateSerializer.java index 2be1deb15..46d8b1311 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumStateSerializer.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumStateSerializer.java @@ -20,9 +20,9 @@ import org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplit; import org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplitSerializer; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.core.io.SimpleVersionedSerializer; import org.apache.flink.util.InstantiationUtil; -import org.apache.flink.util.Preconditions; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -33,7 +33,7 @@ import java.util.ArrayList; import java.util.List; -import static org.apache.flink.util.Preconditions.checkArgument; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkArgument; /** The serializer for {@link JdbcSourceEnumeratorState}. */ public class JdbcSourceEnumStateSerializer @@ -44,7 +44,7 @@ public class JdbcSourceEnumStateSerializer private final JdbcSourceSplitSerializer splitSerializer; public JdbcSourceEnumStateSerializer(JdbcSourceSplitSerializer splitSerializer) { - this.splitSerializer = Preconditions.checkNotNull(splitSerializer); + this.splitSerializer = Precondition.checkNotNull(splitSerializer); } @Override @@ -83,7 +83,7 @@ private void serializeJdbcSourceSplits( out.writeInt(jdbcSourceSplits.size()); for (JdbcSourceSplit sourceSplit : jdbcSourceSplits) { - Preconditions.checkNotNull(sourceSplit); + Precondition.checkNotNull(sourceSplit); splitSerializer.serializeJdbcSourceSplit(out, sourceSplit); } } diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumerator.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumerator.java index c545a08f5..f4a826821 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumerator.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumerator.java @@ -24,7 +24,7 @@ import org.apache.flink.api.connector.source.SplitEnumeratorContext; import org.apache.flink.connector.jdbc.core.datastream.source.config.ContinuousUnBoundingSettings; import org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplit; -import org.apache.flink.util.Preconditions; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,14 +58,14 @@ public JdbcSourceEnumerator( JdbcSqlSplitEnumeratorBase sqlSplitEnumerator, ContinuousUnBoundingSettings continuousUnBoundingSettings, List unassigned) { - this.context = Preconditions.checkNotNull(context); - this.sqlSplitEnumerator = Preconditions.checkNotNull(sqlSplitEnumerator); + this.context = Precondition.checkNotNull(context); + this.sqlSplitEnumerator = Precondition.checkNotNull(sqlSplitEnumerator); this.continuousUnBoundingSettings = continuousUnBoundingSettings; this.boundedness = Objects.isNull(continuousUnBoundingSettings) ? Boundedness.BOUNDED : Boundedness.CONTINUOUS_UNBOUNDED; - this.unassigned = Preconditions.checkNotNull(unassigned); + this.unassigned = Precondition.checkNotNull(unassigned); this.readersAwaitingSplit = new LinkedHashMap<>(); } diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumeratorState.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumeratorState.java index 1c7d5ad4d..ae4668e17 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumeratorState.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/JdbcSourceEnumeratorState.java @@ -20,7 +20,7 @@ import org.apache.flink.annotation.PublicEvolving; import org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplit; -import org.apache.flink.util.Preconditions; +import org.apache.flink.connector.jdbc.core.util.Precondition; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -44,9 +44,9 @@ public JdbcSourceEnumeratorState( @Nonnull List pendingSplits, @Nonnull List remainingSplits, @Nullable Serializable optionalUserDefinedSplitEnumeratorState) { - this.completedSplits = Preconditions.checkNotNull(completedSplits); - this.pendingSplits = Preconditions.checkNotNull(pendingSplits); - this.remainingSplits = Preconditions.checkNotNull(remainingSplits); + this.completedSplits = Precondition.checkNotNull(completedSplits); + this.pendingSplits = Precondition.checkNotNull(pendingSplits); + this.remainingSplits = Precondition.checkNotNull(remainingSplits); this.optionalUserDefinedSplitEnumeratorState = optionalUserDefinedSplitEnumeratorState; } diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/SqlTemplateSplitEnumerator.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/SqlTemplateSplitEnumerator.java index b4565d950..0e6d45c63 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/SqlTemplateSplitEnumerator.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/enumerator/SqlTemplateSplitEnumerator.java @@ -18,11 +18,11 @@ package org.apache.flink.connector.jdbc.core.datastream.source.enumerator; -import org.apache.flink.annotation.VisibleForTesting; import org.apache.flink.connector.jdbc.core.datastream.source.split.CheckpointedOffset; import org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplit; +import org.apache.flink.connector.jdbc.core.util.Precondition; +import org.apache.flink.connector.jdbc.core.util.VisibleForTest; import org.apache.flink.connector.jdbc.split.JdbcParameterValuesProvider; -import org.apache.flink.util.Preconditions; import org.apache.flink.util.StringUtils; import org.slf4j.Logger; @@ -51,7 +51,7 @@ public SqlTemplateSplitEnumerator( String sqlTemplate, @Nullable JdbcParameterValuesProvider parametersProvider) { super(userDefinedState); - this.sqlTemplate = Preconditions.checkNotNull(sqlTemplate); + this.sqlTemplate = Precondition.checkNotNull(sqlTemplate); this.parameterValuesProvider = parametersProvider; } @@ -94,12 +94,12 @@ public List enumerateSplits(@Nonnull Supplier splitGet return jdbcSourceSplitList; } - @VisibleForTesting + @VisibleForTest public String getSqlTemplate() { return sqlTemplate; } - @VisibleForTesting + @VisibleForTest public JdbcParameterValuesProvider getParameterValuesProvider() { return parameterValuesProvider; } @@ -115,7 +115,7 @@ public static class TemplateSqlSplitEnumeratorProvider private @Nullable JdbcParameterValuesProvider parameterValuesProvider; public TemplateSqlSplitEnumeratorProvider setSqlTemplate(String sqlTemplate) { - Preconditions.checkArgument( + Precondition.checkArgument( !StringUtils.isNullOrWhitespaceOnly(sqlTemplate), "sqlTemplate must not be empty."); this.sqlTemplate = sqlTemplate; diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/reader/JdbcSourceSplitReader.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/reader/JdbcSourceSplitReader.java index 7e1af42d7..33a40ce78 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/reader/JdbcSourceSplitReader.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/reader/JdbcSourceSplitReader.java @@ -18,7 +18,6 @@ package org.apache.flink.connector.jdbc.core.datastream.source.reader; -import org.apache.flink.annotation.VisibleForTesting; import org.apache.flink.api.common.typeinfo.TypeInformation; import org.apache.flink.api.connector.source.SourceReaderContext; import org.apache.flink.api.java.typeutils.ResultTypeQueryable; @@ -31,8 +30,9 @@ import org.apache.flink.connector.base.source.reader.splitreader.SplitsChange; import org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor; import org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplit; +import org.apache.flink.connector.jdbc.core.util.Precondition; +import org.apache.flink.connector.jdbc.core.util.VisibleForTest; import org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider; -import org.apache.flink.util.Preconditions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -101,23 +101,23 @@ public JdbcSourceSplitReader( JdbcConnectionProvider connectionProvider, DeliveryGuarantee deliveryGuarantee, ResultExtractor resultExtractor) { - this.context = Preconditions.checkNotNull(context); - this.config = Preconditions.checkNotNull(config); - this.typeInformation = Preconditions.checkNotNull(typeInformation); - this.connectionProvider = Preconditions.checkNotNull(connectionProvider); + this.context = Precondition.checkNotNull(context); + this.config = Precondition.checkNotNull(config); + this.typeInformation = Precondition.checkNotNull(typeInformation); + this.connectionProvider = Precondition.checkNotNull(connectionProvider); this.resultSetType = config.getInteger(RESULTSET_TYPE); this.resultSetConcurrency = config.getInteger(RESULTSET_CONCURRENCY); this.resultSetFetchSize = config.getInteger(RESULTSET_FETCH_SIZE); this.autoCommit = config.getBoolean(AUTO_COMMIT); - this.deliveryGuarantee = Preconditions.checkNotNull(deliveryGuarantee); + this.deliveryGuarantee = Precondition.checkNotNull(deliveryGuarantee); this.splits = new ArrayDeque<>(); this.hasNextRecordCurrentSplit = false; this.currentSplit = null; int splitReaderFetchBatchSize = config.getInteger(READER_FETCH_BATCH_SIZE); - Preconditions.checkArgument( + Precondition.checkArgument( splitReaderFetchBatchSize > 0 && splitReaderFetchBatchSize < Integer.MAX_VALUE); this.splitReaderFetchBatchSize = splitReaderFetchBatchSize; - this.resultExtractor = Preconditions.checkNotNull(resultExtractor); + this.resultExtractor = Precondition.checkNotNull(resultExtractor); this.currentSplitOffset = 0; } @@ -135,7 +135,7 @@ public RecordsWithSplitIds> fetch() throws IOException { RecordsBySplits.Builder> recordAndOffsetBuilder = new RecordsBySplits.Builder<>(); - Preconditions.checkState(currentSplit != null, "currentSplit"); + Precondition.checkState(currentSplit != null, "currentSplit"); int batch = this.splitReaderFetchBatchSize; while (batch > 0 && hasNextRecordCurrentSplit) { try { @@ -162,7 +162,7 @@ private RecordsWithSplitIds> finishSplit() { RecordsBySplits.Builder> builder = new RecordsBySplits.Builder<>(); JdbcSourceSplit splitToFinish = Objects.nonNull(currentSplit) ? currentSplit : skippedSplit; - Preconditions.checkState(splitToFinish != null, "Split to finish mustn't be null."); + Precondition.checkState(splitToFinish != null, "Split to finish mustn't be null."); builder.addFinishedSplit(splitToFinish.splitId()); currentSplit = null; skippedSplit = null; @@ -227,22 +227,22 @@ public TypeInformation getProducedType() { return typeInformation; } - @VisibleForTesting + @VisibleForTest public List getSplits() { return Collections.unmodifiableList(Arrays.asList(splits.toArray(new JdbcSourceSplit[0]))); } - @VisibleForTesting + @VisibleForTest public Connection getConnection() { return connection; } - @VisibleForTesting + @VisibleForTest public PreparedStatement getStatement() { return statement; } - @VisibleForTesting + @VisibleForTest public ResultSet getResultSet() { return resultSet; } diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/reader/extractor/RowResultExtractor.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/reader/extractor/RowResultExtractor.java index cc050acca..38976caf2 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/reader/extractor/RowResultExtractor.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/reader/extractor/RowResultExtractor.java @@ -18,8 +18,8 @@ package org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.types.Row; -import org.apache.flink.util.Preconditions; import java.sql.ResultSet; import java.sql.SQLException; @@ -30,7 +30,7 @@ public class RowResultExtractor implements ResultExtractor { public Row extract(ResultSet resultSet) throws SQLException { int arity = resultSet.getMetaData().getColumnCount(); Row row = new Row(arity); - Preconditions.checkArgument(!resultSet.isClosed()); + Precondition.checkArgument(!resultSet.isClosed()); for (int index = 0; index < row.getArity(); index++) { row.setField(index, resultSet.getObject(index + 1)); } diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/split/JdbcSourceSplit.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/split/JdbcSourceSplit.java index f57169baa..34a43111d 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/split/JdbcSourceSplit.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/split/JdbcSourceSplit.java @@ -20,7 +20,7 @@ import org.apache.flink.annotation.PublicEvolving; import org.apache.flink.api.connector.source.SourceSplit; -import org.apache.flink.util.Preconditions; +import org.apache.flink.connector.jdbc.core.util.Precondition; import javax.annotation.Nullable; @@ -68,7 +68,7 @@ public Optional getReaderPositionOptional() { public int getReaderPosition() { if (Objects.nonNull(checkpointedOffset)) { - Preconditions.checkState(checkpointedOffset.getOffset() <= Integer.MAX_VALUE); + Precondition.checkState(checkpointedOffset.getOffset() <= Integer.MAX_VALUE); return (int) checkpointedOffset.getOffset(); } return 0; diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/split/JdbcSourceSplitSerializer.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/split/JdbcSourceSplitSerializer.java index 86775fbf2..97aa9dfeb 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/split/JdbcSourceSplitSerializer.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/split/JdbcSourceSplitSerializer.java @@ -28,7 +28,7 @@ import java.io.IOException; import java.io.Serializable; -import static org.apache.flink.util.Preconditions.checkArgument; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkArgument; /** The class is used to de/serialize the {@link JdbcSourceSplit}. */ public class JdbcSourceSplitSerializer implements SimpleVersionedSerializer { diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/split/JdbcSourceSplitState.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/split/JdbcSourceSplitState.java index 98d523b25..f72e7d6dc 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/split/JdbcSourceSplitState.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/split/JdbcSourceSplitState.java @@ -23,7 +23,7 @@ import java.io.Serializable; import java.util.Optional; -import static org.apache.flink.util.Preconditions.checkNotNull; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkNotNull; /** The class is hold the state information of {@link JdbcSourceSplit}. */ public class JdbcSourceSplitState implements Serializable { diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/JdbcDynamicTableFactory.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/JdbcDynamicTableFactory.java index e1c732eed..d0cfc6ac0 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/JdbcDynamicTableFactory.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/JdbcDynamicTableFactory.java @@ -27,6 +27,7 @@ import org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialect; import org.apache.flink.connector.jdbc.core.table.sink.JdbcDynamicTableSink; import org.apache.flink.connector.jdbc.core.table.source.JdbcDynamicTableSource; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.connector.jdbc.internal.options.InternalJdbcConnectionOptions; import org.apache.flink.connector.jdbc.internal.options.JdbcDmlOptions; import org.apache.flink.connector.jdbc.internal.options.JdbcReadOptions; @@ -40,7 +41,6 @@ import org.apache.flink.table.factories.FactoryUtil; import org.apache.flink.table.types.DataType; import org.apache.flink.table.types.logical.RowType; -import org.apache.flink.util.Preconditions; import javax.annotation.Nullable; @@ -353,7 +353,7 @@ private void checkAllOrNone(ReadableConfig config, ConfigOption[] configOptio } String[] propertyNames = Arrays.stream(configOptions).map(ConfigOption::key).toArray(String[]::new); - Preconditions.checkArgument( + Precondition.checkArgument( configOptions.length == presentCount || presentCount == 0, "Either all or none of the following options should be provided:\n" + String.join("\n", propertyNames)); diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/sink/JdbcDynamicTableSink.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/sink/JdbcDynamicTableSink.java index 7b2c2f761..b31862aa0 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/sink/JdbcDynamicTableSink.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/sink/JdbcDynamicTableSink.java @@ -31,7 +31,7 @@ import java.util.Objects; -import static org.apache.flink.util.Preconditions.checkState; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkState; /** A {@link DynamicTableSink} for JDBC. */ @Internal diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/sink/JdbcOutputFormatBuilder.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/sink/JdbcOutputFormatBuilder.java index 493cc8d22..8de888e4a 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/sink/JdbcOutputFormatBuilder.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/sink/JdbcOutputFormatBuilder.java @@ -41,9 +41,9 @@ import java.util.Arrays; import java.util.function.Function; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkArgument; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkNotNull; import static org.apache.flink.table.data.RowData.createFieldGetter; -import static org.apache.flink.util.Preconditions.checkArgument; -import static org.apache.flink.util.Preconditions.checkNotNull; /** Builder for {@link JdbcOutputFormat} for Table/SQL. */ public class JdbcOutputFormatBuilder implements Serializable { diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/source/JdbcDynamicTableSource.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/source/JdbcDynamicTableSource.java index d26898a53..7a3719152 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/source/JdbcDynamicTableSource.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/source/JdbcDynamicTableSource.java @@ -21,6 +21,7 @@ import org.apache.flink.annotation.Internal; import org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialect; import org.apache.flink.connector.jdbc.core.table.FilterHandlingPolicy; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.connector.jdbc.internal.options.InternalJdbcConnectionOptions; import org.apache.flink.connector.jdbc.internal.options.JdbcReadOptions; import org.apache.flink.connector.jdbc.split.CompositeJdbcParameterValuesProvider; @@ -43,7 +44,6 @@ import org.apache.flink.table.expressions.ResolvedExpression; import org.apache.flink.table.types.DataType; import org.apache.flink.table.types.logical.RowType; -import org.apache.flink.util.Preconditions; import org.apache.commons.lang3.ArrayUtils; import org.slf4j.Logger; @@ -103,7 +103,7 @@ public LookupRuntimeProvider getLookupRuntimeProvider(LookupContext context) { String[] keyNames = new String[context.getKeys().length]; for (int i = 0; i < keyNames.length; i++) { int[] innerKeyArr = context.getKeys()[i]; - Preconditions.checkArgument( + Precondition.checkArgument( innerKeyArr.length == 1, "JDBC only support non-nested look up keys"); keyNames[i] = DataType.getFieldNames(physicalRowDataType).get(innerKeyArr[0]); } diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/source/JdbcRowDataInputFormat.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/source/JdbcRowDataInputFormat.java index b06f555da..fbac026e3 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/source/JdbcRowDataInputFormat.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/source/JdbcRowDataInputFormat.java @@ -28,6 +28,7 @@ import org.apache.flink.configuration.Configuration; import org.apache.flink.connector.jdbc.JdbcConnectionOptions; import org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider; import org.apache.flink.connector.jdbc.datasource.connections.SimpleJdbcConnectionProvider; import org.apache.flink.connector.jdbc.split.JdbcParameterValuesProvider; @@ -35,7 +36,6 @@ import org.apache.flink.core.io.InputSplit; import org.apache.flink.core.io.InputSplitAssigner; import org.apache.flink.table.data.RowData; -import org.apache.flink.util.Preconditions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -353,7 +353,7 @@ public Builder setRowConverter(JdbcDialectConverter rowConverter) { } public Builder setFetchSize(int fetchSize) { - Preconditions.checkArgument( + Precondition.checkArgument( fetchSize == Integer.MIN_VALUE || fetchSize > 0, "Illegal value %s for fetchSize, has to be positive or Integer.MIN_VALUE.", fetchSize); diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/source/JdbcRowDataLookupFunction.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/source/JdbcRowDataLookupFunction.java index dd39fa27e..96f517a2f 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/source/JdbcRowDataLookupFunction.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/table/source/JdbcRowDataLookupFunction.java @@ -19,9 +19,9 @@ package org.apache.flink.connector.jdbc.core.table.source; import org.apache.flink.annotation.Internal; -import org.apache.flink.annotation.VisibleForTesting; import org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialect; import org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialectConverter; +import org.apache.flink.connector.jdbc.core.util.VisibleForTest; import org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider; import org.apache.flink.connector.jdbc.datasource.connections.SimpleJdbcConnectionProvider; import org.apache.flink.connector.jdbc.internal.options.InternalJdbcConnectionOptions; @@ -48,8 +48,8 @@ import java.util.List; import java.util.stream.Collectors; -import static org.apache.flink.util.Preconditions.checkArgument; -import static org.apache.flink.util.Preconditions.checkNotNull; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkArgument; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkNotNull; /** A lookup function for {@link JdbcDynamicTableSource}. */ @Internal @@ -220,7 +220,7 @@ public void close() throws IOException { connectionProvider.closeConnection(); } - @VisibleForTesting + @VisibleForTest public Connection getDbConnection() { return connectionProvider.getConnection(); } diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/util/Precondition.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/util/Precondition.java new file mode 100644 index 000000000..470cd9898 --- /dev/null +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/util/Precondition.java @@ -0,0 +1,290 @@ +package org.apache.flink.connector.jdbc.core.util; + +import org.apache.flink.annotation.PublicEvolving; + +import javax.annotation.Nullable; + +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; + +/** + * A collection of static utility methods to validate input. + * + *

This class is a copy of Flink Preconditions. We add this code to the Flink JDBC code because + * Preconditions is an Internal class of Flink. + */ +@PublicEvolving +public class Precondition { + // ------------------------------------------------------------------------ + // Null checks + // ------------------------------------------------------------------------ + /** + * Ensures that the given object reference is not null. Upon violation, a {@code + * NullPointerException} with no message is thrown. + * + * @param reference The object reference + * @return The object reference itself (generically typed). + * @throws NullPointerException Thrown, if the passed reference was null. + */ + public static T checkNotNull(@Nullable T reference) { + if (reference == null) { + throw new NullPointerException(); + } + return reference; + } + + /** + * Ensures that the given object reference is not null. Upon violation, a {@code + * NullPointerException} with the given message is thrown. + * + * @param reference The object reference + * @param errorMessage The message for the {@code NullPointerException} that is thrown if the + * check fails. + * @return The object reference itself (generically typed). + * @throws NullPointerException Thrown, if the passed reference was null. + */ + public static T checkNotNull(@Nullable T reference, @Nullable String errorMessage) { + if (reference == null) { + throw new NullPointerException(String.valueOf(errorMessage)); + } + return reference; + } + + /** + * Ensures that the given object reference is not null. Upon violation, a {@code + * NullPointerException} with the given message is thrown. + * + *

The error message is constructed from a template and an arguments array, after a similar + * fashion as {@link String#format(String, Object...)}, but supporting only {@code %s} as a + * placeholder. + * + * @param reference The object reference + * @param errorMessageTemplate The message template for the {@code NullPointerException} that is + * thrown if the check fails. The template substitutes its {@code %s} placeholders with the + * error message arguments. + * @param errorMessageArgs The arguments for the error message, to be inserted into the message + * template for the {@code %s} placeholders. + * @return The object reference itself (generically typed). + * @throws NullPointerException Thrown, if the passed reference was null. + */ + public static T checkNotNull( + T reference, + @Nullable String errorMessageTemplate, + @Nullable Object... errorMessageArgs) { + + if (reference == null) { + throw new NullPointerException(format(errorMessageTemplate, errorMessageArgs)); + } + return reference; + } + + // ------------------------------------------------------------------------ + // Boolean Condition Checking (Argument) + // ------------------------------------------------------------------------ + + /** + * Checks the given boolean condition, and throws an {@code IllegalArgumentException} if the + * condition is not met (evaluates to {@code false}). + * + * @param condition The condition to check + * @throws IllegalArgumentException Thrown, if the condition is violated. + */ + public static void checkArgument(boolean condition) { + if (!condition) { + throw new IllegalArgumentException(); + } + } + + /** + * Checks the given boolean condition, and throws an {@code IllegalArgumentException} if the + * condition is not met (evaluates to {@code false}). The exception will have the given error + * message. + * + * @param condition The condition to check + * @param errorMessage The message for the {@code IllegalArgumentException} that is thrown if + * the check fails. + * @throws IllegalArgumentException Thrown, if the condition is violated. + */ + public static void checkArgument(boolean condition, @Nullable Object errorMessage) { + if (!condition) { + throw new IllegalArgumentException(String.valueOf(errorMessage)); + } + } + + /** + * Checks the given boolean condition, and throws an {@code IllegalArgumentException} if the + * condition is not met (evaluates to {@code false}). + * + * @param condition The condition to check + * @param errorMessageTemplate The message template for the {@code IllegalArgumentException} + * that is thrown if the check fails. The template substitutes its {@code %s} placeholders + * with the error message arguments. + * @param errorMessageArgs The arguments for the error message, to be inserted into the message + * template for the {@code %s} placeholders. + * @throws IllegalArgumentException Thrown, if the condition is violated. + */ + public static void checkArgument( + boolean condition, + @Nullable String errorMessageTemplate, + @Nullable Object... errorMessageArgs) { + + if (!condition) { + throw new IllegalArgumentException(format(errorMessageTemplate, errorMessageArgs)); + } + } + + // ------------------------------------------------------------------------ + // Boolean Condition Checking (State) + // ------------------------------------------------------------------------ + + /** + * Checks the given boolean condition, and throws an {@code IllegalStateException} if the + * condition is not met (evaluates to {@code false}). + * + * @param condition The condition to check + * @throws IllegalStateException Thrown, if the condition is violated. + */ + public static void checkState(boolean condition) { + if (!condition) { + throw new IllegalStateException(); + } + } + + /** + * Checks the given boolean condition, and throws an {@code IllegalStateException} if the + * condition is not met (evaluates to {@code false}). The exception will have the given error + * message. + * + * @param condition The condition to check + * @param errorMessage The message for the {@code IllegalStateException} that is thrown if the + * check fails. + * @throws IllegalStateException Thrown, if the condition is violated. + */ + public static void checkState(boolean condition, @Nullable Object errorMessage) { + if (!condition) { + throw new IllegalStateException(String.valueOf(errorMessage)); + } + } + + /** + * Checks the given boolean condition, and throws an {@code IllegalStateException} if the + * condition is not met (evaluates to {@code false}). + * + * @param condition The condition to check + * @param errorMessageTemplate The message template for the {@code IllegalStateException} that + * is thrown if the check fails. The template substitutes its {@code %s} placeholders with + * the error message arguments. + * @param errorMessageArgs The arguments for the error message, to be inserted into the message + * template for the {@code %s} placeholders. + * @throws IllegalStateException Thrown, if the condition is violated. + */ + public static void checkState( + boolean condition, + @Nullable String errorMessageTemplate, + @Nullable Object... errorMessageArgs) { + + if (!condition) { + throw new IllegalStateException(format(errorMessageTemplate, errorMessageArgs)); + } + } + + /** + * Ensures that the given index is valid for an array, list or string of the given size. + * + * @param index index to check + * @param size size of the array, list or string + * @throws IllegalArgumentException Thrown, if size is negative. + * @throws IndexOutOfBoundsException Thrown, if the index negative or greater than or equal to + * size + */ + public static void checkElementIndex(int index, int size) { + checkArgument(size >= 0, "Size was negative."); + if (index < 0 || index >= size) { + throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size); + } + } + + /** + * Ensures that the given index is valid for an array, list or string of the given size. + * + * @param index index to check + * @param size size of the array, list or string + * @param errorMessage The message for the {@code IndexOutOfBoundsException} that is thrown if + * the check fails. + * @throws IllegalArgumentException Thrown, if size is negative. + * @throws IndexOutOfBoundsException Thrown, if the index negative or greater than or equal to + * size + */ + public static void checkElementIndex(int index, int size, @Nullable String errorMessage) { + checkArgument(size >= 0, "Size was negative."); + if (index < 0 || index >= size) { + throw new IndexOutOfBoundsException( + String.valueOf(errorMessage) + " Index: " + index + ", Size: " + size); + } + } + + /** + * Ensures that future has completed normally. + * + * @throws IllegalStateException Thrown, if future has not completed or it has completed + * exceptionally. + */ + public static void checkCompletedNormally(CompletableFuture future) { + checkState(future.isDone()); + if (future.isCompletedExceptionally()) { + try { + future.get(); + } catch (InterruptedException | ExecutionException e) { + throw new IllegalStateException(e); + } + } + } + + // ------------------------------------------------------------------------ + // Utilities + // ------------------------------------------------------------------------ + + /** + * A simplified formatting method. Similar to {@link String#format(String, Object...)}, but with + * lower overhead (only String parameters, no locale, no format validation). + * + *

This method is taken quasi verbatim from the Guava Precondition class. + */ + private static String format(@Nullable String template, @Nullable Object... args) { + final int numArgs = args == null ? 0 : args.length; + template = String.valueOf(template); // null -> "null" + + // start substituting the arguments into the '%s' placeholders + StringBuilder builder = new StringBuilder(template.length() + 16 * numArgs); + int templateStart = 0; + int i = 0; + while (i < numArgs) { + int placeholderStart = template.indexOf("%s", templateStart); + if (placeholderStart == -1) { + break; + } + builder.append(template.substring(templateStart, placeholderStart)); + builder.append(args[i++]); + templateStart = placeholderStart + 2; + } + builder.append(template.substring(templateStart)); + + // if we run out of placeholders, append the extra args in square braces + if (i < numArgs) { + builder.append(" ["); + builder.append(args[i++]); + while (i < numArgs) { + builder.append(", "); + builder.append(args[i++]); + } + builder.append(']'); + } + + return builder.toString(); + } + + // ------------------------------------------------------------------------ + + /** Private constructor to prevent instantiation. */ + private Precondition() {} +} diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/util/VisibleForTest.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/util/VisibleForTest.java new file mode 100644 index 000000000..24fb1b33a --- /dev/null +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/util/VisibleForTest.java @@ -0,0 +1,20 @@ +package org.apache.flink.connector.jdbc.core.util; + +import org.apache.flink.annotation.PublicEvolving; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +/** + * This annotations declares that a function, field, constructor, or entire type, is only visible + * for testing purposes. + * + *

This annotation is typically attached when for example a method should be {@code private} + * (because it is not intended to be called externally), but cannot be declared private, because + * some tests need to have access to it. + */ +@Documented +@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR}) +@PublicEvolving +public @interface VisibleForTest {} diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/connections/SimpleJdbcConnectionProvider.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/connections/SimpleJdbcConnectionProvider.java index 4c48f799e..5fb76911c 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/connections/SimpleJdbcConnectionProvider.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/connections/SimpleJdbcConnectionProvider.java @@ -19,7 +19,7 @@ import org.apache.flink.annotation.PublicEvolving; import org.apache.flink.connector.jdbc.JdbcConnectionOptions; -import org.apache.flink.util.Preconditions; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -84,7 +84,7 @@ public boolean isConnectionValid() throws SQLException { } private Driver loadDriver(String driverName) throws SQLException, ClassNotFoundException { - Preconditions.checkNotNull(driverName); + Precondition.checkNotNull(driverName); Enumeration drivers = DriverManager.getDrivers(); while (drivers.hasMoreElements()) { Driver driver = drivers.nextElement(); diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/connections/xa/PoolingXaConnectionProvider.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/connections/xa/PoolingXaConnectionProvider.java index 7b6ae342a..4c2188d4a 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/connections/xa/PoolingXaConnectionProvider.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/connections/xa/PoolingXaConnectionProvider.java @@ -38,8 +38,8 @@ import java.util.Map; import java.util.function.Supplier; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkState; import static org.apache.flink.util.ExceptionUtils.rethrow; -import static org.apache.flink.util.Preconditions.checkState; /** * A "pooling" implementation of {@link XaConnectionProvider}. Some database implement XA such that diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/connections/xa/SimpleXaConnectionProvider.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/connections/xa/SimpleXaConnectionProvider.java index 3076282f9..c599d2550 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/connections/xa/SimpleXaConnectionProvider.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/connections/xa/SimpleXaConnectionProvider.java @@ -18,11 +18,11 @@ package org.apache.flink.connector.jdbc.datasource.connections.xa; import org.apache.flink.annotation.Internal; -import org.apache.flink.annotation.VisibleForTesting; +import org.apache.flink.connector.jdbc.core.util.Precondition; +import org.apache.flink.connector.jdbc.core.util.VisibleForTest; import org.apache.flink.connector.jdbc.datasource.transactions.xa.exceptions.EmptyTransactionXaException; import org.apache.flink.connector.jdbc.datasource.transactions.xa.exceptions.XaError; import org.apache.flink.util.FlinkRuntimeException; -import org.apache.flink.util.Preconditions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -62,7 +62,7 @@ public class SimpleXaConnectionProvider implements XaConnectionProvider { private transient Connection connection; private transient XAConnection xaConnection; - @VisibleForTesting + @VisibleForTest public static SimpleXaConnectionProvider from(XADataSource ds) { return from(ds, null); } @@ -78,13 +78,13 @@ public static SimpleXaConnectionProvider from( private SimpleXaConnectionProvider( Supplier dataSourceSupplier, Integer timeoutSec) { - this.dataSourceSupplier = Preconditions.checkNotNull(dataSourceSupplier); + this.dataSourceSupplier = Precondition.checkNotNull(dataSourceSupplier); this.timeoutSec = timeoutSec; } @Override public void open() throws SQLException { - Preconditions.checkState(!isOpen(), "already connected"); + Precondition.checkState(!isOpen(), "already connected"); XADataSource ds = dataSourceSupplier.get(); xaConnection = ds.getXAConnection(); xaResource = xaConnection.getXAResource(); @@ -98,7 +98,7 @@ public void open() throws SQLException { connection = xaConnection.getConnection(); connection.setReadOnly(false); connection.setAutoCommit(false); - Preconditions.checkState(!connection.getAutoCommit()); + Precondition.checkState(!connection.getAutoCommit()); } @Override @@ -125,7 +125,7 @@ public void close() throws SQLException { @Override public Connection getConnection() { - Preconditions.checkNotNull(connection); + Precondition.checkNotNull(connection); return connection; } @@ -243,7 +243,7 @@ public Collection recover() { for (int i = 0; list.addAll(recover(TMNOFLAGS)); i++) { // H2 sometimes returns same tx list here - should probably use // recover(TMSTARTRSCAN | TMENDRSCAN) - Preconditions.checkState( + Precondition.checkState( i < MAX_RECOVER_CALLS, "too many xa_recover() calls"); } } finally { @@ -258,7 +258,7 @@ private List recover(int flags) throws XAException { } private T execute(XaCommand cmd) throws FlinkRuntimeException { - Preconditions.checkState(isOpen(), "not connected"); + Precondition.checkState(isOpen(), "not connected"); try { return cmd.execute(); } catch (XAException e) { diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/transactions/xa/XaTransaction.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/transactions/xa/XaTransaction.java index 488968422..d1a064872 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/transactions/xa/XaTransaction.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/transactions/xa/XaTransaction.java @@ -4,12 +4,12 @@ import org.apache.flink.api.java.tuple.Tuple2; import org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions; import org.apache.flink.connector.jdbc.core.datastream.sink.writer.JdbcWriterState; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.connector.jdbc.datasource.connections.xa.XaConnectionProvider; import org.apache.flink.connector.jdbc.datasource.transactions.xa.domain.TransactionId; import org.apache.flink.connector.jdbc.datasource.transactions.xa.exceptions.EmptyTransactionXaException; import org.apache.flink.connector.jdbc.datasource.transactions.xa.exceptions.TransientXaException; import org.apache.flink.util.ExceptionUtils; -import org.apache.flink.util.Preconditions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -118,8 +118,8 @@ public void recoverState(JdbcWriterState state) { } public void checkState() { - Preconditions.checkState(currentTid != null, "current xid must not be null"); - Preconditions.checkState( + Precondition.checkState(currentTid != null, "current xid must not be null"); + Precondition.checkState( !hangingXids.isEmpty() && hangingXids.peekLast().equals(currentTid), "inconsistent internal state"); } @@ -127,7 +127,7 @@ public void checkState() { /** @param checkpointId to associate with the new transaction. */ public void createTx(long checkpointId) throws IOException { try { - Preconditions.checkState(currentTid == null, "currentXid not null"); + Precondition.checkState(currentTid == null, "currentXid not null"); currentTid = baseTransaction.withBranch(checkpointId); hangingXids.offerLast(currentTid); xaConnectionProvider.start(currentTid); diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/transactions/xa/domain/TransactionId.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/transactions/xa/domain/TransactionId.java index ff96c7903..16b12649e 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/transactions/xa/domain/TransactionId.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/transactions/xa/domain/TransactionId.java @@ -2,10 +2,10 @@ import org.apache.flink.annotation.Internal; import org.apache.flink.api.common.JobID; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.core.memory.DataInputDeserializer; import org.apache.flink.core.memory.DataOutputSerializer; import org.apache.flink.util.FlinkRuntimeException; -import org.apache.flink.util.Preconditions; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; @@ -166,7 +166,7 @@ public byte[] getGlobalTransactionId() { @Override public byte[] getBranchQualifier() { - Preconditions.checkArgument(checkpointId >= 0, "No branch was initialized"); + Precondition.checkArgument(checkpointId >= 0, "No branch was initialized"); try { // branchQualifier = numberOfSubtasks + checkpoint id final DataOutputSerializer out = new DataOutputSerializer(1); diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/transactions/xa/xid/XidImpl.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/transactions/xa/xid/XidImpl.java index 1e5b26b26..82a5d9078 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/transactions/xa/xid/XidImpl.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/datasource/transactions/xa/xid/XidImpl.java @@ -18,7 +18,7 @@ package org.apache.flink.connector.jdbc.datasource.transactions.xa.xid; import org.apache.flink.annotation.Internal; -import org.apache.flink.util.Preconditions; +import org.apache.flink.connector.jdbc.core.util.Precondition; import javax.annotation.Nonnull; import javax.transaction.xa.Xid; @@ -43,8 +43,8 @@ public final class XidImpl implements Xid, Serializable { @Nonnull private final byte[] branchQualifier; public XidImpl(int formatId, byte[] globalTransactionId, byte[] branchQualifier) { - Preconditions.checkArgument(globalTransactionId.length <= Xid.MAXGTRIDSIZE); - Preconditions.checkArgument(branchQualifier.length <= Xid.MAXBQUALSIZE); + Precondition.checkArgument(globalTransactionId.length <= Xid.MAXGTRIDSIZE); + Precondition.checkArgument(branchQualifier.length <= Xid.MAXBQUALSIZE); this.formatId = formatId; this.globalTransactionId = Arrays.copyOf(globalTransactionId, globalTransactionId.length); this.branchQualifier = Arrays.copyOf(branchQualifier, branchQualifier.length); diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/GenericJdbcSinkFunction.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/GenericJdbcSinkFunction.java index 43e08fe6a..e75518d32 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/GenericJdbcSinkFunction.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/GenericJdbcSinkFunction.java @@ -23,11 +23,11 @@ import org.apache.flink.api.common.typeinfo.TypeInformation; import org.apache.flink.api.java.typeutils.InputTypeConfigurable; import org.apache.flink.configuration.Configuration; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.runtime.state.FunctionInitializationContext; import org.apache.flink.runtime.state.FunctionSnapshotContext; import org.apache.flink.streaming.api.checkpoint.CheckpointedFunction; import org.apache.flink.streaming.api.functions.sink.RichSinkFunction; -import org.apache.flink.util.Preconditions; import javax.annotation.Nonnull; @@ -41,7 +41,7 @@ public class GenericJdbcSinkFunction extends RichSinkFunction private JdbcOutputSerializer serializer; public GenericJdbcSinkFunction(@Nonnull JdbcOutputFormat outputFormat) { - this.outputFormat = Preconditions.checkNotNull(outputFormat); + this.outputFormat = Precondition.checkNotNull(outputFormat); } @Override diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/JdbcOutputFormat.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/JdbcOutputFormat.java index 93e868705..5b99a2067 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/JdbcOutputFormat.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/JdbcOutputFormat.java @@ -19,8 +19,8 @@ package org.apache.flink.connector.jdbc.internal; import org.apache.flink.annotation.Internal; -import org.apache.flink.annotation.VisibleForTesting; import org.apache.flink.connector.jdbc.JdbcExecutionOptions; +import org.apache.flink.connector.jdbc.core.util.VisibleForTest; import org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider; import org.apache.flink.connector.jdbc.internal.executor.JdbcBatchStatementExecutor; import org.apache.flink.util.concurrent.ExecutorThreadFactory; @@ -42,7 +42,7 @@ import java.util.concurrent.TimeUnit; import java.util.function.Function; -import static org.apache.flink.util.Preconditions.checkNotNull; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkNotNull; /** A JDBC outputFormat that supports batching records before writing records to database. */ @Internal @@ -247,7 +247,7 @@ public JdbcExecutionOptions getExecutionOptions() { return executionOptions; } - @VisibleForTesting + @VisibleForTest public Connection getConnection() { return connectionProvider.getConnection(); } diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/RowJdbcOutputFormat.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/RowJdbcOutputFormat.java index 4f30c4ade..938677bff 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/RowJdbcOutputFormat.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/RowJdbcOutputFormat.java @@ -34,8 +34,8 @@ import java.util.HashMap; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkNotNull; import static org.apache.flink.connector.jdbc.utils.JdbcUtils.setRecordToStatement; -import static org.apache.flink.util.Preconditions.checkNotNull; /** A JDBC Row outputFormat that supports batching records before writing records to database. */ @Internal diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/TableJdbcUpsertOutputFormat.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/TableJdbcUpsertOutputFormat.java index 96e49a260..195f0ece9 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/TableJdbcUpsertOutputFormat.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/TableJdbcUpsertOutputFormat.java @@ -17,8 +17,8 @@ package org.apache.flink.connector.jdbc.internal; -import org.apache.flink.annotation.VisibleForTesting; import org.apache.flink.connector.jdbc.JdbcExecutionOptions; +import org.apache.flink.connector.jdbc.core.util.VisibleForTest; import org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider; import org.apache.flink.connector.jdbc.internal.executor.InsertOrUpdateJdbcExecutor; import org.apache.flink.connector.jdbc.internal.executor.JdbcBatchStatementExecutor; @@ -38,9 +38,9 @@ import java.util.HashMap; import java.util.function.Function; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkArgument; import static org.apache.flink.connector.jdbc.utils.JdbcUtils.getPrimaryKey; import static org.apache.flink.connector.jdbc.utils.JdbcUtils.setRecordToStatement; -import static org.apache.flink.util.Preconditions.checkArgument; class TableJdbcUpsertOutputFormat extends RowJdbcOutputFormat { private static final Logger LOG = LoggerFactory.getLogger(TableJdbcUpsertOutputFormat.class); @@ -60,7 +60,7 @@ class TableJdbcUpsertOutputFormat extends RowJdbcOutputFormat { () -> createDeleteExecutor(dmlOptions)); } - @VisibleForTesting + @VisibleForTest TableJdbcUpsertOutputFormat( JdbcConnectionProvider connectionProvider, JdbcExecutionOptions batchOptions, diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/executor/InsertOrUpdateJdbcExecutor.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/executor/InsertOrUpdateJdbcExecutor.java index 838cbc529..863558119 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/executor/InsertOrUpdateJdbcExecutor.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/executor/InsertOrUpdateJdbcExecutor.java @@ -34,7 +34,7 @@ import java.util.Map; import java.util.function.Function; -import static org.apache.flink.util.Preconditions.checkNotNull; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkNotNull; /** * {@link JdbcBatchStatementExecutor} that provides upsert semantics by updating row if it exists diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/executor/TableInsertOrUpdateStatementExecutor.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/executor/TableInsertOrUpdateStatementExecutor.java index 61ef4cc45..9a309c20a 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/executor/TableInsertOrUpdateStatementExecutor.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/executor/TableInsertOrUpdateStatementExecutor.java @@ -29,7 +29,7 @@ import java.util.Arrays; import java.util.function.Function; -import static org.apache.flink.util.Preconditions.checkNotNull; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkNotNull; /** * {@link JdbcBatchStatementExecutor} that provides upsert semantics by updating row if it exists diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/executor/TableSimpleStatementExecutor.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/executor/TableSimpleStatementExecutor.java index a3fc7b7e2..eeef09413 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/executor/TableSimpleStatementExecutor.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/executor/TableSimpleStatementExecutor.java @@ -26,7 +26,7 @@ import java.sql.Connection; import java.sql.SQLException; -import static org.apache.flink.util.Preconditions.checkNotNull; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkNotNull; /** * A {@link JdbcBatchStatementExecutor} that simply adds the records into batches of {@link diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/options/InternalJdbcConnectionOptions.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/options/InternalJdbcConnectionOptions.java index 6c79ce15b..8e1105820 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/options/InternalJdbcConnectionOptions.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/options/InternalJdbcConnectionOptions.java @@ -22,7 +22,7 @@ import org.apache.flink.connector.jdbc.JdbcConnectionOptions; import org.apache.flink.connector.jdbc.core.database.JdbcFactoryLoader; import org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialect; -import org.apache.flink.util.Preconditions; +import org.apache.flink.connector.jdbc.core.util.Precondition; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -31,7 +31,7 @@ import java.util.Optional; import java.util.Properties; -import static org.apache.flink.util.Preconditions.checkNotNull; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkNotNull; /** Options for the JDBC connector. */ @Internal @@ -192,8 +192,8 @@ public Builder setParallelism(Integer parallelism) { } public Builder setProperty(String propKey, String propVal) { - Preconditions.checkNotNull(propKey, "Connection property key mustn't be null"); - Preconditions.checkNotNull(propVal, "Connection property value mustn't be null"); + Precondition.checkNotNull(propKey, "Connection property key mustn't be null"); + Precondition.checkNotNull(propVal, "Connection property value mustn't be null"); this.properties.put(propKey, propVal); return this; } diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/options/JdbcDmlOptions.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/options/JdbcDmlOptions.java index 4a9181644..3ced977e2 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/options/JdbcDmlOptions.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/options/JdbcDmlOptions.java @@ -18,7 +18,7 @@ package org.apache.flink.connector.jdbc.internal.options; import org.apache.flink.connector.jdbc.core.database.dialect.JdbcDialect; -import org.apache.flink.util.Preconditions; +import org.apache.flink.connector.jdbc.core.util.Precondition; import javax.annotation.Nullable; @@ -48,9 +48,9 @@ private JdbcDmlOptions( int[] fieldTypes, String[] keyFields) { super(fieldTypes); - this.tableName = Preconditions.checkNotNull(tableName, "table is empty"); - this.dialect = Preconditions.checkNotNull(dialect, "dialect is empty"); - this.fieldNames = Preconditions.checkNotNull(fieldNames, "field names is empty"); + this.tableName = Precondition.checkNotNull(tableName, "table is empty"); + this.dialect = Precondition.checkNotNull(dialect, "dialect is empty"); + this.fieldNames = Precondition.checkNotNull(fieldNames, "field names is empty"); this.keyFields = keyFields; } diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/options/JdbcInsertOptions.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/options/JdbcInsertOptions.java index bcfdf3a88..ebb2c5a61 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/options/JdbcInsertOptions.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/internal/options/JdbcInsertOptions.java @@ -17,7 +17,7 @@ package org.apache.flink.connector.jdbc.internal.options; -import org.apache.flink.util.Preconditions; +import org.apache.flink.connector.jdbc.core.util.Precondition; import java.util.stream.IntStream; @@ -30,7 +30,7 @@ public class JdbcInsertOptions extends JdbcTypedQueryOptions { public JdbcInsertOptions(String query, int[] typesArray) { super(typesArray); - this.query = Preconditions.checkNotNull(query, "query is empty"); + this.query = Precondition.checkNotNull(query, "query is empty"); } public String getQuery() { diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/split/CompositeJdbcParameterValuesProvider.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/split/CompositeJdbcParameterValuesProvider.java index eebeac5ab..ef2d2e51d 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/split/CompositeJdbcParameterValuesProvider.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/split/CompositeJdbcParameterValuesProvider.java @@ -19,7 +19,7 @@ package org.apache.flink.connector.jdbc.split; import org.apache.flink.annotation.Internal; -import org.apache.flink.util.Preconditions; +import org.apache.flink.connector.jdbc.core.util.Precondition; import java.io.Serializable; @@ -31,7 +31,7 @@ public class CompositeJdbcParameterValuesProvider implements JdbcParameterValues public CompositeJdbcParameterValuesProvider( JdbcParameterValuesProvider a, JdbcParameterValuesProvider b) { - Preconditions.checkArgument( + Precondition.checkArgument( a.getParameterValues().length == b.getParameterValues().length, "Both JdbcParameterValuesProvider should have the same length."); this.a = a; diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/split/JdbcNumericBetweenParametersProvider.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/split/JdbcNumericBetweenParametersProvider.java index 617e6c526..2038db20f 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/split/JdbcNumericBetweenParametersProvider.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/split/JdbcNumericBetweenParametersProvider.java @@ -18,7 +18,7 @@ package org.apache.flink.connector.jdbc.split; -import org.apache.flink.util.Preconditions; +import org.apache.flink.connector.jdbc.core.util.Precondition; import java.io.Serializable; @@ -52,7 +52,7 @@ public class JdbcNumericBetweenParametersProvider implements JdbcParameterValues * @param maxVal the upper bound of the produced "to" values */ public JdbcNumericBetweenParametersProvider(long minVal, long maxVal) { - Preconditions.checkArgument(minVal <= maxVal, "minVal must not be larger than maxVal"); + Precondition.checkArgument(minVal <= maxVal, "minVal must not be larger than maxVal"); this.minVal = minVal; this.maxVal = maxVal; } @@ -65,14 +65,14 @@ public JdbcNumericBetweenParametersProvider(long minVal, long maxVal) { * @param maxVal the upper bound of the produced "to" values */ public JdbcNumericBetweenParametersProvider(long fetchSize, long minVal, long maxVal) { - Preconditions.checkArgument(minVal <= maxVal, "minVal must not be larger than maxVal"); + Precondition.checkArgument(minVal <= maxVal, "minVal must not be larger than maxVal"); this.minVal = minVal; this.maxVal = maxVal; ofBatchSize(fetchSize); } public JdbcNumericBetweenParametersProvider ofBatchSize(long batchSize) { - Preconditions.checkArgument(batchSize > 0, "Batch size must be positive"); + Precondition.checkArgument(batchSize > 0, "Batch size must be positive"); long maxElemCount = (maxVal - minVal) + 1; if (batchSize > maxElemCount) { @@ -84,7 +84,7 @@ public JdbcNumericBetweenParametersProvider ofBatchSize(long batchSize) { } public JdbcNumericBetweenParametersProvider ofBatchNum(int batchNum) { - Preconditions.checkArgument(batchNum > 0, "Batch number must be positive"); + Precondition.checkArgument(batchNum > 0, "Batch number must be positive"); long maxElemCount = (maxVal - minVal) + 1; if (batchNum > maxElemCount) { @@ -97,7 +97,7 @@ public JdbcNumericBetweenParametersProvider ofBatchNum(int batchNum) { @Override public Serializable[][] getParameterValues() { - Preconditions.checkState( + Precondition.checkState( batchSize > 0, "Batch size and batch number must be positive. Have you called `ofBatchSize` or `ofBatchNum`?"); diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/split/JdbcSlideTimingParameterProvider.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/split/JdbcSlideTimingParameterProvider.java index eae5891ed..e90477086 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/split/JdbcSlideTimingParameterProvider.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/split/JdbcSlideTimingParameterProvider.java @@ -19,7 +19,7 @@ package org.apache.flink.connector.jdbc.split; import org.apache.flink.annotation.PublicEvolving; -import org.apache.flink.util.Preconditions; +import org.apache.flink.connector.jdbc.core.util.Precondition; import javax.annotation.Nonnull; @@ -42,15 +42,15 @@ public JdbcSlideTimingParameterProvider( long slideSpanMills, long slideStepMills, long splitGenerateDelayMillis) { - this.startMills = Preconditions.checkNotNull(startMills); - Preconditions.checkArgument( + this.startMills = Precondition.checkNotNull(startMills); + Precondition.checkArgument( startMills > 0L, "'startMillis' of JdbcSlideTimingParameterProvider must be greater than 0. "); - Preconditions.checkArgument( + Precondition.checkArgument( slideSpanMills > 0 || slideStepMills > 0, "JdbcSlideTimingParameterProvider parameters must satisfy " + "slideSpanMills > 0 and slideStepMills > 0"); - Preconditions.checkArgument( + Precondition.checkArgument( splitGenerateDelayMillis >= 0L, "JdbcSlideTimingParameterProvider parameters must satisfy " + "splitGenerateDelayMillis >= 0"); @@ -73,7 +73,7 @@ public Long getLatestOptionalState() { @Override public void setOptionalState(Serializable optionalState) { - Preconditions.checkArgument((Long) optionalState > 0L); + Precondition.checkArgument((Long) optionalState > 0L); this.startMills = (Long) optionalState; } diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/statement/FieldNamedPreparedStatementImpl.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/statement/FieldNamedPreparedStatementImpl.java index fc05b90bf..61bfded8a 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/statement/FieldNamedPreparedStatementImpl.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/statement/FieldNamedPreparedStatementImpl.java @@ -31,8 +31,8 @@ import java.util.List; import java.util.Map; -import static org.apache.flink.util.Preconditions.checkArgument; -import static org.apache.flink.util.Preconditions.checkNotNull; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkArgument; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkNotNull; /** Simple implementation of {@link FieldNamedPreparedStatement}. */ public class FieldNamedPreparedStatementImpl implements FieldNamedPreparedStatement { diff --git a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/utils/JdbcUtils.java b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/utils/JdbcUtils.java index 53023cd22..8fffd053f 100644 --- a/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/utils/JdbcUtils.java +++ b/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/utils/JdbcUtils.java @@ -20,8 +20,8 @@ import org.apache.flink.configuration.Configuration; import org.apache.flink.configuration.ReadableConfig; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.types.Row; -import org.apache.flink.util.Preconditions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,7 +46,7 @@ public class JdbcUtils { public static Properties getConnectionProperties(ReadableConfig config) { final Properties result = getBriefAuthProperties(config.get(USERNAME), config.get(PASSWORD)); - Preconditions.checkArgument(config instanceof Configuration); + Precondition.checkArgument(config instanceof Configuration); Map configMap = ((Configuration) config).toMap(); configMap.forEach( (k, v) -> { diff --git a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/JdbcITCase.java b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/JdbcITCase.java index 3b4c60e5e..c860a6c84 100644 --- a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/JdbcITCase.java +++ b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/JdbcITCase.java @@ -48,7 +48,7 @@ import static org.apache.flink.connector.jdbc.JdbcTestFixture.INSERT_TEMPLATE; import static org.apache.flink.connector.jdbc.JdbcTestFixture.TEST_DATA; import static org.apache.flink.connector.jdbc.JdbcTestFixture.TestEntry; -import static org.apache.flink.util.Preconditions.checkNotNull; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkNotNull; import static org.assertj.core.api.Assertions.assertThat; /** Smoke tests for the {@link GenericJdbcSinkFunction} and the underlying classes. */ diff --git a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/testutils/tables/TableBase.java b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/testutils/tables/TableBase.java index d8cbd7937..bfff5f2ca 100644 --- a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/testutils/tables/TableBase.java +++ b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/testutils/tables/TableBase.java @@ -21,6 +21,7 @@ import org.apache.flink.api.common.typeinfo.TypeInformation; import org.apache.flink.api.java.typeutils.RowTypeInfo; import org.apache.flink.connector.jdbc.JdbcStatementBuilder; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.connector.jdbc.testutils.DatabaseMetadata; import org.apache.flink.connector.jdbc.testutils.TableManaged; import org.apache.flink.connector.jdbc.testutils.functions.JdbcResultSetBuilder; @@ -33,7 +34,6 @@ import org.apache.flink.table.types.logical.LogicalType; import org.apache.flink.table.types.logical.RowType; import org.apache.flink.table.types.utils.TypeConversions; -import org.apache.flink.util.Preconditions; import org.apache.flink.util.function.FunctionWithException; import java.sql.Connection; @@ -56,8 +56,8 @@ public abstract class TableBase implements TableManaged { private final TableField[] fields; protected TableBase(String name, TableField[] fields) { - Preconditions.checkArgument(name != null && !name.isEmpty(), "Table name must be defined"); - Preconditions.checkArgument( + Precondition.checkArgument(name != null && !name.isEmpty(), "Table name must be defined"); + Precondition.checkArgument( fields != null && fields.length != 0, "Table fields must be defined"); this.name = name; this.fields = fields; diff --git a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/testutils/tables/TableField.java b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/testutils/tables/TableField.java index 97e772162..13166373f 100644 --- a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/testutils/tables/TableField.java +++ b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/testutils/tables/TableField.java @@ -18,8 +18,8 @@ package org.apache.flink.connector.jdbc.testutils.tables; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.table.types.DataType; -import org.apache.flink.util.Preconditions; /** Table field. * */ public class TableField { @@ -29,8 +29,8 @@ public class TableField { private final boolean pkField; protected TableField(String name, DataType dataType, DbType dbType, boolean pkField) { - Preconditions.checkNotNull(name, "Column name can not be null."); - Preconditions.checkNotNull(dataType, "Column data type can not be null."); + Precondition.checkNotNull(name, "Column name can not be null."); + Precondition.checkNotNull(dataType, "Column data type can not be null."); this.name = name; this.dataType = dataType; this.dbType = dbType; diff --git a/flink-connector-jdbc-cratedb/src/main/java/org/apache/flink/connector/jdbc/cratedb/database/catalog/CrateDBCatalog.java b/flink-connector-jdbc-cratedb/src/main/java/org/apache/flink/connector/jdbc/cratedb/database/catalog/CrateDBCatalog.java index 288ac0e7d..e670bd4d0 100644 --- a/flink-connector-jdbc-cratedb/src/main/java/org/apache/flink/connector/jdbc/cratedb/database/catalog/CrateDBCatalog.java +++ b/flink-connector-jdbc-cratedb/src/main/java/org/apache/flink/connector/jdbc/cratedb/database/catalog/CrateDBCatalog.java @@ -19,7 +19,7 @@ package org.apache.flink.connector.jdbc.cratedb.database.catalog; import org.apache.flink.annotation.Internal; -import org.apache.flink.annotation.VisibleForTesting; +import org.apache.flink.connector.jdbc.core.util.VisibleForTest; import org.apache.flink.connector.jdbc.postgres.database.catalog.PostgresCatalog; import org.apache.flink.table.catalog.ObjectPath; import org.apache.flink.table.catalog.exceptions.CatalogException; @@ -57,7 +57,7 @@ public class CrateDBCatalog extends PostgresCatalog { } }; - @VisibleForTesting + @VisibleForTest public CrateDBCatalog( ClassLoader userClassLoader, String catalogName, diff --git a/flink-connector-jdbc-cratedb/src/main/java/org/apache/flink/connector/jdbc/cratedb/database/catalog/CrateDBTablePath.java b/flink-connector-jdbc-cratedb/src/main/java/org/apache/flink/connector/jdbc/cratedb/database/catalog/CrateDBTablePath.java index c0f77cdd3..d3d0c5fab 100644 --- a/flink-connector-jdbc-cratedb/src/main/java/org/apache/flink/connector/jdbc/cratedb/database/catalog/CrateDBTablePath.java +++ b/flink-connector-jdbc-cratedb/src/main/java/org/apache/flink/connector/jdbc/cratedb/database/catalog/CrateDBTablePath.java @@ -21,7 +21,7 @@ import org.apache.flink.annotation.Internal; import org.apache.flink.connector.jdbc.postgres.database.catalog.PostgresTablePath; -import static org.apache.flink.util.Preconditions.checkArgument; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkArgument; /** * Table path of CrateDB in Flink. Can be of formats "table_name" or "schema_name.table_name". When diff --git a/flink-connector-jdbc-mysql/src/main/java/org/apache/flink/connector/jdbc/mysql/database/catalog/MySqlCatalog.java b/flink-connector-jdbc-mysql/src/main/java/org/apache/flink/connector/jdbc/mysql/database/catalog/MySqlCatalog.java index 27bdf93ec..ee78768a7 100644 --- a/flink-connector-jdbc-mysql/src/main/java/org/apache/flink/connector/jdbc/mysql/database/catalog/MySqlCatalog.java +++ b/flink-connector-jdbc-mysql/src/main/java/org/apache/flink/connector/jdbc/mysql/database/catalog/MySqlCatalog.java @@ -19,14 +19,14 @@ package org.apache.flink.connector.jdbc.mysql.database.catalog; import org.apache.flink.annotation.Internal; -import org.apache.flink.annotation.VisibleForTesting; import org.apache.flink.connector.jdbc.core.database.catalog.AbstractJdbcCatalog; import org.apache.flink.connector.jdbc.core.database.catalog.JdbcCatalogTypeMapper; +import org.apache.flink.connector.jdbc.core.util.Precondition; +import org.apache.flink.connector.jdbc.core.util.VisibleForTest; import org.apache.flink.table.catalog.ObjectPath; import org.apache.flink.table.catalog.exceptions.CatalogException; import org.apache.flink.table.catalog.exceptions.DatabaseNotExistException; import org.apache.flink.table.types.DataType; -import org.apache.flink.util.Preconditions; import org.apache.flink.util.TemporaryClassLoaderContext; import org.apache.commons.lang3.StringUtils; @@ -64,7 +64,7 @@ public class MySqlCatalog extends AbstractJdbcCatalog { } }; - @VisibleForTesting + @VisibleForTest public MySqlCatalog( ClassLoader userClassLoader, String catalogName, @@ -89,9 +89,9 @@ public MySqlCatalog( super(userClassLoader, catalogName, defaultDatabase, baseUrl, connectionProperties); String driverVersion = - Preconditions.checkNotNull(getDriverVersion(), "Driver version must not be null."); + Precondition.checkNotNull(getDriverVersion(), "Driver version must not be null."); String databaseVersion = - Preconditions.checkNotNull( + Precondition.checkNotNull( getDatabaseVersion(), "Database version must not be null."); LOG.info("Driver version: {}, database version: {}", driverVersion, databaseVersion); this.dialectTypeMapper = new MySqlTypeMapper(databaseVersion, driverVersion); @@ -111,7 +111,7 @@ public List listDatabases() throws CatalogException { @Override public List listTables(String databaseName) throws DatabaseNotExistException, CatalogException { - Preconditions.checkState( + Precondition.checkState( StringUtils.isNotBlank(databaseName), "Database name must not be blank."); if (!databaseExists(databaseName)) { throw new DatabaseNotExistException(getName(), databaseName); diff --git a/flink-connector-jdbc-mysql/src/test/java/org/apache/flink/connector/jdbc/mysql/testutils/MySqlContainer.java b/flink-connector-jdbc-mysql/src/test/java/org/apache/flink/connector/jdbc/mysql/testutils/MySqlContainer.java index f100886f9..8ab34c6d6 100644 --- a/flink-connector-jdbc-mysql/src/test/java/org/apache/flink/connector/jdbc/mysql/testutils/MySqlContainer.java +++ b/flink-connector-jdbc-mysql/src/test/java/org/apache/flink/connector/jdbc/mysql/testutils/MySqlContainer.java @@ -31,7 +31,7 @@ import java.sql.SQLException; import java.sql.Statement; -import static org.apache.flink.util.Preconditions.checkArgument; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkArgument; /** {@link MySQLContainer} with Xa and LockDB. */ public class MySqlContainer extends MySQLContainer { diff --git a/flink-connector-jdbc-oceanbase/src/main/java/org/apache/flink/connector/jdbc/oceanbase/database/catalog/OceanBaseCatalog.java b/flink-connector-jdbc-oceanbase/src/main/java/org/apache/flink/connector/jdbc/oceanbase/database/catalog/OceanBaseCatalog.java index 384a2c6dd..73e72ee56 100644 --- a/flink-connector-jdbc-oceanbase/src/main/java/org/apache/flink/connector/jdbc/oceanbase/database/catalog/OceanBaseCatalog.java +++ b/flink-connector-jdbc-oceanbase/src/main/java/org/apache/flink/connector/jdbc/oceanbase/database/catalog/OceanBaseCatalog.java @@ -22,13 +22,13 @@ import org.apache.flink.connector.jdbc.core.database.catalog.AbstractJdbcCatalog; import org.apache.flink.connector.jdbc.core.database.catalog.JdbcCatalogTypeMapper; import org.apache.flink.connector.jdbc.core.table.JdbcConnectorOptions; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.connector.jdbc.oceanbase.database.dialect.OceanBaseCompatibleMode; import org.apache.flink.table.catalog.ObjectPath; import org.apache.flink.table.catalog.UniqueConstraint; import org.apache.flink.table.catalog.exceptions.CatalogException; import org.apache.flink.table.catalog.exceptions.DatabaseNotExistException; import org.apache.flink.table.types.DataType; -import org.apache.flink.util.Preconditions; import org.apache.commons.lang3.StringUtils; @@ -105,7 +105,7 @@ public List listDatabases() throws CatalogException { @Override public List listTables(String databaseName) throws DatabaseNotExistException, CatalogException { - Preconditions.checkState( + Precondition.checkState( StringUtils.isNotBlank(databaseName), "Database name must not be blank."); if (!databaseExists(databaseName)) { throw new DatabaseNotExistException(getName(), databaseName); diff --git a/flink-connector-jdbc-postgres/src/main/java/org/apache/flink/connector/jdbc/postgres/database/catalog/PostgresCatalog.java b/flink-connector-jdbc-postgres/src/main/java/org/apache/flink/connector/jdbc/postgres/database/catalog/PostgresCatalog.java index def48d64f..9f181daa8 100644 --- a/flink-connector-jdbc-postgres/src/main/java/org/apache/flink/connector/jdbc/postgres/database/catalog/PostgresCatalog.java +++ b/flink-connector-jdbc-postgres/src/main/java/org/apache/flink/connector/jdbc/postgres/database/catalog/PostgresCatalog.java @@ -19,14 +19,14 @@ package org.apache.flink.connector.jdbc.postgres.database.catalog; import org.apache.flink.annotation.Internal; -import org.apache.flink.annotation.VisibleForTesting; import org.apache.flink.connector.jdbc.core.database.catalog.AbstractJdbcCatalog; import org.apache.flink.connector.jdbc.core.database.catalog.JdbcCatalogTypeMapper; +import org.apache.flink.connector.jdbc.core.util.Precondition; +import org.apache.flink.connector.jdbc.core.util.VisibleForTest; import org.apache.flink.table.catalog.ObjectPath; import org.apache.flink.table.catalog.exceptions.CatalogException; import org.apache.flink.table.catalog.exceptions.DatabaseNotExistException; import org.apache.flink.table.types.DataType; -import org.apache.flink.util.Preconditions; import org.apache.commons.compress.utils.Lists; import org.apache.commons.lang3.StringUtils; @@ -76,7 +76,7 @@ public class PostgresCatalog extends AbstractJdbcCatalog { protected final JdbcCatalogTypeMapper dialectTypeMapper; - @VisibleForTesting + @VisibleForTest public PostgresCatalog( ClassLoader userClassLoader, String catalogName, @@ -181,7 +181,7 @@ protected List getPureTables(Connection conn, List schemas) public List listTables(String databaseName) throws DatabaseNotExistException, CatalogException { - Preconditions.checkState( + Precondition.checkState( StringUtils.isNotBlank(databaseName), "Database name must not be blank."); if (!databaseExists(databaseName)) { throw new DatabaseNotExistException(getName(), databaseName); diff --git a/flink-connector-jdbc-postgres/src/main/java/org/apache/flink/connector/jdbc/postgres/database/catalog/PostgresTablePath.java b/flink-connector-jdbc-postgres/src/main/java/org/apache/flink/connector/jdbc/postgres/database/catalog/PostgresTablePath.java index 57deeec07..867fba92d 100644 --- a/flink-connector-jdbc-postgres/src/main/java/org/apache/flink/connector/jdbc/postgres/database/catalog/PostgresTablePath.java +++ b/flink-connector-jdbc-postgres/src/main/java/org/apache/flink/connector/jdbc/postgres/database/catalog/PostgresTablePath.java @@ -23,7 +23,7 @@ import java.util.Objects; -import static org.apache.flink.util.Preconditions.checkArgument; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkArgument; /** * Table path of PostgresSQL in Flink. Can be of formats "table_name" or "schema_name.table_name". diff --git a/flink-connector-jdbc-postgres/src/test/java/org/apache/flink/connector/jdbc/postgres/testutils/PostgresDatabase.java b/flink-connector-jdbc-postgres/src/test/java/org/apache/flink/connector/jdbc/postgres/testutils/PostgresDatabase.java index 0b871ec41..5c281cb70 100644 --- a/flink-connector-jdbc-postgres/src/test/java/org/apache/flink/connector/jdbc/postgres/testutils/PostgresDatabase.java +++ b/flink-connector-jdbc-postgres/src/test/java/org/apache/flink/connector/jdbc/postgres/testutils/PostgresDatabase.java @@ -26,7 +26,7 @@ import org.testcontainers.containers.PostgreSQLContainer; import org.testcontainers.utility.DockerImageName; -import static org.apache.flink.util.Preconditions.checkArgument; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkArgument; /** A Postgres database for testing. */ public class PostgresDatabase extends DatabaseExtension implements PostgresImages { diff --git a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/catalog/JdbcCatalog.java b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/catalog/JdbcCatalog.java index 08db15da6..6ec060206 100644 --- a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/catalog/JdbcCatalog.java +++ b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/catalog/JdbcCatalog.java @@ -20,8 +20,8 @@ import org.apache.flink.annotation.Internal; import org.apache.flink.annotation.PublicEvolving; -import org.apache.flink.annotation.VisibleForTesting; import org.apache.flink.connector.jdbc.core.database.catalog.AbstractJdbcCatalog; +import org.apache.flink.connector.jdbc.core.util.VisibleForTest; import org.apache.flink.table.catalog.CatalogBaseTable; import org.apache.flink.table.catalog.CatalogDatabase; import org.apache.flink.table.catalog.ObjectPath; @@ -67,7 +67,7 @@ public JdbcCatalog( getBriefAuthProperties(username, pwd)); } - @VisibleForTesting + @VisibleForTest /** * Creates a JdbcCatalog. * @@ -164,7 +164,7 @@ public boolean tableExists(ObjectPath tablePath) throws CatalogException { // ------ getters ------ - @VisibleForTesting + @VisibleForTest @Internal public AbstractJdbcCatalog getInternal() { return internal; diff --git a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/catalog/JdbcCatalogUtils.java b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/catalog/JdbcCatalogUtils.java index 73b7d449c..d73e0d4bd 100644 --- a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/catalog/JdbcCatalogUtils.java +++ b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/catalog/JdbcCatalogUtils.java @@ -30,7 +30,7 @@ import java.util.Properties; import static org.apache.flink.connector.jdbc.JdbcConnectionOptions.getBriefAuthProperties; -import static org.apache.flink.util.Preconditions.checkArgument; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkArgument; /** * Utils for {@link JdbcCatalog}. diff --git a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/sink/JdbcSinkBuilder.java b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/sink/JdbcSinkBuilder.java index da08b9995..19fc099ea 100644 --- a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/sink/JdbcSinkBuilder.java +++ b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/sink/JdbcSinkBuilder.java @@ -34,7 +34,7 @@ import javax.sql.XADataSource; -import static org.apache.flink.util.Preconditions.checkNotNull; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkNotNull; /** * Builder to construct {@link JdbcSink}. diff --git a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/source/JdbcSource.java b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/source/JdbcSource.java index cee58e75c..c5cabda0b 100644 --- a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/source/JdbcSource.java +++ b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/source/JdbcSource.java @@ -19,7 +19,6 @@ package org.apache.flink.connector.jdbc.source; import org.apache.flink.annotation.PublicEvolving; -import org.apache.flink.annotation.VisibleForTesting; import org.apache.flink.api.common.typeinfo.TypeInformation; import org.apache.flink.api.connector.source.Boundedness; import org.apache.flink.api.connector.source.Source; @@ -39,10 +38,11 @@ import org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor; import org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplit; import org.apache.flink.connector.jdbc.core.datastream.source.split.JdbcSourceSplitSerializer; +import org.apache.flink.connector.jdbc.core.util.Precondition; +import org.apache.flink.connector.jdbc.core.util.VisibleForTest; import org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider; import org.apache.flink.connector.jdbc.utils.ContinuousUnBoundingSettings; import org.apache.flink.core.io.SimpleVersionedSerializer; -import org.apache.flink.util.Preconditions; import javax.annotation.Nullable; @@ -80,13 +80,13 @@ public class JdbcSource TypeInformation typeInformation, @Nullable DeliveryGuarantee deliveryGuarantee, @Nullable ContinuousUnBoundingSettings continuousUnBoundingSettings) { - this.configuration = Preconditions.checkNotNull(configuration); - this.connectionProvider = Preconditions.checkNotNull(connectionProvider); - this.sqlSplitEnumeratorProvider = Preconditions.checkNotNull(sqlSplitEnumeratorProvider); - this.resultExtractor = Preconditions.checkNotNull(resultExtractor); + this.configuration = Precondition.checkNotNull(configuration); + this.connectionProvider = Precondition.checkNotNull(connectionProvider); + this.sqlSplitEnumeratorProvider = Precondition.checkNotNull(sqlSplitEnumeratorProvider); + this.resultExtractor = Precondition.checkNotNull(resultExtractor); this.deliveryGuarantee = Objects.isNull(deliveryGuarantee) ? DeliveryGuarantee.NONE : deliveryGuarantee; - this.typeInformation = Preconditions.checkNotNull(typeInformation); + this.typeInformation = Precondition.checkNotNull(typeInformation); this.continuousUnBoundingSettings = continuousUnBoundingSettings; this.boundedness = Objects.isNull(continuousUnBoundingSettings) @@ -161,27 +161,27 @@ public static JdbcSourceBuilder builder() { // ---- Visible for testing methods. --- - @VisibleForTesting + @VisibleForTest public JdbcSqlSplitEnumeratorBase.Provider getSqlSplitEnumeratorProvider() { return sqlSplitEnumeratorProvider; } - @VisibleForTesting + @VisibleForTest public TypeInformation getTypeInformation() { return typeInformation; } - @VisibleForTesting + @VisibleForTest public Configuration getConfiguration() { return configuration; } - @VisibleForTesting + @VisibleForTest public ResultExtractor getResultExtractor() { return resultExtractor; } - @VisibleForTesting + @VisibleForTest @Override public boolean equals(Object o) { if (this == o) { diff --git a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/source/JdbcSourceBuilder.java b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/source/JdbcSourceBuilder.java index a19315846..8c174258a 100644 --- a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/source/JdbcSourceBuilder.java +++ b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/source/JdbcSourceBuilder.java @@ -26,13 +26,13 @@ import org.apache.flink.connector.jdbc.core.datastream.source.JdbcSourceOptions; import org.apache.flink.connector.jdbc.core.datastream.source.enumerator.SqlTemplateSplitEnumerator; import org.apache.flink.connector.jdbc.core.datastream.source.reader.extractor.ResultExtractor; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.connector.jdbc.datasource.connections.JdbcConnectionProvider; import org.apache.flink.connector.jdbc.datasource.connections.SimpleJdbcConnectionProvider; import org.apache.flink.connector.jdbc.split.JdbcParameterValuesProvider; import org.apache.flink.connector.jdbc.split.JdbcSlideTimingParameterProvider; import org.apache.flink.connector.jdbc.utils.ContinuousUnBoundingSettings; import org.apache.flink.types.Row; -import org.apache.flink.util.Preconditions; import org.apache.flink.util.StringUtils; import org.slf4j.Logger; @@ -136,7 +136,7 @@ public class JdbcSourceBuilder { } public JdbcSourceBuilder setSql(@Nonnull String sql) { - Preconditions.checkArgument( + Precondition.checkArgument( !StringUtils.isNullOrWhitespaceOnly(sql), "It's required to set the 'sql' with non-empty value."); this.sql = sql; @@ -145,7 +145,7 @@ public JdbcSourceBuilder setSql(@Nonnull String sql) { public JdbcSourceBuilder setResultExtractor(ResultExtractor resultExtractor) { this.resultExtractor = - Preconditions.checkNotNull( + Precondition.checkNotNull( resultExtractor, "It's required to set the 'resultExtractor'."); return this; } @@ -161,7 +161,7 @@ public JdbcSourceBuilder setPassword(String password) { } public JdbcSourceBuilder setDriverName(String driverName) { - Preconditions.checkArgument( + Precondition.checkArgument( !StringUtils.isNullOrWhitespaceOnly(driverName), "It's required to set the 'driverName'."); connOptionsBuilder.withDriverName(driverName); @@ -169,7 +169,7 @@ public JdbcSourceBuilder setDriverName(String driverName) { } public JdbcSourceBuilder setDBUrl(String dbURL) { - Preconditions.checkArgument( + Precondition.checkArgument( !StringUtils.isNullOrWhitespaceOnly(dbURL), "It's required to set the 'dbURL'."); connOptionsBuilder.withUrl(dbURL); return this; @@ -178,7 +178,7 @@ public JdbcSourceBuilder setDBUrl(String dbURL) { public JdbcSourceBuilder setTypeInformation( @Nonnull TypeInformation typeInformation) { this.typeInformation = - Preconditions.checkNotNull( + Precondition.checkNotNull( typeInformation, "It's required to set the 'typeInformation'."); return this; } @@ -202,12 +202,12 @@ public JdbcSourceBuilder setContinuousUnBoundingSettings( */ public JdbcSourceBuilder setJdbcParameterValuesProvider( @Nonnull JdbcParameterValuesProvider parameterValuesProvider) { - this.jdbcParameterValuesProvider = Preconditions.checkNotNull(parameterValuesProvider); + this.jdbcParameterValuesProvider = Precondition.checkNotNull(parameterValuesProvider); return this; } public JdbcSourceBuilder setDeliveryGuarantee(DeliveryGuarantee deliveryGuarantee) { - this.deliveryGuarantee = Preconditions.checkNotNull(deliveryGuarantee); + this.deliveryGuarantee = Precondition.checkNotNull(deliveryGuarantee); return this; } @@ -218,14 +218,14 @@ public JdbcSourceBuilder setConnectionCheckTimeoutSeconds( } public JdbcSourceBuilder setConnectionProperty(String propKey, String propVal) { - Preconditions.checkNotNull(propKey, "Connection property key mustn't be null"); - Preconditions.checkNotNull(propVal, "Connection property value mustn't be null"); + Precondition.checkNotNull(propKey, "Connection property key mustn't be null"); + Precondition.checkNotNull(propVal, "Connection property value mustn't be null"); connOptionsBuilder.withProperty(propKey, propVal); return this; } public JdbcSourceBuilder setSplitReaderFetchBatchSize(int splitReaderFetchBatchSize) { - Preconditions.checkArgument( + Precondition.checkArgument( splitReaderFetchBatchSize > 0, "'splitReaderFetchBatchSize' must be in range (0, %s]", Integer.MAX_VALUE); @@ -249,7 +249,7 @@ public JdbcSourceBuilder setAutoCommit(boolean autoCommit) { } public JdbcSourceBuilder setResultSetFetchSize(int resultSetFetchSize) { - Preconditions.checkArgument( + Precondition.checkArgument( resultSetFetchSize == Integer.MIN_VALUE || resultSetFetchSize > 0, "Illegal value %s for fetchSize, has to be positive or Integer.MIN_VALUE.", resultSetFetchSize); @@ -259,7 +259,7 @@ public JdbcSourceBuilder setResultSetFetchSize(int resultSetFetchSize) { public JdbcSourceBuilder setConnectionProvider( @Nonnull JdbcConnectionProvider connectionProvider) { - this.connectionProvider = Preconditions.checkNotNull(connectionProvider); + this.connectionProvider = Precondition.checkNotNull(connectionProvider); return this; } @@ -276,7 +276,7 @@ public JdbcSource build() { } if (deliveryGuarantee == DeliveryGuarantee.EXACTLY_ONCE) { - Preconditions.checkArgument( + Precondition.checkArgument( this.resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE || this.resultSetType == ResultSet.CONCUR_READ_ONLY, "The 'resultSetType' must be ResultSet.TYPE_SCROLL_INSENSITIVE or ResultSet.CONCUR_READ_ONLY when using %s", @@ -289,13 +289,13 @@ public JdbcSource build() { JdbcSourceOptions.READER_FETCH_BATCH_SIZE, splitReaderFetchBatchSize); this.configuration.set(JdbcSourceOptions.AUTO_COMMIT, autoCommit); - Preconditions.checkState( + Precondition.checkState( !StringUtils.isNullOrWhitespaceOnly(sql), "'sql' mustn't be null or empty."); - Preconditions.checkNotNull(resultExtractor, "'resultExtractor' mustn't be null."); - Preconditions.checkNotNull(typeInformation, "'typeInformation' mustn't be null."); + Precondition.checkNotNull(resultExtractor, "'resultExtractor' mustn't be null."); + Precondition.checkNotNull(typeInformation, "'typeInformation' mustn't be null."); if (Objects.nonNull(continuousUnBoundingSettings)) { - Preconditions.checkArgument( + Precondition.checkArgument( Objects.nonNull(jdbcParameterValuesProvider) && jdbcParameterValuesProvider instanceof JdbcSlideTimingParameterProvider, @@ -304,7 +304,7 @@ public JdbcSource build() { if (Objects.nonNull(jdbcParameterValuesProvider) && jdbcParameterValuesProvider instanceof JdbcSlideTimingParameterProvider) { - Preconditions.checkArgument( + Precondition.checkArgument( Objects.nonNull(continuousUnBoundingSettings), INVALID_CONTINUOUS_SLIDE_TIMING_HINT); } diff --git a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/xa/CheckpointAndXid.java b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/xa/CheckpointAndXid.java index 6ce597387..40b0f5b61 100644 --- a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/xa/CheckpointAndXid.java +++ b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/xa/CheckpointAndXid.java @@ -18,7 +18,7 @@ package org.apache.flink.connector.jdbc.xa; import org.apache.flink.annotation.Internal; -import org.apache.flink.util.Preconditions; +import org.apache.flink.connector.jdbc.core.util.Precondition; import javax.annotation.concurrent.ThreadSafe; import javax.transaction.xa.Xid; @@ -44,7 +44,7 @@ public Xid getXid() { private CheckpointAndXid(long checkpointId, Xid xid, int attempts, boolean restored) { this.checkpointId = checkpointId; - this.xid = Preconditions.checkNotNull(xid); + this.xid = Precondition.checkNotNull(xid); this.attempts = attempts; this.restored = restored; } diff --git a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/xa/JdbcXaSinkFunction.java b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/xa/JdbcXaSinkFunction.java index b88eddb5f..81b8b40ed 100644 --- a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/xa/JdbcXaSinkFunction.java +++ b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/xa/JdbcXaSinkFunction.java @@ -28,6 +28,7 @@ import org.apache.flink.connector.jdbc.JdbcExactlyOnceOptions; import org.apache.flink.connector.jdbc.JdbcExecutionOptions; import org.apache.flink.connector.jdbc.JdbcStatementBuilder; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.connector.jdbc.internal.JdbcOutputFormat; import org.apache.flink.connector.jdbc.internal.JdbcOutputSerializer; import org.apache.flink.connector.jdbc.internal.executor.JdbcBatchStatementExecutor; @@ -37,7 +38,6 @@ import org.apache.flink.streaming.api.checkpoint.CheckpointedFunction; import org.apache.flink.streaming.api.functions.sink.SinkFunction; import org.apache.flink.util.ExceptionUtils; -import org.apache.flink.util.Preconditions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -199,16 +199,16 @@ public JdbcXaSinkFunction( JdbcExactlyOnceOptions options, XaGroupOps xaGroupOps) { - Preconditions.checkArgument( + Precondition.checkArgument( outputFormat.getExecutionOptions().getMaxRetries() == 0, "JDBC XA sink requires maxRetries equal to 0, otherwise it could " + "cause duplicates. See issue FLINK-22311 for details."); - this.xaFacade = Preconditions.checkNotNull(xaFacade); - this.xidGenerator = Preconditions.checkNotNull(xidGenerator); - this.outputFormat = Preconditions.checkNotNull(outputFormat); - this.stateHandler = Preconditions.checkNotNull(stateHandler); - this.options = Preconditions.checkNotNull(options); + this.xaFacade = Precondition.checkNotNull(xaFacade); + this.xidGenerator = Precondition.checkNotNull(xidGenerator); + this.outputFormat = Precondition.checkNotNull(outputFormat); + this.stateHandler = Precondition.checkNotNull(stateHandler); + this.options = Precondition.checkNotNull(options); this.xaGroupOps = xaGroupOps; } @@ -261,7 +261,7 @@ public void notifyCheckpointComplete(long checkpointId) { @Override public void invoke(T value, Context context) throws IOException { - Preconditions.checkState(currentXid != null, "current xid must not be null"); + Precondition.checkState(currentXid != null, "current xid must not be null"); if (LOG.isTraceEnabled()) { LOG.trace("invoke, xid: {}, value: {}", currentXid, value); } @@ -288,8 +288,8 @@ public void close() throws Exception { } private void prepareCurrentTx(long checkpointId) throws IOException { - Preconditions.checkState(currentXid != null, "no current xid"); - Preconditions.checkState( + Precondition.checkState(currentXid != null, "no current xid"); + Precondition.checkState( !hangingXids.isEmpty() && hangingXids.peekLast().equals(currentXid), "inconsistent internal state"); hangingXids.pollLast(); @@ -310,7 +310,7 @@ private void prepareCurrentTx(long checkpointId) throws IOException { /** @param checkpointId to associate with the new transaction. */ private void beginTx(long checkpointId) throws Exception { - Preconditions.checkState(currentXid == null, "currentXid not null"); + Precondition.checkState(currentXid == null, "currentXid not null"); currentXid = xidGenerator.generateXid(JobSubtask.of(getRuntimeContext()), checkpointId); hangingXids.offerLast(currentXid); xaFacade.start(currentXid); diff --git a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/xa/XaFacadeImpl.java b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/xa/XaFacadeImpl.java index 606f6c2f0..13e02d72b 100644 --- a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/xa/XaFacadeImpl.java +++ b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/xa/XaFacadeImpl.java @@ -18,9 +18,9 @@ package org.apache.flink.connector.jdbc.xa; import org.apache.flink.annotation.Internal; -import org.apache.flink.annotation.VisibleForTesting; +import org.apache.flink.connector.jdbc.core.util.Precondition; +import org.apache.flink.connector.jdbc.core.util.VisibleForTest; import org.apache.flink.util.FlinkRuntimeException; -import org.apache.flink.util.Preconditions; import org.apache.flink.util.function.ThrowingRunnable; import org.slf4j.Logger; @@ -82,19 +82,19 @@ class XaFacadeImpl implements XaFacade { private transient Connection connection; private transient XAConnection xaConnection; - @VisibleForTesting + @VisibleForTest static XaFacadeImpl fromXaDataSource(XADataSource ds) { return new XaFacadeImpl(() -> ds, null); } XaFacadeImpl(Supplier dataSourceSupplier, Integer timeoutSec) { - this.dataSourceSupplier = Preconditions.checkNotNull(dataSourceSupplier); + this.dataSourceSupplier = Precondition.checkNotNull(dataSourceSupplier); this.timeoutSec = timeoutSec; } @Override public void open() throws SQLException { - Preconditions.checkState(!isOpen(), "already connected"); + Precondition.checkState(!isOpen(), "already connected"); XADataSource ds = dataSourceSupplier.get(); xaConnection = ds.getXAConnection(); xaResource = xaConnection.getXAResource(); @@ -108,7 +108,7 @@ public void open() throws SQLException { connection = xaConnection.getConnection(); connection.setReadOnly(false); connection.setAutoCommit(false); - Preconditions.checkState(!connection.getAutoCommit()); + Precondition.checkState(!connection.getAutoCommit()); } @Override @@ -135,7 +135,7 @@ public void close() throws SQLException { @Override public Connection getConnection() { - Preconditions.checkNotNull(connection); + Precondition.checkNotNull(connection); return connection; } @@ -248,7 +248,7 @@ public Collection recover() { for (int i = 0; list.addAll(recover(TMNOFLAGS)); i++) { // H2 sometimes returns same tx list here - should probably use // recover(TMSTARTRSCAN | TMENDRSCAN) - Preconditions.checkState( + Precondition.checkState( i < MAX_RECOVER_CALLS, "too many xa_recover() calls"); } } finally { @@ -268,7 +268,7 @@ private List recover(int flags) throws XAException { } private T execute(Command cmd) throws FlinkRuntimeException { - Preconditions.checkState(isOpen(), "not connected"); + Precondition.checkState(isOpen(), "not connected"); LOG.debug("{}, xid={}", cmd.name, cmd.xid); try { T result = cmd.callable.call(); diff --git a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/xa/XaFacadePoolingImpl.java b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/xa/XaFacadePoolingImpl.java index 2dbb69362..64aeea79a 100644 --- a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/xa/XaFacadePoolingImpl.java +++ b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/xa/XaFacadePoolingImpl.java @@ -36,8 +36,8 @@ import java.util.Map; import java.util.function.Supplier; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkState; import static org.apache.flink.util.ExceptionUtils.rethrow; -import static org.apache.flink.util.Preconditions.checkState; /** * A "pooling" implementation of {@link XaFacade}. Some database implement XA such that one diff --git a/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/xa/JdbcExactlyOnceSinkE2eTest.java b/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/xa/JdbcExactlyOnceSinkE2eTest.java index f27cba56b..57418ee34 100644 --- a/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/xa/JdbcExactlyOnceSinkE2eTest.java +++ b/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/xa/JdbcExactlyOnceSinkE2eTest.java @@ -66,9 +66,9 @@ import static org.apache.flink.api.common.restartstrategy.RestartStrategies.fixedDelayRestart; import static org.apache.flink.configuration.JobManagerOptions.EXECUTION_FAILOVER_STRATEGY; import static org.apache.flink.configuration.TaskManagerOptions.TASK_CANCELLATION_TIMEOUT; +import static org.apache.flink.connector.jdbc.core.util.Precondition.checkState; import static org.apache.flink.connector.jdbc.xa.JdbcXaFacadeTestHelper.getInsertedIds; import static org.apache.flink.streaming.api.environment.ExecutionCheckpointingOptions.CHECKPOINTING_TIMEOUT; -import static org.apache.flink.util.Preconditions.checkState; import static org.assertj.core.api.Assertions.assertThat; /** A simple end-to-end test for {@link JdbcXaSinkFunction}. */ diff --git a/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/xa/JdbcXaSinkMigrationTest.java b/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/xa/JdbcXaSinkMigrationTest.java index 5b4ac2940..293fed305 100644 --- a/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/xa/JdbcXaSinkMigrationTest.java +++ b/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/xa/JdbcXaSinkMigrationTest.java @@ -22,11 +22,11 @@ import org.apache.flink.connector.jdbc.JdbcTestBase; import org.apache.flink.connector.jdbc.JdbcTestFixture; import org.apache.flink.connector.jdbc.JdbcTestFixture.TestEntry; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.connector.jdbc.derby.DerbyTestBase; import org.apache.flink.runtime.checkpoint.OperatorSubtaskState; import org.apache.flink.streaming.api.operators.StreamSink; import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness; -import org.apache.flink.util.Preconditions; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Disabled; @@ -170,7 +170,7 @@ private void writeSnapshot(FlinkVersion flinkVersion) throws Exception { String path = getSnapshotPath(flinkVersion); // Files.createFile(Paths.get(path));/ - Preconditions.checkArgument( + Precondition.checkArgument( !Files.exists(Paths.get(path)), String.format("snapshot for version %s already exist: %s", flinkVersion, path)); initSchema(getMetadata()); diff --git a/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/xa/JdbcXaSinkTestHelper.java b/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/xa/JdbcXaSinkTestHelper.java index 81bee7d2b..f5e0ceb13 100644 --- a/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/xa/JdbcXaSinkTestHelper.java +++ b/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/xa/JdbcXaSinkTestHelper.java @@ -19,8 +19,8 @@ import org.apache.flink.connector.jdbc.JdbcTestCheckpoint; import org.apache.flink.connector.jdbc.JdbcTestFixture.TestEntry; +import org.apache.flink.connector.jdbc.core.util.Precondition; import org.apache.flink.runtime.state.FunctionSnapshotContext; -import org.apache.flink.util.Preconditions; import static org.apache.flink.connector.jdbc.JdbcTestFixture.TEST_DATA; import static org.apache.flink.connector.jdbc.xa.JdbcXaSinkTestBase.TEST_SINK_CONTEXT; @@ -32,8 +32,8 @@ class JdbcXaSinkTestHelper implements AutoCloseable { private final XaSinkStateHandler state; JdbcXaSinkTestHelper(JdbcXaSinkFunction sink, XaSinkStateHandler stateHandler) { - this.sink = Preconditions.checkNotNull(sink); - this.state = Preconditions.checkNotNull(stateHandler); + this.sink = Precondition.checkNotNull(sink); + this.state = Precondition.checkNotNull(stateHandler); } void emitAndCheckpoint(JdbcTestCheckpoint cp) throws Exception {