You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by to...@apache.org on 2022/11/14 12:10:48 UTC
[shardingsphere] branch master updated: Remove uncompleted sql builder (#22172)
This is an automated email from the ASF dual-hosted git repository.
totalo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 6529f119ec8 Remove uncompleted sql builder (#22172)
6529f119ec8 is described below
commit 6529f119ec8b3635e26455c7fe94464a6895b1a4
Author: Hongsheng Zhong <zh...@apache.org>
AuthorDate: Mon Nov 14 20:10:42 2022 +0800
Remove uncompleted sql builder (#22172)
* Remove uncompleted sql builder
* Update doc
---
.../shardingsphere-proxy/migration/build.cn.md | 2 +-
.../shardingsphere-proxy/migration/build.en.md | 2 +-
.../core/sqlbuilder/OraclePipelineSQLBuilder.java | 76 ----------------------
...data.pipeline.spi.sqlbuilder.PipelineSQLBuilder | 1 -
.../sqlbuilder/PipelineSQLBuilderFactoryTest.java | 2 +-
5 files changed, 3 insertions(+), 80 deletions(-)
diff --git a/docs/document/content/user-manual/shardingsphere-proxy/migration/build.cn.md b/docs/document/content/user-manual/shardingsphere-proxy/migration/build.cn.md
index d94255052f1..5f812670cd1 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/migration/build.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/migration/build.cn.md
@@ -59,7 +59,7 @@ proxy 已包含 PostgreSQL JDBC 驱动。
| MySQL | [mysql-connector-java-5.1.47.jar]( https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar ) | [Connector/J Versions]( https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-versions.html ) |
| openGauss | [opengauss-jdbc-3.0.0.jar]( https://repo1.maven.org/maven2/org/opengauss/opengauss-jdbc/3.0.0/opengauss-jdbc-3.0.0.jar ) | |
-如果是异构迁移,源端支持范围更广的数据库,比如:Oracle。JDBC 驱动处理方式同上。
+如果是异构迁移,源端支持范围更广的数据库。JDBC 驱动处理方式同上。
5. 启动 ShardingSphere-Proxy:
diff --git a/docs/document/content/user-manual/shardingsphere-proxy/migration/build.en.md b/docs/document/content/user-manual/shardingsphere-proxy/migration/build.en.md
index 9cdad83a666..cc389c6169e 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/migration/build.en.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/migration/build.en.md
@@ -59,7 +59,7 @@ If the backend is connected to the following databases, download the correspondi
| MySQL | [mysql-connector-java-5.1.47.jar]( https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar ) | [Connector/J Versions]( https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-versions.html ) |
| openGauss | [opengauss-jdbc-3.0.0.jar]( https://repo1.maven.org/maven2/org/opengauss/opengauss-jdbc/3.0.0/opengauss-jdbc-3.0.0.jar ) | |
-If you are migrating to a heterogeneous database, then you could use more types of database, e.g. Oracle. Introduce JDBC driver as above too.
+If you are migrating to a heterogeneous database, then you could use more types of database. Introduce JDBC driver as above too.
5. Start ShardingSphere-Proxy:
diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/sqlbuilder/OraclePipelineSQLBuilder.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/sqlbuilder/OraclePipelineSQLBuilder.java
deleted file mode 100644
index 601f650b30d..00000000000
--- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/sqlbuilder/OraclePipelineSQLBuilder.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.shardingsphere.data.pipeline.core.sqlbuilder;
-
-import lombok.NonNull;
-import org.apache.shardingsphere.data.pipeline.api.ingest.record.DataRecord;
-
-/**
- * Oracle pipeline SQL builder.
- */
-public final class OraclePipelineSQLBuilder extends AbstractPipelineSQLBuilder {
-
- @Override
- public String buildDivisibleInventoryDumpSQL(final String schemaName, final String tableName, final String uniqueKey, final int uniqueKeyDataType, final boolean firstQuery) {
- String qualifiedTableName = getQualifiedTableName(schemaName, tableName);
- String quotedUniqueKey = quote(uniqueKey);
- return String.format("SELECT * FROM (SELECT * FROM %s WHERE %s%s? AND %s<=? ORDER BY %s ASC) WHERE ROWNUM<=?",
- qualifiedTableName, quotedUniqueKey, firstQuery ? ">=" : ">", quotedUniqueKey, quotedUniqueKey);
- }
-
- @Override
- public String buildIndivisibleInventoryDumpSQL(final String schemaName, final String tableName, final String uniqueKey, final int uniqueKeyDataType, final boolean firstQuery) {
- String qualifiedTableName = getQualifiedTableName(schemaName, tableName);
- String quotedUniqueKey = quote(uniqueKey);
- return String.format("SELECT * FROM (SELECT * FROM %s WHERE %s%s? ORDER BY %s ASC) WHERE ROWNUM<=?", qualifiedTableName, quotedUniqueKey, firstQuery ? ">=" : ">", quotedUniqueKey);
- }
-
- @Override
- public String buildInsertSQL(final String schemaName, final DataRecord dataRecord) {
- return super.buildInsertSQL(schemaName, dataRecord);
- // TODO buildInsertSQL and buildConflictSQL, need 2 round parameters set
- // TODO refactor PipelineSQLBuilder to combine SQL building and parameters set
- }
-
- @Override
- public String buildChunkedQuerySQL(final String schemaName, final @NonNull String tableName, final @NonNull String uniqueKey, final boolean firstQuery) {
- String qualifiedTableName = getQualifiedTableName(schemaName, tableName);
- String quotedUniqueKey = quote(uniqueKey);
- return firstQuery
- ? String.format("SELECT * FROM (SELECT * FROM %s ORDER BY %s ASC) WHERE ROWNUM<=?", qualifiedTableName, quotedUniqueKey)
- : String.format("SELECT * FROM (SELECT * FROM %s WHERE %s>? ORDER BY %s ASC) WHERE ROWNUM<=?", qualifiedTableName, quotedUniqueKey, quotedUniqueKey);
- }
-
- @Override
- public String buildCheckEmptySQL(final String schemaName, final String tableName) {
- return String.format("SELECT * FROM (SELECT * FROM %s) WHERE ROWNUM<=1", getQualifiedTableName(schemaName, tableName));
- }
-
- @Override
- public String buildSplitByPrimaryKeyRangeSQL(final String schemaName, final String tableName, final String primaryKey) {
- String qualifiedTableName = getQualifiedTableName(schemaName, tableName);
- String quotedUniqueKey = quote(primaryKey);
- return String.format("SELECT MAX(%s), COUNT(1) FROM (SELECT * FROM (SELECT %s FROM %s WHERE %s>=? ORDER BY %s) WHERE ROWNUM<=?) t",
- quotedUniqueKey, quotedUniqueKey, qualifiedTableName, quotedUniqueKey, quotedUniqueKey);
- }
-
- @Override
- public String getType() {
- return "Oracle";
- }
-}
diff --git a/kernel/data-pipeline/core/src/main/resources/META-INF/services/org.apache.shardingsphere.data.pipeline.spi.sqlbuilder.PipelineSQLBuilder b/kernel/data-pipeline/core/src/main/resources/META-INF/services/org.apache.shardingsphere.data.pipeline.spi.sqlbuilder.PipelineSQLBuilder
index ea00b5cb926..3ca94cb5097 100644
--- a/kernel/data-pipeline/core/src/main/resources/META-INF/services/org.apache.shardingsphere.data.pipeline.spi.sqlbuilder.PipelineSQLBuilder
+++ b/kernel/data-pipeline/core/src/main/resources/META-INF/services/org.apache.shardingsphere.data.pipeline.spi.sqlbuilder.PipelineSQLBuilder
@@ -15,5 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.data.pipeline.core.sqlbuilder.OraclePipelineSQLBuilder
org.apache.shardingsphere.data.pipeline.core.sqlbuilder.DefaultPipelineSQLBuilder
diff --git a/test/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/core/sqlbuilder/PipelineSQLBuilderFactoryTest.java b/test/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/core/sqlbuilder/PipelineSQLBuilderFactoryTest.java
index 4e1a3e9cb01..6af49ddeb8e 100644
--- a/test/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/core/sqlbuilder/PipelineSQLBuilderFactoryTest.java
+++ b/test/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/core/sqlbuilder/PipelineSQLBuilderFactoryTest.java
@@ -36,7 +36,7 @@ public final class PipelineSQLBuilderFactoryTest {
public void assertGetInstance() {
Collection<Pair<String, Class<? extends PipelineSQLBuilder>>> paramResult = Arrays.asList(
Pair.of("MySQL", MySQLPipelineSQLBuilder.class), Pair.of("PostgreSQL", PostgreSQLPipelineSQLBuilder.class),
- Pair.of("openGauss", OpenGaussPipelineSQLBuilder.class), Pair.of("Oracle", OraclePipelineSQLBuilder.class),
+ Pair.of("openGauss", OpenGaussPipelineSQLBuilder.class),
Pair.of("DB2", DefaultPipelineSQLBuilder.class));
for (Pair<String, Class<? extends PipelineSQLBuilder>> each : paramResult) {
PipelineSQLBuilder actual = PipelineSQLBuilderFactory.getInstance(each.getKey());