2.2.2243.1.0-og2.4.2
@@ -453,11 +452,6 @@
${mssql.version}test
-
- org.apache.hbase
- hbase-shaded-client
- ${hbase.client.version}
- org.opengaussopengauss-jdbc
diff --git a/proxy/backend/type/hbase/pom.xml b/proxy/backend/type/hbase/pom.xml
deleted file mode 100644
index bd4227f3e44bf..0000000000000
--- a/proxy/backend/type/hbase/pom.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
- 4.0.0
-
- org.apache.shardingsphere
- shardingsphere-proxy-backend-type
- 5.5.1-SNAPSHOT
-
- shardingsphere-proxy-backend-hbase
- ${project.artifactId}
-
-
-
- org.apache.shardingsphere
- shardingsphere-infra-util
- ${project.version}
-
-
- org.apache.shardingsphere
- shardingsphere-infra-executor
- ${project.version}
-
-
-
- org.apache.shardingsphere
- shardingsphere-proxy-backend-core
- ${project.version}
- compile
-
-
-
- org.apache.shardingsphere
- shardingsphere-test-util
- ${project.version}
- test
-
-
-
- org.apache.hbase
- hbase-shaded-client
-
-
-
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/bean/HBaseCluster.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/bean/HBaseCluster.java
deleted file mode 100644
index 993b87e3f5398..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/bean/HBaseCluster.java
+++ /dev/null
@@ -1,34 +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.proxy.backend.hbase.bean;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.hadoop.hbase.client.Connection;
-
-/**
- * HBase cluster.
- */
-@RequiredArgsConstructor
-@Getter
-public final class HBaseCluster {
-
- private final String clusterName;
-
- private final Connection connection;
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/bean/HBaseOperation.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/bean/HBaseOperation.java
deleted file mode 100644
index 11809d7b25ca7..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/bean/HBaseOperation.java
+++ /dev/null
@@ -1,34 +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.proxy.backend.hbase.bean;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.hadoop.hbase.client.Operation;
-
-/**
- * HBase operation.
- */
-@RequiredArgsConstructor
-@Getter
-public final class HBaseOperation {
-
- private final String tableName;
-
- private final Operation operation;
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/CommonHeterogeneousSQLStatementChecker.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/CommonHeterogeneousSQLStatementChecker.java
deleted file mode 100644
index 915f637ac41bd..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/CommonHeterogeneousSQLStatementChecker.java
+++ /dev/null
@@ -1,87 +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.proxy.backend.hbase.checker;
-
-import com.google.common.base.Preconditions;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.ColumnSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.BinaryOperationExpression;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.ExpressionSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.InExpression;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.ListExpression;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.simple.LiteralExpressionSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.simple.ParameterMarkerExpressionSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.predicate.WhereSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatement;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Common heterogeneous SQL statement checker.
- */
-@RequiredArgsConstructor
-@Getter
-public class CommonHeterogeneousSQLStatementChecker implements HeterogeneousSQLStatementChecker {
-
- protected static final List ALLOW_KEYS = Arrays.asList("rowKey", "row_key", "key", "pk", "id");
-
- private final SQLStatement sqlStatement;
-
- protected final void checkIsSinglePointQuery(final WhereSegment whereSegment) {
- ExpressionSegment whereExpr = whereSegment.getExpr();
- Preconditions.checkArgument(whereExpr instanceof BinaryOperationExpression, "Only support binary operation expression.");
- BinaryOperationExpression expression = (BinaryOperationExpression) whereExpr;
- Preconditions.checkArgument(!(expression.getLeft() instanceof BinaryOperationExpression), "Do not supported multiple expressions.");
- Preconditions.checkArgument(expression.getLeft() instanceof ColumnSegment, "Left segment must column segment.");
- Preconditions.checkArgument("=".equals(expression.getOperator()), "Only Supported `=` operator.");
- String rowKey = ((ColumnSegment) expression.getLeft()).getIdentifier().getValue();
- boolean isAllowKey = ALLOW_KEYS.stream().anyMatch(each -> each.equalsIgnoreCase(rowKey));
- Preconditions.checkArgument(isAllowKey, String.format("%s is not a allowed key.", rowKey));
- }
-
- /**
- * Check value is literal or parameter marker.
- *
- * @param expressionSegment value segment
- * @return is supported
- */
- protected final boolean isAllowExpressionSegment(final ExpressionSegment expressionSegment) {
- return expressionSegment instanceof LiteralExpressionSegment || expressionSegment instanceof ParameterMarkerExpressionSegment;
- }
-
- /**
- * Check in expression.
- *
- * @param whereExpr In expression
- */
- protected final void checkInExpressionIsExpected(final ExpressionSegment whereExpr) {
- InExpression expression = (InExpression) whereExpr;
- Preconditions.checkArgument(expression.getLeft() instanceof ColumnSegment, "Left segment must column segment.");
- String rowKey = ((ColumnSegment) expression.getLeft()).getIdentifier().getValue();
- boolean isAllowKey = ALLOW_KEYS.stream().anyMatch(each -> each.equalsIgnoreCase(rowKey));
- Preconditions.checkArgument(isAllowKey, String.format("%s is not a allowed key.", rowKey));
- Preconditions.checkArgument(!expression.isNot(), "Do not supported `not in`.");
- Preconditions.checkArgument(expression.getRight() instanceof ListExpression, "Only supported list expression.");
- }
-
- @Override
- public void execute() {
- }
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HBaseCheckerFactory.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HBaseCheckerFactory.java
deleted file mode 100644
index 262e03ddd84d0..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HBaseCheckerFactory.java
+++ /dev/null
@@ -1,55 +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.proxy.backend.hbase.checker;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatement;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.DeleteStatement;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.InsertStatement;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.UpdateStatement;
-
-/**
- * HBase checker factory.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class HBaseCheckerFactory {
-
- /**
- * Create new instance of HBase checker.
- *
- * @param sqlStatement SQL statement
- * @return created instance
- */
- public static HeterogeneousSQLStatementChecker newInstance(final SQLStatement sqlStatement) {
- if (sqlStatement instanceof SelectStatement) {
- return new HeterogeneousSelectStatementChecker((SelectStatement) sqlStatement);
- }
- if (sqlStatement instanceof InsertStatement) {
- return new HeterogeneousInsertStatementChecker((InsertStatement) sqlStatement);
- }
- if (sqlStatement instanceof DeleteStatement) {
- return new HeterogeneousDeleteStatementChecker((DeleteStatement) sqlStatement);
- }
- if (sqlStatement instanceof UpdateStatement) {
- return new HeterogeneousUpdateStatementChecker((UpdateStatement) sqlStatement);
- }
- return new CommonHeterogeneousSQLStatementChecker(sqlStatement);
- }
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HeterogeneousDeleteStatementChecker.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HeterogeneousDeleteStatementChecker.java
deleted file mode 100644
index a4af3275080e2..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HeterogeneousDeleteStatementChecker.java
+++ /dev/null
@@ -1,49 +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.proxy.backend.hbase.checker;
-
-import com.google.common.base.Preconditions;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.InExpression;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.predicate.WhereSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.DeleteStatement;
-
-import java.util.Optional;
-
-/**
- * Delete statement checker.
- */
-public final class HeterogeneousDeleteStatementChecker extends CommonHeterogeneousSQLStatementChecker {
-
- private final DeleteStatement sqlStatement;
-
- public HeterogeneousDeleteStatementChecker(final DeleteStatement sqlStatement) {
- super(sqlStatement);
- this.sqlStatement = sqlStatement;
- }
-
- @Override
- public void execute() {
- Optional whereSegment = sqlStatement.getWhere();
- Preconditions.checkArgument(whereSegment.isPresent(), "Must contain where segment.");
- if (whereSegment.get().getExpr() instanceof InExpression) {
- checkInExpressionIsExpected(whereSegment.get().getExpr());
- } else {
- checkIsSinglePointQuery(whereSegment.get());
- }
- }
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HeterogeneousInsertStatementChecker.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HeterogeneousInsertStatementChecker.java
deleted file mode 100644
index dbd8f614adaa4..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HeterogeneousInsertStatementChecker.java
+++ /dev/null
@@ -1,71 +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.proxy.backend.hbase.checker;
-
-import com.google.common.base.Preconditions;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.assignment.InsertValuesSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.InsertStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLInsertStatement;
-import java.util.Collection;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * Insert statement checker.
- */
-public final class HeterogeneousInsertStatementChecker extends CommonHeterogeneousSQLStatementChecker {
-
- private final InsertStatement sqlStatement;
-
- public HeterogeneousInsertStatementChecker(final InsertStatement sqlStatement) {
- super(sqlStatement);
- this.sqlStatement = sqlStatement;
- }
-
- @Override
- public void execute() {
- checkIsExistsRowKeyInInsertColumns();
- checkIsExistsSubQuery();
- checkValueIsExpected();
- checkOnDuplicateKey();
- }
-
- private void checkIsExistsRowKeyInInsertColumns() {
- List columns = sqlStatement.getColumns().stream().map(each -> each.getIdentifier().getValue()).collect(Collectors.toList());
- Preconditions.checkArgument(!columns.isEmpty(), "The inserted column must be explicitly specified.");
- Preconditions.checkArgument(ALLOW_KEYS.stream().anyMatch(each -> each.equalsIgnoreCase(columns.get(0))), "First column must be rowKey.");
- boolean isExists = columns.subList(1, columns.size()).stream().anyMatch(ALLOW_KEYS::contains);
- Preconditions.checkArgument(!isExists, "Cannot contain multiple rowKeys.");
- }
-
- private void checkIsExistsSubQuery() {
- Preconditions.checkArgument(!sqlStatement.getInsertSelect().isPresent(), "Do not supported `insert into...select...`");
- }
-
- private void checkValueIsExpected() {
- Collection values = sqlStatement.getValues();
- for (InsertValuesSegment insertValuesSegment : values) {
- boolean isAllMatch = insertValuesSegment.getValues().stream().allMatch(this::isAllowExpressionSegment);
- Preconditions.checkArgument(isAllMatch, "Value must is literal or parameter marker.");
- }
- }
-
- private void checkOnDuplicateKey() {
- Preconditions.checkArgument(!((MySQLInsertStatement) sqlStatement).getOnDuplicateKeyColumns().isPresent(), "Do not supported ON DUPLICATE KEY UPDATE");
- }
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HeterogeneousSQLStatementChecker.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HeterogeneousSQLStatementChecker.java
deleted file mode 100644
index 0d137fa4289be..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HeterogeneousSQLStatementChecker.java
+++ /dev/null
@@ -1,38 +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.proxy.backend.hbase.checker;
-
-import org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatement;
-
-/**
- * Check where clause.
- */
-public interface HeterogeneousSQLStatementChecker {
-
- /**
- * Get SQL statement.
- *
- * @return SQL statement
- */
- SQLStatement getSqlStatement();
-
- /**
- * do check.
- */
- void execute();
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HeterogeneousSelectStatementChecker.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HeterogeneousSelectStatementChecker.java
deleted file mode 100644
index 8d2bfd78f1a91..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HeterogeneousSelectStatementChecker.java
+++ /dev/null
@@ -1,130 +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.proxy.backend.hbase.checker;
-
-import com.google.common.base.Preconditions;
-import org.apache.shardingsphere.proxy.backend.hbase.context.HBaseContext;
-import org.apache.shardingsphere.proxy.backend.hbase.props.HBasePropertyKey;
-import org.apache.shardingsphere.proxy.backend.hbase.util.HBaseHeterogeneousUtils;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.ColumnSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.BetweenExpression;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.BinaryOperationExpression;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.ExpressionSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.InExpression;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.item.ColumnProjectionSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.item.ProjectionSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.item.ShorthandProjectionSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.order.item.ColumnOrderByItemSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.order.item.OrderByItemSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.pagination.PaginationValueSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.pagination.limit.LimitSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.pagination.limit.NumberLiteralLimitValueSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.predicate.WhereSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLSelectStatement;
-
-import java.util.Optional;
-
-/**
- * Select statement checker.
- */
-public final class HeterogeneousSelectStatementChecker extends CommonHeterogeneousSQLStatementChecker {
-
- private final SelectStatement sqlStatement;
-
- public HeterogeneousSelectStatementChecker(final SelectStatement sqlStatement) {
- super(sqlStatement);
- this.sqlStatement = sqlStatement;
- }
-
- @Override
- public void execute() {
- checkProjectionsIsExpected();
- checkDoNotSupportedSegment();
- checkSupportedWhereSegment();
- checkSupportedOrderBySegment();
- }
-
- private void checkDoNotSupportedSegment() {
- Preconditions.checkArgument(sqlStatement.getFrom().isPresent() && sqlStatement.getFrom().get() instanceof SimpleTableSegment, "Only supported simple table segment.");
- Preconditions.checkArgument(!sqlStatement.getHaving().isPresent(), "Do not supported having segment.");
- Preconditions.checkArgument(!sqlStatement.getGroupBy().isPresent(), "Do not supported group by segment.");
- MySQLSelectStatement selectStatement = (MySQLSelectStatement) sqlStatement;
- Preconditions.checkArgument(!selectStatement.getWindow().isPresent(), "Do not supported window segment.");
- Preconditions.checkArgument(!selectStatement.getLock().isPresent(), "Do not supported lock segment.");
- Optional limitSegment = selectStatement.getLimit();
- if (limitSegment.isPresent()) {
- Preconditions.checkArgument(!limitSegment.get().getOffset().isPresent(), "Do not supported offset segment.");
- Optional paginationSegment = selectStatement.getLimit().flatMap(LimitSegment::getRowCount);
- Long maxScanLimitSize = HBaseContext.getInstance().getProps().getValue(HBasePropertyKey.MAX_SCAN_LIMIT_SIZE);
- paginationSegment.ifPresent(optional -> Preconditions.checkArgument(((NumberLiteralLimitValueSegment) optional).getValue() <= maxScanLimitSize, "Row count must less than 5000."));
- }
- }
-
- private void checkProjectionsIsExpected() {
- for (ProjectionSegment projectionSegment : sqlStatement.getProjections().getProjections()) {
- if (!(projectionSegment instanceof ShorthandProjectionSegment || projectionSegment instanceof ColumnProjectionSegment || HBaseHeterogeneousUtils.isCrcProjectionSegment(
- projectionSegment))) {
- throw new IllegalArgumentException("Only supported shorthand, column and crc32 expression projections.");
- }
- }
- }
-
- private void checkSupportedWhereSegment() {
- Optional whereSegment = sqlStatement.getWhere();
- if (!whereSegment.isPresent()) {
- return;
- }
- ExpressionSegment whereExpr = whereSegment.get().getExpr();
- if (whereExpr instanceof BinaryOperationExpression) {
- checkIsSinglePointQuery(whereSegment.get());
- } else if (whereExpr instanceof InExpression) {
- checkInExpressionIsExpected(whereExpr);
- } else if (whereExpr instanceof BetweenExpression) {
- checkBetweenExpressionIsExpected(whereExpr);
- } else {
- throw new IllegalArgumentException("Only supported =、in、between...and...");
- }
- }
-
- private void checkBetweenExpressionIsExpected(final ExpressionSegment whereExpr) {
- BetweenExpression expression = (BetweenExpression) whereExpr;
- Preconditions.checkArgument(expression.getLeft() instanceof ColumnSegment, "Left segment must column segment.");
- String rowKey = ((ColumnSegment) expression.getLeft()).getIdentifier().getValue();
- boolean isAllowKey = ALLOW_KEYS.stream().anyMatch(each -> each.equalsIgnoreCase(rowKey));
- Preconditions.checkArgument(isAllowKey, String.format("%s is not a allowed key.", rowKey));
- Preconditions.checkArgument(!expression.isNot(), "Do not supported `not between...and...`");
- Preconditions.checkArgument(isAllowExpressionSegment(expression.getBetweenExpr()), "Between expr must literal or parameter marker.");
- Preconditions.checkArgument(isAllowExpressionSegment(expression.getAndExpr()), "Between expr must literal or parameter marker.");
- }
-
- private void checkSupportedOrderBySegment() {
- if (!sqlStatement.getOrderBy().isPresent()) {
- return;
- }
- for (OrderByItemSegment orderByItemSegment : sqlStatement.getOrderBy().get().getOrderByItems()) {
- if (!(orderByItemSegment instanceof ColumnOrderByItemSegment)) {
- throw new IllegalArgumentException("Only simple row key order by.");
- }
- if (!"rowKey".equalsIgnoreCase(((ColumnOrderByItemSegment) orderByItemSegment).getColumn().getIdentifier().getValue())) {
- throw new IllegalArgumentException("Only simple row key order by.");
- }
- }
- }
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HeterogeneousUpdateStatementChecker.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HeterogeneousUpdateStatementChecker.java
deleted file mode 100644
index 2b527322ce77b..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HeterogeneousUpdateStatementChecker.java
+++ /dev/null
@@ -1,61 +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.proxy.backend.hbase.checker;
-
-import com.google.common.base.Preconditions;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.assignment.ColumnAssignmentSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.InExpression;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.predicate.WhereSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.UpdateStatement;
-
-import java.util.Collection;
-import java.util.Optional;
-
-/**
- * Update statement checker.
- */
-public final class HeterogeneousUpdateStatementChecker extends CommonHeterogeneousSQLStatementChecker {
-
- private final UpdateStatement sqlStatement;
-
- public HeterogeneousUpdateStatementChecker(final UpdateStatement sqlStatement) {
- super(sqlStatement);
- this.sqlStatement = sqlStatement;
- }
-
- @Override
- public void execute() {
- Optional whereSegment = sqlStatement.getWhere();
- Preconditions.checkArgument(whereSegment.isPresent(), "Must contain where segment.");
- if (whereSegment.get().getExpr() instanceof InExpression) {
- checkInExpressionIsExpected(whereSegment.get().getExpr());
- } else {
- checkIsSinglePointQuery(whereSegment.get());
- }
- checkAssignmentIsOk();
- }
-
- private void checkAssignmentIsOk() {
- Collection assignmentSegments = sqlStatement.getSetAssignment().getAssignments();
- for (ColumnAssignmentSegment assignmentSegment : assignmentSegments) {
- Preconditions.checkArgument(isAllowExpressionSegment(assignmentSegment.getValue()), "Assignment must is literal or parameter marker.");
- boolean isRowKey = ALLOW_KEYS.stream().anyMatch(each -> each.equalsIgnoreCase(assignmentSegment.getColumns().iterator().next().getIdentifier().getValue()));
- Preconditions.checkArgument(!isRowKey, "Do not allow update rowKey");
- }
- }
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/config/YamlHBaseConfiguration.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/config/YamlHBaseConfiguration.java
deleted file mode 100644
index fce5a0912e65c..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/config/YamlHBaseConfiguration.java
+++ /dev/null
@@ -1,41 +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.proxy.backend.hbase.config;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.shardingsphere.infra.util.yaml.YamlConfiguration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * YAML rule configuration for HBase.
- */
-@Getter
-@Setter
-public final class YamlHBaseConfiguration implements YamlConfiguration {
-
- private String databaseName;
-
- private Map commonDataSourcePoolProps;
-
- private Map dataSources = new HashMap<>();
-
- private Properties props;
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/config/YamlHBaseParameter.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/config/YamlHBaseParameter.java
deleted file mode 100644
index 0dc83b0513203..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/config/YamlHBaseParameter.java
+++ /dev/null
@@ -1,50 +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.proxy.backend.hbase.config;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.shardingsphere.infra.util.yaml.YamlConfiguration;
-
-/**
- * YAML Data source parameters for HBase.
- */
-@Getter
-@Setter
-public final class YamlHBaseParameter implements YamlConfiguration {
-
- private String hbaseZookeeperQuorum;
-
- private String fsDefaultFs;
-
- private String hbaseRootDir;
-
- private long hbaseRpcTimeout;
-
- private long hbaseClientOperationTimeout;
-
- private long hbaseClientScannerTimeoutPeriod;
-
- private String hbaseZookeeperPropertyDataDir;
-
- private String zookeeperZNodeParent;
-
- private String accessUser;
-
- private int ipcPoolSize = 1;
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/connector/HBaseConnectionFactory.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/connector/HBaseConnectionFactory.java
deleted file mode 100644
index 2b0703cc4d8e1..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/connector/HBaseConnectionFactory.java
+++ /dev/null
@@ -1,83 +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.proxy.backend.hbase.connector;
-
-import com.google.common.base.Strings;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
-import org.apache.hadoop.hbase.client.Connection;
-import org.apache.hadoop.hbase.client.ConnectionFactory;
-import org.apache.hadoop.hbase.security.User;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.shardingsphere.proxy.backend.hbase.config.YamlHBaseConfiguration;
-import org.apache.shardingsphere.proxy.backend.hbase.config.YamlHBaseParameter;
-
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-/**
- * Connection factory of HBase.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class HBaseConnectionFactory {
-
- /**
- * Create HBase connection.
- *
- * @param yamlProxyHBaseConfig YAML HBase configuration
- * @return A connection for per HBase cluster
- * @throws SQLException SQL exception
- */
- public static Map createHBaseConnections(final YamlHBaseConfiguration yamlProxyHBaseConfig) throws SQLException {
- Map result = new LinkedHashMap<>(yamlProxyHBaseConfig.getDataSources().size(), 1F);
- for (Entry entry : yamlProxyHBaseConfig.getDataSources().entrySet()) {
- result.put(entry.getKey(), createConnection(entry.getValue()));
- }
- return result;
- }
-
- private static Connection createConnection(final YamlHBaseParameter parameter) throws SQLException {
- Configuration config = createConfiguration(parameter);
- try {
- return Strings.isNullOrEmpty(parameter.getAccessUser())
- ? ConnectionFactory.createConnection(config)
- : ConnectionFactory.createConnection(config, User.create(UserGroupInformation.createRemoteUser(parameter.getAccessUser())));
- } catch (final IOException ex) {
- throw new SQLException(ex);
- }
- }
-
- private static Configuration createConfiguration(final YamlHBaseParameter parameter) {
- Configuration result = HBaseConfiguration.create();
- result.set("fs.defaultFS", parameter.getFsDefaultFs());
- result.set("hbase.rootdir", parameter.getHbaseRootDir());
- result.setLong("hbase.rpc.timeout", parameter.getHbaseRpcTimeout());
- result.setLong("hbase.client.operation.timeout", parameter.getHbaseClientOperationTimeout());
- result.setLong("hbase.client.scanner.timeout.period", parameter.getHbaseClientScannerTimeoutPeriod());
- result.set("hbase.zookeeper.property.dataDir", parameter.getHbaseZookeeperPropertyDataDir());
- result.set("hbase.zookeeper.quorum", parameter.getHbaseZookeeperQuorum());
- result.set("zookeeper.znode.parent", parameter.getZookeeperZNodeParent());
- result.setInt("hbase.client.ipc.pool.size", parameter.getIpcPoolSize());
- return result;
- }
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/context/HBaseContext.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/context/HBaseContext.java
deleted file mode 100644
index 7a8d06f02ed51..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/context/HBaseContext.java
+++ /dev/null
@@ -1,180 +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.proxy.backend.hbase.context;
-
-import lombok.AccessLevel;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.Connection;
-import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
-import org.apache.shardingsphere.infra.exception.kernel.metadata.TableNotFoundException;
-import org.apache.shardingsphere.proxy.backend.hbase.bean.HBaseCluster;
-import org.apache.shardingsphere.proxy.backend.hbase.executor.HBaseBackgroundExecutorManager;
-import org.apache.shardingsphere.proxy.backend.hbase.executor.HBaseExecutor;
-import org.apache.shardingsphere.proxy.backend.hbase.props.HBaseProperties;
-import org.apache.shardingsphere.proxy.backend.hbase.props.HBasePropertyKey;
-
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.stream.Collectors;
-
-/**
- * HBase context.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-@Getter
-@Slf4j
-public final class HBaseContext implements AutoCloseable {
-
- private static final HBaseContext INSTANCE = new HBaseContext();
-
- private final HBaseBackgroundExecutorManager executorManager = new HBaseBackgroundExecutorManager();
-
- private HBaseRegionWarmUpContext warmUpContext;
-
- @Setter
- private HBaseProperties props;
-
- private final String columnFamily = "i";
-
- private Collection connections;
-
- private boolean isSyncWarmUp;
-
- private final Map tableConnectionMap = new ConcurrentHashMap<>();
-
- /**
- * Get instance of HBase context.
- *
- * @return got instance
- */
- public static HBaseContext getInstance() {
- return INSTANCE;
- }
-
- /**
- * Initialize HBase context.
- *
- * @param connections A connection for per HBase cluster
- * @throws SQLException SQL exception
- */
- public void init(final Map connections) throws SQLException {
- this.connections = new ArrayList<>(connections.size());
- warmUpContext = HBaseRegionWarmUpContext.getInstance();
- warmUpContext.init(getWarmUpThreadSize());
- isSyncWarmUp = HBaseContext.getInstance().getProps().getValue(HBasePropertyKey.IS_SYNC_WARM_UP);
- for (Entry entry : connections.entrySet()) {
- HBaseCluster cluster = new HBaseCluster(entry.getKey(), entry.getValue());
- loadTables(cluster);
- this.connections.add(cluster);
- }
- log.info("{} tables loaded from {} clusters.", tableConnectionMap.size(), connections.size());
- }
-
- /**
- * Get warm up thread size.
- *
- * @return warm up thread size, value should be in (0, 30]
- */
- private int getWarmUpThreadSize() {
- int warmUpThreadSize = HBaseContext.getInstance().getProps().getValue(HBasePropertyKey.WARM_UP_THREAD_NUM);
- return warmUpThreadSize < 0 ? 1 : Math.min(warmUpThreadSize, 30);
- }
-
- /**
- * Load tables.
- *
- * @param hbaseCluster HBase cluster
- * @throws SQLException SQL exception
- */
- public synchronized void loadTables(final HBaseCluster hbaseCluster) throws SQLException {
- warmUpContext.initStatisticsInfo(System.currentTimeMillis());
- HTableDescriptor[] hTableDescriptor = HBaseExecutor.executeAdmin(hbaseCluster.getConnection(), Admin::listTables);
- for (String each : Arrays.stream(hTableDescriptor).map(HTableDescriptor::getNameAsString).collect(Collectors.toList())) {
- if (tableConnectionMap.containsKey(each)) {
- continue;
- }
- warmUpContext.addNeedWarmCount();
- log.info("Load table `{}` from cluster `{}`.", each, hbaseCluster.getClusterName());
- tableConnectionMap.put(each, hbaseCluster);
- warmUpContext.submitWarmUpTask(each, hbaseCluster);
- }
- if (isSyncWarmUp) {
- warmUpContext.syncExecuteWarmUp(hbaseCluster.getClusterName());
- warmUpContext.clear();
- }
- }
-
- /**
- * Get connection via table name.
- *
- * @param tableName table name
- * @return HBase connection
- */
- public Connection getConnection(final String tableName) {
- ShardingSpherePreconditions.checkContainsKey(tableConnectionMap, tableName, () -> new TableNotFoundException(tableName));
- return tableConnectionMap.get(tableName).getConnection();
- }
-
- /**
- * Is table exists.
- *
- * @param tableName table name
- * @return table exists or not
- */
- public boolean isTableExists(final String tableName) {
- return tableConnectionMap.containsKey(tableName);
- }
-
- /**
- * Get connection via cluster name.
- *
- * @param clusterName cluster name
- * @return HBase connection
- * @throws SQLException SQL exception
- */
- public Connection getConnectionByClusterName(final String clusterName) throws SQLException {
- HBaseCluster cluster = connections.stream().filter(each -> each.getClusterName().equalsIgnoreCase(clusterName)).findFirst()
- .orElseThrow(() -> new SQLException(String.format("Cluster `%s` is not exists", clusterName)));
- return cluster.getConnection();
- }
-
- @Override
- public void close() throws SQLException {
- connections.clear();
- tableConnectionMap.clear();
- executorManager.close();
- for (Connection connection : connections.stream().map(HBaseCluster::getConnection).collect(Collectors.toList())) {
- try {
- connection.close();
- } catch (final IOException ex) {
- throw new SQLException(ex);
- }
- }
- }
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/context/HBaseMetaDataRefresher.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/context/HBaseMetaDataRefresher.java
deleted file mode 100644
index c32549396cbb1..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/context/HBaseMetaDataRefresher.java
+++ /dev/null
@@ -1,42 +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.proxy.backend.hbase.context;
-
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.proxy.backend.hbase.bean.HBaseCluster;
-
-import java.sql.SQLException;
-
-/**
- * HBase meta data refresher.
- */
-@RequiredArgsConstructor
-public final class HBaseMetaDataRefresher implements Runnable {
-
- private final HBaseContext context;
-
- @Override
- public void run() {
- for (HBaseCluster hBaseCluster : context.getConnections()) {
- try {
- context.loadTables(hBaseCluster);
- } catch (final SQLException ignored) {
- }
- }
- }
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/context/HBaseRegionWarmUpContext.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/context/HBaseRegionWarmUpContext.java
deleted file mode 100644
index ccf7b2a84d8d0..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/context/HBaseRegionWarmUpContext.java
+++ /dev/null
@@ -1,157 +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.proxy.backend.hbase.context;
-
-import lombok.Getter;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.client.Connection;
-import org.apache.hadoop.hbase.client.RegionLocator;
-import org.apache.shardingsphere.proxy.backend.hbase.bean.HBaseCluster;
-import org.apache.shardingsphere.proxy.backend.hbase.executor.HBaseTaskExecutorManager;
-
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * HBase region warn up context.
- */
-@Getter
-@Slf4j
-public final class HBaseRegionWarmUpContext {
-
- private static final HBaseRegionWarmUpContext INSTANCE = new HBaseRegionWarmUpContext();
-
- private final AtomicInteger executeCount = new AtomicInteger(0);
-
- private final AtomicInteger tableCount = new AtomicInteger(0);
-
- private HBaseTaskExecutorManager executorManager;
-
- private long startWarmUpTime;
-
- /**
- * Get instance of HBase context.
- *
- * @return instance of HBase context
- */
- public static HBaseRegionWarmUpContext getInstance() {
- return INSTANCE;
- }
-
- /**
- * Init.
- *
- * @param poolSize execute pool size
- */
- public void init(final int poolSize) {
- executorManager = new HBaseTaskExecutorManager(poolSize);
- }
-
- /**
- * Submit region warm up task.
- *
- * @param tableName table name
- * @param hbaseCluster HBase cluster
- */
- public void submitWarmUpTask(final String tableName, final HBaseCluster hbaseCluster) {
- executorManager.submit(() -> loadRegionInfo(tableName, hbaseCluster));
- }
-
- /**
- * Load one table region info.
- *
- * @param tableName table name
- * @param connection HBase connection
- * @throws SQLException SQL exception
- */
- public void loadRegionInfo(final String tableName, final Connection connection) throws SQLException {
- HBaseRegionWarmUpContext.getInstance().addExecuteCount();
- try {
- if (null == connection) {
- return;
- }
- RegionLocator regionLocator = connection.getRegionLocator(TableName.valueOf(tableName));
- regionLocator.getAllRegionLocations();
- } catch (final IOException ex) {
- throw new SQLException(String.format("Table '%s' warm up error.", tableName), ex);
- }
- }
-
- private void loadRegionInfo(final String tableName, final HBaseCluster hbaseCluster) {
- try {
- RegionLocator regionLocator = hbaseCluster.getConnection().getRegionLocator(TableName.valueOf(tableName));
- warmUpRegion(regionLocator);
- HBaseRegionWarmUpContext.getInstance().addExecuteCount();
- } catch (final IOException ex) {
- log.error(String.format("Table: `%s` load region info error, reason is %s", tableName, ex));
- }
- }
-
- private void warmUpRegion(final RegionLocator regionLocator) throws IOException {
- regionLocator.getAllRegionLocations();
- }
-
- /**
- * Init statistics info.
- *
- * @param startWarmUpTime start warm up time
- */
- public void initStatisticsInfo(final long startWarmUpTime) {
- this.startWarmUpTime = startWarmUpTime;
- }
-
- /**
- * Execute count add one.
- */
- public void addExecuteCount() {
- executeCount.incrementAndGet();
- }
-
- /**
- * All need warm up table add one.
- */
- public void addNeedWarmCount() {
- tableCount.incrementAndGet();
- }
-
- /**
- * Sync execute.
- *
- * @param clusterName cluster name
- */
- public void syncExecuteWarmUp(final String clusterName) {
- while (executeCount.get() < tableCount.get()) {
- try {
- Thread.sleep(100L);
- } catch (final InterruptedException ignore) {
- Thread.currentThread().interrupt();
- }
- }
- log.info(String.format("%s cluster end warm up, execute time: %dms, warm table: %d", clusterName, System.currentTimeMillis() - startWarmUpTime, executeCount.get()));
- }
-
- /**
- * Clear statistics info.
- */
- public void clear() {
- tableCount.set(0);
- executeCount.set(0);
- }
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/HBaseOperationConverter.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/HBaseOperationConverter.java
deleted file mode 100644
index c2a42a4ba624e..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/HBaseOperationConverter.java
+++ /dev/null
@@ -1,33 +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.proxy.backend.hbase.converter;
-
-import org.apache.shardingsphere.proxy.backend.hbase.bean.HBaseOperation;
-
-/**
- * Convert SQL statement to HBase operation.
- */
-public interface HBaseOperationConverter {
-
- /**
- * Convert SQL statement to HBase operation.
- *
- * @return HBase operation
- */
- HBaseOperation convert();
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/HBaseOperationConverterFactory.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/HBaseOperationConverterFactory.java
deleted file mode 100644
index 73e57e5feb693..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/HBaseOperationConverterFactory.java
+++ /dev/null
@@ -1,67 +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.proxy.backend.hbase.converter;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
-import org.apache.shardingsphere.infra.binder.context.statement.dal.FlushStatementContext;
-import org.apache.shardingsphere.infra.binder.context.statement.dml.DeleteStatementContext;
-import org.apache.shardingsphere.infra.binder.context.statement.dml.InsertStatementContext;
-import org.apache.shardingsphere.infra.binder.context.statement.dml.SelectStatementContext;
-import org.apache.shardingsphere.infra.binder.context.statement.dml.UpdateStatementContext;
-import org.apache.shardingsphere.proxy.backend.hbase.converter.type.HBaseDeleteOperationConverter;
-import org.apache.shardingsphere.proxy.backend.hbase.converter.type.HBaseInsertOperationConverter;
-import org.apache.shardingsphere.proxy.backend.hbase.converter.type.HBaseRegionReloadOperationConverter;
-import org.apache.shardingsphere.proxy.backend.hbase.converter.type.HBaseSelectOperationConverter;
-import org.apache.shardingsphere.proxy.backend.hbase.converter.type.HBaseUpdateOperationConverter;
-
-import java.sql.SQLException;
-
-/**
- * HBase operation converter factory.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class HBaseOperationConverterFactory {
-
- /**
- * Create new instance of HBase operation converter.
- *
- * @param sqlStatementContext SQL statement context
- * @return instance of converter
- * @throws SQLException SQL exception
- */
- public static HBaseOperationConverter newInstance(final SQLStatementContext sqlStatementContext) throws SQLException {
- if (sqlStatementContext instanceof SelectStatementContext) {
- return new HBaseSelectOperationConverter(sqlStatementContext);
- }
- if (sqlStatementContext instanceof InsertStatementContext) {
- return new HBaseInsertOperationConverter(sqlStatementContext);
- }
- if (sqlStatementContext instanceof DeleteStatementContext) {
- return new HBaseDeleteOperationConverter(sqlStatementContext);
- }
- if (sqlStatementContext instanceof UpdateStatementContext) {
- return new HBaseUpdateOperationConverter(sqlStatementContext);
- }
- if (sqlStatementContext instanceof FlushStatementContext) {
- return new HBaseRegionReloadOperationConverter(sqlStatementContext);
- }
- throw new SQLException("Can not find HBase converter.");
- }
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/HBaseRowKeyExtractor.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/HBaseRowKeyExtractor.java
deleted file mode 100644
index 4fa799dbfe84c..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/HBaseRowKeyExtractor.java
+++ /dev/null
@@ -1,55 +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.proxy.backend.hbase.converter;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.BinaryOperationExpression;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.InExpression;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.ListExpression;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.simple.LiteralExpressionSegment;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * HBase row key extractor.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class HBaseRowKeyExtractor {
-
- /**
- * Get row keys from binary operation expression.
- *
- * @param expr binary operation expression
- * @return row keys
- */
- public static String getRowKey(final BinaryOperationExpression expr) {
- return String.valueOf(((LiteralExpressionSegment) expr.getRight()).getLiterals());
- }
-
- /**
- * Get row keys from in expression.
- *
- * @param expr in expression
- * @return row keys
- */
- public static List getRowKeys(final InExpression expr) {
- return ((ListExpression) expr.getRight()).getItems().stream().map(each -> String.valueOf(((LiteralExpressionSegment) each).getLiterals())).collect(Collectors.toList());
- }
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/operation/HBaseDeleteOperation.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/operation/HBaseDeleteOperation.java
deleted file mode 100644
index 477a4066429a7..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/operation/HBaseDeleteOperation.java
+++ /dev/null
@@ -1,47 +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.proxy.backend.hbase.converter.operation;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.hadoop.hbase.client.Delete;
-import org.apache.hadoop.hbase.client.Operation;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * HBase delete operation.
- */
-@RequiredArgsConstructor
-@Getter
-public final class HBaseDeleteOperation extends Operation {
-
- private final List deletes;
-
- @Override
- public Map getFingerprint() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map toMap(final int i) {
- return Collections.emptyMap();
- }
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/operation/HBaseInsertOperation.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/operation/HBaseInsertOperation.java
deleted file mode 100644
index f5a8d67409ce8..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/operation/HBaseInsertOperation.java
+++ /dev/null
@@ -1,47 +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.proxy.backend.hbase.converter.operation;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.hadoop.hbase.client.Operation;
-import org.apache.hadoop.hbase.client.Put;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * HBase insert operation.
- */
-@RequiredArgsConstructor
-@Getter
-public final class HBaseInsertOperation extends Operation {
-
- private final List puts;
-
- @Override
- public Map getFingerprint() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map toMap(final int i) {
- return Collections.emptyMap();
- }
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/operation/HBaseRegionReloadOperation.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/operation/HBaseRegionReloadOperation.java
deleted file mode 100644
index d9d5c6cbcd439..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/operation/HBaseRegionReloadOperation.java
+++ /dev/null
@@ -1,39 +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.proxy.backend.hbase.converter.operation;
-
-import org.apache.hadoop.hbase.client.Operation;
-
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * HBase region reload operation.
- */
-public final class HBaseRegionReloadOperation extends Operation {
-
- @Override
- public Map getFingerprint() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map toMap(final int i) {
- return Collections.emptyMap();
- }
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/operation/HBaseSelectOperation.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/operation/HBaseSelectOperation.java
deleted file mode 100644
index 5d0448047ed3f..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/operation/HBaseSelectOperation.java
+++ /dev/null
@@ -1,47 +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.proxy.backend.hbase.converter.operation;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.hadoop.hbase.client.Get;
-import org.apache.hadoop.hbase.client.Operation;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * HBase select operation.
- */
-@RequiredArgsConstructor
-@Getter
-public final class HBaseSelectOperation extends Operation {
-
- private final List gets;
-
- @Override
- public Map getFingerprint() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map toMap(final int i) {
- return Collections.emptyMap();
- }
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/operation/HBaseUpdateOperation.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/operation/HBaseUpdateOperation.java
deleted file mode 100644
index 99b45fc273149..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/operation/HBaseUpdateOperation.java
+++ /dev/null
@@ -1,47 +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.proxy.backend.hbase.converter.operation;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.hadoop.hbase.client.Operation;
-import org.apache.hadoop.hbase.client.Put;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * HBase update operation.
- */
-@RequiredArgsConstructor
-@Getter
-public final class HBaseUpdateOperation extends Operation {
-
- private final List puts;
-
- @Override
- public Map getFingerprint() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map toMap(final int i) {
- return Collections.emptyMap();
- }
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/type/HBaseDeleteOperationConverter.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/type/HBaseDeleteOperationConverter.java
deleted file mode 100644
index 7c1da82a8e50e..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/type/HBaseDeleteOperationConverter.java
+++ /dev/null
@@ -1,69 +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.proxy.backend.hbase.converter.type;
-
-import com.google.common.base.Preconditions;
-import lombok.RequiredArgsConstructor;
-import org.apache.hadoop.hbase.client.Delete;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
-import org.apache.shardingsphere.infra.binder.context.statement.dml.DeleteStatementContext;
-import org.apache.shardingsphere.proxy.backend.hbase.bean.HBaseOperation;
-import org.apache.shardingsphere.proxy.backend.hbase.converter.HBaseOperationConverter;
-import org.apache.shardingsphere.proxy.backend.hbase.converter.HBaseRowKeyExtractor;
-import org.apache.shardingsphere.proxy.backend.hbase.converter.operation.HBaseDeleteOperation;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.BinaryOperationExpression;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.InExpression;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.predicate.WhereSegment;
-
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-/**
- * HBase delete operation converter.
- */
-@RequiredArgsConstructor
-public final class HBaseDeleteOperationConverter implements HBaseOperationConverter {
-
- private final SQLStatementContext sqlStatementContext;
-
- @Override
- public HBaseOperation convert() {
- DeleteStatementContext deleteStatementContext = (DeleteStatementContext) sqlStatementContext;
- Optional whereSegment = deleteStatementContext.getWhereSegments().stream().findFirst();
- Preconditions.checkArgument(whereSegment.isPresent(), "Where segment is absent.");
- return whereSegment.get().getExpr() instanceof InExpression
- ? createDeleteMultipleRowKeysOperation(deleteStatementContext, whereSegment.get())
- : createDeleteSingleRowKeyOperation(deleteStatementContext, whereSegment.get());
- }
-
- private HBaseOperation createDeleteMultipleRowKeysOperation(final DeleteStatementContext deleteStatementContext, final WhereSegment whereSegment) {
- String tableName = deleteStatementContext.getTablesContext().getTableNames().iterator().next();
- List rowKeys = HBaseRowKeyExtractor.getRowKeys((InExpression) whereSegment.getExpr());
- List deletes = rowKeys.stream().map(each -> new Delete(Bytes.toBytes(each))).collect(Collectors.toList());
- return new HBaseOperation(tableName, new HBaseDeleteOperation(deletes));
- }
-
- private HBaseOperation createDeleteSingleRowKeyOperation(final DeleteStatementContext deleteStatementContext, final WhereSegment whereSegment) {
- String tableName = deleteStatementContext.getTablesContext().getTableNames().iterator().next();
- String rowKey = HBaseRowKeyExtractor.getRowKey((BinaryOperationExpression) whereSegment.getExpr());
- Delete delete = new Delete(Bytes.toBytes(rowKey));
- return new HBaseOperation(tableName, delete);
- }
-}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/type/HBaseInsertOperationConverter.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/type/HBaseInsertOperationConverter.java
deleted file mode 100644
index 9e48cb0f450ce..0000000000000
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/type/HBaseInsertOperationConverter.java
+++ /dev/null
@@ -1,62 +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.proxy.backend.hbase.converter.type;
-
-import lombok.RequiredArgsConstructor;
-import org.apache.hadoop.hbase.client.Put;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.shardingsphere.infra.binder.context.segment.insert.values.InsertValueContext;
-import org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
-import org.apache.shardingsphere.infra.binder.context.statement.dml.InsertStatementContext;
-import org.apache.shardingsphere.proxy.backend.hbase.bean.HBaseOperation;
-import org.apache.shardingsphere.proxy.backend.hbase.context.HBaseContext;
-import org.apache.shardingsphere.proxy.backend.hbase.converter.HBaseOperationConverter;
-import org.apache.shardingsphere.proxy.backend.hbase.converter.operation.HBaseInsertOperation;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.simple.LiteralExpressionSegment;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * HBase insert operation converter.
- */
-@RequiredArgsConstructor
-public final class HBaseInsertOperationConverter implements HBaseOperationConverter {
-
- private final SQLStatementContext sqlStatementContext;
-
- @Override
- public HBaseOperation convert() {
- InsertStatementContext insertStatementContext = (InsertStatementContext) sqlStatementContext;
- String tableName = insertStatementContext.getTablesContext().getTableNames().iterator().next();
- return new HBaseOperation(tableName, new HBaseInsertOperation(createHBaseRequest(insertStatementContext)));
- }
-
- private List createHBaseRequest(final InsertStatementContext insertStatementContext) {
- return insertStatementContext.getInsertValueContexts().stream().map(each -> generateHBaseRequest(insertStatementContext, each)).collect(Collectors.toList());
- }
-
- private Put generateHBaseRequest(final InsertStatementContext insertStatementContext, final InsertValueContext insertValueContext) {
- List columns = insertStatementContext.getInsertColumnNames();
- List