diff --git a/docs/document/content/user-manual/error-code/sql-error-code.cn.md b/docs/document/content/user-manual/error-code/sql-error-code.cn.md index 512c44ad4aa55..cd11a39db6c4f 100644 --- a/docs/document/content/user-manual/error-code/sql-error-code.cn.md +++ b/docs/document/content/user-manual/error-code/sql-error-code.cn.md @@ -181,6 +181,13 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供, | 20088 | 44000 | Cannot found routing table factor, data source: %s, actual table: %s. | | 20090 | 42000 | Not allow DML operation without sharding conditions. | +### 联邦查询 + +| Vendor Code | SQL State | 错误信息 | +|-------------|-----------|---------------------------------------------------------| +| 20100 | 42000 | Unsupported SQL node conversion for SQL statement '%s'. | +| 20101 | 42000 | SQL federation does not support SQL '%s'. | + ### 读写分离 | Vendor Code | SQL State | 错误信息 | @@ -235,13 +242,6 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供, | 20840 | 42000 | Insert value of index \`%s\` can not support for shadow. | | 20881 | 44000 | Default shadow algorithm class should be implement HintShadowAlgorithm. | -### 联邦查询 - -| Vendor Code | SQL State | 错误信息 | -|-------------|-----------|-----------------------------------------------------------| -| 22040 | 42000 | Unsupported SQL node conversion for SQL statement \`%s\`. | -| 22041 | 42000 | SQL federation doesn't support SQL \`%s\` execution. | - ## 其他异常 | Vendor Code | SQL State | 错误信息 | diff --git a/docs/document/content/user-manual/error-code/sql-error-code.en.md b/docs/document/content/user-manual/error-code/sql-error-code.en.md index dbc477d991280..809bbb2351d46 100644 --- a/docs/document/content/user-manual/error-code/sql-error-code.en.md +++ b/docs/document/content/user-manual/error-code/sql-error-code.en.md @@ -182,6 +182,13 @@ SQL error codes provide by standard `SQL State`, `Vendor Code` and `Reason`, whi | 20088 | 44000 | Cannot found routing table factor, data source: %s, actual table: %s. | | 20090 | 42000 | Not allow DML operation without sharding conditions. | +### SQL Federation + +| Vendor Code | SQL State | Reason | +|-------------|-----------|---------------------------------------------------------| +| 20100 | 42000 | Unsupported SQL node conversion for SQL statement '%s'. | +| 20101 | 42000 | SQL federation does not support SQL '%s'. | + ### Readwrite-splitting | Vendor Code | SQL State | Reason | @@ -236,13 +243,6 @@ SQL error codes provide by standard `SQL State`, `Vendor Code` and `Reason`, whi | 20840 | 42000 | Insert value of index \`%s\` can not support for shadow. | | 20881 | 44000 | Default shadow algorithm class should be implement HintShadowAlgorithm. | -### SQL Federation - -| Vendor Code | SQL State | Reason | -|-------------|-----------|-----------------------------------------------------------| -| 22040 | 42000 | Unsupported SQL node conversion for SQL statement \`%s\`. | -| 22041 | 42000 | SQL federation doesn't support SQL \`%s\` execution. | - ## Other Exception | Vendor Code | SQL State | Reason | diff --git a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/engine/SQLFederationEngine.java b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/engine/SQLFederationEngine.java index 3cc8b0fad14f3..269699f3941fc 100644 --- a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/engine/SQLFederationEngine.java +++ b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/engine/SQLFederationEngine.java @@ -59,7 +59,7 @@ import org.apache.shardingsphere.sqlfederation.optimizer.SQLFederationExecutionPlan; import org.apache.shardingsphere.sqlfederation.optimizer.context.OptimizerContext; import org.apache.shardingsphere.sqlfederation.optimizer.context.planner.OptimizerMetaData; -import org.apache.shardingsphere.sqlfederation.optimizer.exception.syntax.SQLFederationUnsupportedSQLException; +import org.apache.shardingsphere.sqlfederation.optimizer.exception.SQLFederationUnsupportedSQLException; import org.apache.shardingsphere.sqlfederation.optimizer.metadata.schema.SQLFederationTable; import org.apache.shardingsphere.sqlfederation.optimizer.planner.cache.ExecutionPlanCacheKey; import org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationPlannerUtils; diff --git a/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/converter/SQLNodeConverterEngine.java b/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/converter/SQLNodeConverterEngine.java index 30ce7e05e02d5..4c3c13aeb7426 100644 --- a/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/converter/SQLNodeConverterEngine.java +++ b/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/converter/SQLNodeConverterEngine.java @@ -35,7 +35,7 @@ import org.apache.shardingsphere.sqlfederation.optimizer.converter.statement.merge.MergeStatementConverter; import org.apache.shardingsphere.sqlfederation.optimizer.converter.statement.select.SelectStatementConverter; import org.apache.shardingsphere.sqlfederation.optimizer.converter.statement.update.UpdateStatementConverter; -import org.apache.shardingsphere.sqlfederation.optimizer.exception.convert.OptimizationSQLNodeConvertException; +import org.apache.shardingsphere.sqlfederation.optimizer.exception.OptimizationSQLNodeConvertException; import java.util.Optional; diff --git a/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/exception/convert/OptimizationSQLNodeConvertException.java b/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/exception/OptimizationSQLNodeConvertException.java similarity index 85% rename from kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/exception/convert/OptimizationSQLNodeConvertException.java rename to kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/exception/OptimizationSQLNodeConvertException.java index f2c560e5c6dd8..e34c07835b421 100644 --- a/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/exception/convert/OptimizationSQLNodeConvertException.java +++ b/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/exception/OptimizationSQLNodeConvertException.java @@ -15,11 +15,10 @@ * limitations under the License. */ -package org.apache.shardingsphere.sqlfederation.optimizer.exception.convert; +package org.apache.shardingsphere.sqlfederation.optimizer.exception; import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState; import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement; -import org.apache.shardingsphere.sqlfederation.optimizer.exception.SQLFederationSQLException; /** * Optimization SQL node convert exception. @@ -29,6 +28,6 @@ public final class OptimizationSQLNodeConvertException extends SQLFederationSQLE private static final long serialVersionUID = 7115939407266382363L; public OptimizationSQLNodeConvertException(final SQLStatement statement) { - super(XOpenSQLState.SYNTAX_ERROR, 40, "Unsupported SQL node conversion for SQL statement `%s`.", statement.toString()); + super(XOpenSQLState.SYNTAX_ERROR, 0, "Unsupported SQL node conversion for SQL statement '%s'.", statement); } } diff --git a/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/exception/SQLFederationSQLException.java b/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/exception/SQLFederationSQLException.java index 60cbd8bbe0e1e..1e688aab9210a 100644 --- a/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/exception/SQLFederationSQLException.java +++ b/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/exception/SQLFederationSQLException.java @@ -27,7 +27,7 @@ public abstract class SQLFederationSQLException extends FeatureSQLException { private static final long serialVersionUID = 4689889693356895996L; - private static final int FEATURE_CODE = 20; + private static final int FEATURE_CODE = 1; protected SQLFederationSQLException(final SQLState sqlState, final int errorCode, final String reason, final Object... messageArgs) { super(sqlState, FEATURE_CODE, errorCode, reason, messageArgs); diff --git a/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/exception/syntax/SQLFederationUnsupportedSQLException.java b/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/exception/SQLFederationUnsupportedSQLException.java similarity index 85% rename from kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/exception/syntax/SQLFederationUnsupportedSQLException.java rename to kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/exception/SQLFederationUnsupportedSQLException.java index 1f7666a4b0adf..c38fcfdc1f023 100644 --- a/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/exception/syntax/SQLFederationUnsupportedSQLException.java +++ b/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/exception/SQLFederationUnsupportedSQLException.java @@ -15,10 +15,9 @@ * limitations under the License. */ -package org.apache.shardingsphere.sqlfederation.optimizer.exception.syntax; +package org.apache.shardingsphere.sqlfederation.optimizer.exception; import org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState; -import org.apache.shardingsphere.sqlfederation.optimizer.exception.SQLFederationSQLException; /** * SQL federation unsupported SQL exception. @@ -28,6 +27,6 @@ public final class SQLFederationUnsupportedSQLException extends SQLFederationSQL private static final long serialVersionUID = -8571244162760408846L; public SQLFederationUnsupportedSQLException(final String sql) { - super(XOpenSQLState.SYNTAX_ERROR, 41, "SQL federation doesn't support SQL `%s` execution.", sql); + super(XOpenSQLState.SYNTAX_ERROR, 1, "SQL federation does not support SQL '%s'.", sql); } }