This is an automated email from the ASF dual-hosted git repository.
zhaojinchao 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 cc9118c7dc0 Add shardingsphere-infra-checker module (#32390)
cc9118c7dc0 is described below
commit cc9118c7dc0394e8f25ed1b22e808cd7d6174da9
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Aug 4 16:20:33 2024 +0800
Add shardingsphere-infra-checker module (#32390)
* Add shardingsphere-infra-checker module
* Add shardingsphere-infra-checker module
* Add shardingsphere-infra-checker module
* Add shardingsphere-infra-checker module
---
.../sql/EncryptOrderByItemSupportedChecker.java | 100 +++++++++++++++++++++
.../sql/EncryptSQLSupportedCheckersFactory.java | 47 ++++++++++
...phere.infra.checker.SQLSupportedCheckersFactory | 18 ++++
infra/{route => checker}/pom.xml | 4 +-
.../infra/checker/SQLSupportedCheckEngine.java | 58 ++++++++++++
.../infra/checker/SQLSupportedChecker.java} | 26 ++++--
.../checker/SQLSupportedCheckersFactory.java} | 22 +++--
.../shardingsphere/infra/checker/SchemaAware.java} | 24 +++--
.../infra/connection/kernel/KernelProcessor.java | 9 ++
infra/pom.xml | 3 +-
.../infra/rewrite/SQLRewriteEntry.java | 5 +-
.../token/common/generator/SQLTokenGenerator.java | 2 +-
infra/route/pom.xml | 5 ++
13 files changed, 293 insertions(+), 30 deletions(-)
diff --git
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/sql/EncryptOrderByItemSupportedChecker.java
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/sql/EncryptOrderByItemSupportedChecker.java
new file mode 100644
index 00000000000..f66f8f16a03
--- /dev/null
+++
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/sql/EncryptOrderByItemSupportedChecker.java
@@ -0,0 +1,100 @@
+/*
+ * 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.encrypt.checker.sql;
+
+import lombok.Setter;
+import
org.apache.shardingsphere.encrypt.exception.syntax.UnsupportedEncryptSQLException;
+import org.apache.shardingsphere.encrypt.rule.EncryptRule;
+import org.apache.shardingsphere.encrypt.rule.table.EncryptTable;
+import org.apache.shardingsphere.infra.annotation.HighFrequencyInvocation;
+import
org.apache.shardingsphere.infra.binder.context.segment.select.orderby.OrderByItem;
+import
org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
+import
org.apache.shardingsphere.infra.binder.context.statement.dml.SelectStatementContext;
+import org.apache.shardingsphere.infra.checker.SQLSupportedChecker;
+import org.apache.shardingsphere.infra.checker.SchemaAware;
+import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
+import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.ColumnSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.order.item.ColumnOrderByItemSegment;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Optional;
+
+/**
+ * Order by item supported checker for encrypt.
+ */
+@HighFrequencyInvocation
+@Setter
+public final class EncryptOrderByItemSupportedChecker implements
SQLSupportedChecker<SelectStatementContext, EncryptRule>, SchemaAware {
+
+ private Map<String, ShardingSphereSchema> schemas;
+
+ private ShardingSphereSchema defaultSchema;
+
+ @Override
+ public boolean isCheck(final SQLStatementContext sqlStatementContext) {
+ return sqlStatementContext instanceof SelectStatementContext &&
containsOrderByItem((SelectStatementContext) sqlStatementContext);
+ }
+
+ private boolean containsOrderByItem(final SelectStatementContext
sqlStatementContext) {
+ if (!sqlStatementContext.getOrderByContext().getItems().isEmpty() &&
!sqlStatementContext.getOrderByContext().isGenerated()) {
+ return true;
+ }
+ for (SelectStatementContext each :
sqlStatementContext.getSubqueryContexts().values()) {
+ if (containsOrderByItem(each)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void check(final EncryptRule encryptRule, final
SelectStatementContext sqlStatementContext) {
+ ShardingSphereSchema schema =
sqlStatementContext.getTablesContext().getSchemaName().map(schemas::get).orElseGet(()
-> defaultSchema);
+ for (OrderByItem each : getOrderByItems(sqlStatementContext)) {
+ if (each.getSegment() instanceof ColumnOrderByItemSegment) {
+ ColumnSegment columnSegment = ((ColumnOrderByItemSegment)
each.getSegment()).getColumn();
+ Map<String, String> columnTableNames =
sqlStatementContext.getTablesContext().findTableNames(Collections.singleton(columnSegment),
schema);
+ check(encryptRule, Collections.singleton(columnSegment),
columnTableNames);
+ }
+ }
+ }
+
+ private void check(final EncryptRule encryptRule, final
Collection<ColumnSegment> columnSegments, final Map<String, String>
columnTableNames) {
+ for (ColumnSegment each : columnSegments) {
+ String tableName =
columnTableNames.getOrDefault(each.getExpression(), "");
+ Optional<EncryptTable> encryptTable =
encryptRule.findEncryptTable(tableName);
+ String columnName = each.getIdentifier().getValue();
+ ShardingSpherePreconditions.checkState(!encryptTable.isPresent()
|| !encryptTable.get().isEncryptColumn(columnName), () -> new
UnsupportedEncryptSQLException("ORDER BY"));
+ }
+ }
+
+ private Collection<OrderByItem> getOrderByItems(final
SelectStatementContext sqlStatementContext) {
+ Collection<OrderByItem> result = new LinkedList<>();
+ if (!sqlStatementContext.getOrderByContext().isGenerated()) {
+ result.addAll(sqlStatementContext.getOrderByContext().getItems());
+ }
+ for (SelectStatementContext each :
sqlStatementContext.getSubqueryContexts().values()) {
+ result.addAll(getOrderByItems(each));
+ }
+ return result;
+ }
+}
diff --git
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/sql/EncryptSQLSupportedCheckersFactory.java
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/sql/EncryptSQLSupportedCheckersFactory.java
new file mode 100644
index 00000000000..a37da7b3875
--- /dev/null
+++
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/sql/EncryptSQLSupportedCheckersFactory.java
@@ -0,0 +1,47 @@
+/*
+ * 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.encrypt.checker.sql;
+
+import org.apache.shardingsphere.encrypt.constant.EncryptOrder;
+import org.apache.shardingsphere.encrypt.rule.EncryptRule;
+import org.apache.shardingsphere.infra.checker.SQLSupportedChecker;
+import org.apache.shardingsphere.infra.checker.SQLSupportedCheckersFactory;
+
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * Encrypt SQL supported checker factory.
+ */
+public final class EncryptSQLSupportedCheckersFactory implements
SQLSupportedCheckersFactory<EncryptRule> {
+
+ @Override
+ public Collection<SQLSupportedChecker<?, EncryptRule>> getCheckers() {
+ return Collections.singleton(new EncryptOrderByItemSupportedChecker());
+ }
+
+ @Override
+ public int getOrder() {
+ return EncryptOrder.ORDER;
+ }
+
+ @Override
+ public Class<EncryptRule> getTypeClass() {
+ return EncryptRule.class;
+ }
+}
diff --git
a/features/encrypt/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.checker.SQLSupportedCheckersFactory
b/features/encrypt/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.checker.SQLSupportedCheckersFactory
new file mode 100644
index 00000000000..de9483a73a1
--- /dev/null
+++
b/features/encrypt/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.checker.SQLSupportedCheckersFactory
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+org.apache.shardingsphere.encrypt.checker.sql.EncryptSQLSupportedCheckersFactory
diff --git a/infra/route/pom.xml b/infra/checker/pom.xml
similarity index 92%
copy from infra/route/pom.xml
copy to infra/checker/pom.xml
index 7b781aab87f..7252f216371 100644
--- a/infra/route/pom.xml
+++ b/infra/checker/pom.xml
@@ -23,13 +23,13 @@
<artifactId>shardingsphere-infra</artifactId>
<version>5.5.1-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-infra-route</artifactId>
+ <artifactId>shardingsphere-infra-checker</artifactId>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-infra-session</artifactId>
+ <artifactId>shardingsphere-infra-binder</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
diff --git
a/infra/checker/src/main/java/org/apache/shardingsphere/infra/checker/SQLSupportedCheckEngine.java
b/infra/checker/src/main/java/org/apache/shardingsphere/infra/checker/SQLSupportedCheckEngine.java
new file mode 100644
index 00000000000..1d47e45e068
--- /dev/null
+++
b/infra/checker/src/main/java/org/apache/shardingsphere/infra/checker/SQLSupportedCheckEngine.java
@@ -0,0 +1,58 @@
+/*
+ * 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.infra.checker;
+
+import
org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
+import org.apache.shardingsphere.infra.database.core.type.DatabaseTypeRegistry;
+import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
+import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * SQL supported check engine.
+ */
+public final class SQLSupportedCheckEngine {
+
+ /**
+ * Check SQL.
+ *
+ * @param rules rules
+ * @param sqlStatementContext to be checked SQL statement context
+ * @param schemas schemas
+ * @param databaseName database name
+ */
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ public void checkSQL(final Collection<ShardingSphereRule> rules, final
SQLStatementContext sqlStatementContext, final Map<String,
ShardingSphereSchema> schemas, final String databaseName) {
+ for (Entry<ShardingSphereRule, SQLSupportedCheckersFactory> entry :
OrderedSPILoader.getServices(SQLSupportedCheckersFactory.class,
rules).entrySet()) {
+ Collection<SQLSupportedChecker> checkers =
entry.getValue().getCheckers();
+ for (SQLSupportedChecker each : checkers) {
+ if (each instanceof SchemaAware) {
+ ((SchemaAware) each).setSchemas(schemas);
+ ((SchemaAware) each).setDefaultSchema(schemas.get(new
DatabaseTypeRegistry(sqlStatementContext.getDatabaseType()).getDefaultSchemaName(databaseName)));
+ }
+ if (each.isCheck(sqlStatementContext)) {
+ each.check(entry.getKey(), sqlStatementContext);
+ }
+ }
+ }
+ }
+}
diff --git
a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/common/generator/SQLTokenGenerator.java
b/infra/checker/src/main/java/org/apache/shardingsphere/infra/checker/SQLSupportedChecker.java
similarity index 56%
copy from
infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/common/generator/SQLTokenGenerator.java
copy to
infra/checker/src/main/java/org/apache/shardingsphere/infra/checker/SQLSupportedChecker.java
index be1d85aede7..da5b0e4deed 100644
---
a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/common/generator/SQLTokenGenerator.java
+++
b/infra/checker/src/main/java/org/apache/shardingsphere/infra/checker/SQLSupportedChecker.java
@@ -15,20 +15,32 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.rewrite.sql.token.common.generator;
+package org.apache.shardingsphere.infra.checker;
import
org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
/**
- * SQL token generator.
+ * SQL supported checker.
+ *
+ * @param <T> type of SQL statement context
+ * @param <R> type of ShardingSphere rule
*/
-public interface SQLTokenGenerator {
+public interface SQLSupportedChecker<T extends SQLStatementContext, R extends
ShardingSphereRule> {
/**
- * Judge is generate SQL token or not.
+ * Judge whether to need check SQL.
*
- * @param sqlStatementContext SQL statement context
- * @return is generate SQL token or not
+ * @param sqlStatementContext to be checked SQL statement context
+ * @return check SQL or not
*/
- boolean isGenerateSQLToken(SQLStatementContext sqlStatementContext);
+ boolean isCheck(SQLStatementContext sqlStatementContext);
+
+ /**
+ * Check SQL.
+ *
+ * @param rule rule
+ * @param sqlStatementContext to be checked SQL statement context
+ */
+ void check(R rule, T sqlStatementContext);
}
diff --git
a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/common/generator/SQLTokenGenerator.java
b/infra/checker/src/main/java/org/apache/shardingsphere/infra/checker/SQLSupportedCheckersFactory.java
similarity index 61%
copy from
infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/common/generator/SQLTokenGenerator.java
copy to
infra/checker/src/main/java/org/apache/shardingsphere/infra/checker/SQLSupportedCheckersFactory.java
index be1d85aede7..db2c8c68130 100644
---
a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/common/generator/SQLTokenGenerator.java
+++
b/infra/checker/src/main/java/org/apache/shardingsphere/infra/checker/SQLSupportedCheckersFactory.java
@@ -15,20 +15,26 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.rewrite.sql.token.common.generator;
+package org.apache.shardingsphere.infra.checker;
-import
org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
+import groovy.lang.Singleton;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
+import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPI;
+
+import java.util.Collection;
/**
- * SQL token generator.
+ * SQL supported checkers factory.
+ *
+ * @param <T> type of rule
*/
-public interface SQLTokenGenerator {
+@Singleton
+public interface SQLSupportedCheckersFactory<T extends ShardingSphereRule>
extends OrderedSPI<T> {
/**
- * Judge is generate SQL token or not.
+ * Get SQL supported checkers.
*
- * @param sqlStatementContext SQL statement context
- * @return is generate SQL token or not
+ * @return got checkers
*/
- boolean isGenerateSQLToken(SQLStatementContext sqlStatementContext);
+ Collection<SQLSupportedChecker<?, T>> getCheckers();
}
diff --git
a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/common/generator/SQLTokenGenerator.java
b/infra/checker/src/main/java/org/apache/shardingsphere/infra/checker/SchemaAware.java
similarity index 62%
copy from
infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/common/generator/SQLTokenGenerator.java
copy to
infra/checker/src/main/java/org/apache/shardingsphere/infra/checker/SchemaAware.java
index be1d85aede7..d7ea0abca07 100644
---
a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/common/generator/SQLTokenGenerator.java
+++
b/infra/checker/src/main/java/org/apache/shardingsphere/infra/checker/SchemaAware.java
@@ -15,20 +15,28 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.rewrite.sql.token.common.generator;
+package org.apache.shardingsphere.infra.checker;
-import
org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
+import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
+
+import java.util.Map;
/**
- * SQL token generator.
+ * Schema aware.
*/
-public interface SQLTokenGenerator {
+public interface SchemaAware {
+
+ /**
+ * Set schema meta data.
+ *
+ * @param schemas schema meta data map
+ */
+ void setSchemas(Map<String, ShardingSphereSchema> schemas);
/**
- * Judge is generate SQL token or not.
+ * Set default schema.
*
- * @param sqlStatementContext SQL statement context
- * @return is generate SQL token or not
+ * @param defaultSchema default schema
*/
- boolean isGenerateSQLToken(SQLStatementContext sqlStatementContext);
+ void setDefaultSchema(ShardingSphereSchema defaultSchema);
}
diff --git
a/infra/context/src/main/java/org/apache/shardingsphere/infra/connection/kernel/KernelProcessor.java
b/infra/context/src/main/java/org/apache/shardingsphere/infra/connection/kernel/KernelProcessor.java
index 983d56f5a9c..5fb7a0f8b40 100644
---
a/infra/context/src/main/java/org/apache/shardingsphere/infra/connection/kernel/KernelProcessor.java
+++
b/infra/context/src/main/java/org/apache/shardingsphere/infra/connection/kernel/KernelProcessor.java
@@ -17,6 +17,8 @@
package org.apache.shardingsphere.infra.connection.kernel;
+import org.apache.shardingsphere.infra.annotation.HighFrequencyInvocation;
+import org.apache.shardingsphere.infra.checker.SQLSupportedCheckEngine;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
import org.apache.shardingsphere.infra.executor.sql.context.ExecutionContext;
@@ -34,6 +36,7 @@ import
org.apache.shardingsphere.infra.session.query.QueryContext;
/**
* Kernel processor.
*/
+@HighFrequencyInvocation
public final class KernelProcessor {
/**
@@ -47,6 +50,7 @@ public final class KernelProcessor {
*/
public ExecutionContext generateExecutionContext(final QueryContext
queryContext, final RuleMetaData globalRuleMetaData,
final
ConfigurationProperties props, final ConnectionContext connectionContext) {
+ check(queryContext);
RouteContext routeContext = route(queryContext, globalRuleMetaData,
props, connectionContext);
SQLRewriteResult rewriteResult = rewrite(queryContext,
globalRuleMetaData, props, routeContext, connectionContext);
ExecutionContext result = createExecutionContext(queryContext,
routeContext, rewriteResult);
@@ -54,6 +58,11 @@ public final class KernelProcessor {
return result;
}
+ private void check(final QueryContext queryContext) {
+ ShardingSphereDatabase database = queryContext.getUsedDatabase();
+ new
SQLSupportedCheckEngine().checkSQL(database.getRuleMetaData().getRules(),
queryContext.getSqlStatementContext(), database.getSchemas(),
database.getName());
+ }
+
private RouteContext route(final QueryContext queryContext, final
RuleMetaData globalRuleMetaData, final ConfigurationProperties props, final
ConnectionContext connectionContext) {
ShardingSphereDatabase database = queryContext.getUsedDatabase();
return new SQLRouteEngine(database.getRuleMetaData().getRules(),
props).route(connectionContext, queryContext, globalRuleMetaData, database);
diff --git a/infra/pom.xml b/infra/pom.xml
index fd6d6f75023..f488ac871cb 100644
--- a/infra/pom.xml
+++ b/infra/pom.xml
@@ -39,8 +39,9 @@
<module>distsql-handler</module>
<module>parser</module>
<module>binder</module>
- <module>rewrite</module>
+ <module>checker</module>
<module>route</module>
+ <module>rewrite</module>
<module>merge</module>
<module>executor</module>
<module>session</module>
diff --git
a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/SQLRewriteEntry.java
b/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/SQLRewriteEntry.java
index 889948b7fd1..a445b985165 100644
---
a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/SQLRewriteEntry.java
+++
b/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/SQLRewriteEntry.java
@@ -79,14 +79,13 @@ public final class SQLRewriteEntry {
private SQLRewriteContext createSQLRewriteContext(final QueryContext
queryContext, final RouteContext routeContext, final ConnectionContext
connectionContext) {
HintValueContext hintValueContext = queryContext.getHintValueContext();
SQLRewriteContext result = new SQLRewriteContext(database,
queryContext.getSqlStatementContext(), queryContext.getSql(),
queryContext.getParameters(), connectionContext, hintValueContext);
- decorate(decorators, result, routeContext, hintValueContext);
+ decorate(result, routeContext, hintValueContext);
result.generateSQLTokens();
return result;
}
@SuppressWarnings({"unchecked", "rawtypes"})
- private void decorate(final Map<ShardingSphereRule,
SQLRewriteContextDecorator> decorators, final SQLRewriteContext
sqlRewriteContext,
- final RouteContext routeContext, final
HintValueContext hintValueContext) {
+ private void decorate(final SQLRewriteContext sqlRewriteContext, final
RouteContext routeContext, final HintValueContext hintValueContext) {
if (hintValueContext.isSkipSQLRewrite()) {
return;
}
diff --git
a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/common/generator/SQLTokenGenerator.java
b/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/common/generator/SQLTokenGenerator.java
index be1d85aede7..f2d5b6ed526 100644
---
a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/common/generator/SQLTokenGenerator.java
+++
b/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/common/generator/SQLTokenGenerator.java
@@ -25,7 +25,7 @@ import
org.apache.shardingsphere.infra.binder.context.statement.SQLStatementCont
public interface SQLTokenGenerator {
/**
- * Judge is generate SQL token or not.
+ * Judge whether need to generate SQL token.
*
* @param sqlStatementContext SQL statement context
* @return is generate SQL token or not
diff --git a/infra/route/pom.xml b/infra/route/pom.xml
index 7b781aab87f..ddef360752a 100644
--- a/infra/route/pom.xml
+++ b/infra/route/pom.xml
@@ -32,5 +32,10 @@
<artifactId>shardingsphere-infra-session</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-checker</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>