This is an automated email from the ASF dual-hosted git repository.

zhangliang 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 068f921da60 Refactor SQLStatementBinderContext (#35499)
068f921da60 is described below

commit 068f921da607b1708265d4a0038e981768f0c692
Author: Liang Zhang <zhangli...@apache.org>
AuthorDate: Sat May 24 15:59:26 2025 +0800

    Refactor SQLStatementBinderContext (#35499)
    
    * Refactor CommonSQLStatementContext
    
    * Refactor SQLStatementBinderContext
---
 .../binder/context/statement/CommonSQLStatementContext.java    |  5 -----
 .../shardingsphere/infra/binder/engine/SQLBindEngine.java      |  8 ++++----
 .../binder/engine/statement/dal/ExplainStatementBinder.java    |  2 +-
 .../infra/binder/engine/type/DALStatementBindEngine.java       |  5 ++++-
 .../infra/binder/engine/type/DCLStatementBindEngine.java       |  5 ++++-
 .../infra/binder/engine/type/DDLStatementBindEngine.java       |  5 ++++-
 .../infra/binder/engine/type/DMLStatementBindEngine.java       |  5 +++--
 .../binder/engine/statement/dml/DeleteStatementBinderTest.java |  6 +++++-
 .../binder/engine/statement/dml/InsertStatementBinderTest.java | 10 +++++++---
 .../binder/engine/statement/dml/SelectStatementBinderTest.java |  6 +++++-
 .../binder/engine/statement/dml/UpdateStatementBinderTest.java |  6 +++++-
 11 files changed, 42 insertions(+), 21 deletions(-)

diff --git 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/CommonSQLStatementContext.java
 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/CommonSQLStatementContext.java
index a3779d1dc79..666f6b8acb8 100644
--- 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/CommonSQLStatementContext.java
+++ 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/CommonSQLStatementContext.java
@@ -32,9 +32,4 @@ public abstract class CommonSQLStatementContext implements 
SQLStatementContext {
     private final DatabaseType databaseType;
     
     private final SQLStatement sqlStatement;
-    
-    protected CommonSQLStatementContext(final SQLStatement sqlStatement) {
-        databaseType = sqlStatement.getDatabaseType();
-        this.sqlStatement = sqlStatement;
-    }
 }
diff --git 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/SQLBindEngine.java
 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/SQLBindEngine.java
index d22723e5a8f..862f0891b4f 100644
--- 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/SQLBindEngine.java
+++ 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/SQLBindEngine.java
@@ -78,16 +78,16 @@ public final class SQLBindEngine {
     
     private SQLStatement bindSQLStatement(final DatabaseType databaseType, 
final SQLStatement statement) {
         if (statement instanceof DMLStatement) {
-            return new DMLStatementBindEngine(metaData, currentDatabaseName, 
hintValueContext).bind(databaseType, (DMLStatement) statement);
+            return new DMLStatementBindEngine(metaData, currentDatabaseName, 
hintValueContext, databaseType).bind((DMLStatement) statement);
         }
         if (statement instanceof DDLStatement) {
-            return new DDLStatementBindEngine(metaData, currentDatabaseName, 
hintValueContext).bind((DDLStatement) statement);
+            return new DDLStatementBindEngine(metaData, currentDatabaseName, 
hintValueContext, databaseType).bind((DDLStatement) statement);
         }
         if (statement instanceof DALStatement) {
-            return new DALStatementBindEngine(metaData, currentDatabaseName, 
hintValueContext).bind((DALStatement) statement);
+            return new DALStatementBindEngine(metaData, currentDatabaseName, 
hintValueContext, databaseType).bind((DALStatement) statement);
         }
         if (statement instanceof DCLStatement) {
-            return new DCLStatementBindEngine(metaData, currentDatabaseName, 
hintValueContext).bind((DCLStatement) statement);
+            return new DCLStatementBindEngine(metaData, currentDatabaseName, 
hintValueContext, databaseType).bind((DCLStatement) statement);
         }
         return statement;
     }
diff --git 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/statement/dal/ExplainStatementBinder.java
 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/statement/dal/ExplainStatementBinder.java
index 82aca5482de..b7a50b1dc76 100644
--- 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/statement/dal/ExplainStatementBinder.java
+++ 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/statement/dal/ExplainStatementBinder.java
@@ -45,7 +45,7 @@ public final class ExplainStatementBinder implements 
SQLStatementBinder<ExplainS
         ExplainStatement result = copy(sqlStatement);
         SQLStatement explainSQLStatement = sqlStatement.getSqlStatement();
         SQLStatement boundSQLStatement = explainSQLStatement instanceof 
DMLStatement
-                ? new DMLStatementBindEngine(metaData, currentDatabaseName, 
hintValueContext).bind(binderContext.getDatabaseType(), (DMLStatement) 
explainSQLStatement)
+                ? new DMLStatementBindEngine(metaData, currentDatabaseName, 
hintValueContext, binderContext.getDatabaseType()).bind((DMLStatement) 
explainSQLStatement)
                 : explainSQLStatement;
         result.setSqlStatement(boundSQLStatement);
         return result;
diff --git 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/type/DALStatementBindEngine.java
 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/type/DALStatementBindEngine.java
index daee8792288..e654342af2c 100644
--- 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/type/DALStatementBindEngine.java
+++ 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/type/DALStatementBindEngine.java
@@ -24,6 +24,7 @@ import 
org.apache.shardingsphere.infra.binder.engine.statement.dal.OptimizeTable
 import 
org.apache.shardingsphere.infra.binder.engine.statement.dal.ShowColumnsStatementBinder;
 import 
org.apache.shardingsphere.infra.binder.engine.statement.dal.ShowCreateTableStatementBinder;
 import 
org.apache.shardingsphere.infra.binder.engine.statement.dal.ShowIndexStatementBinder;
+import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
 import org.apache.shardingsphere.infra.hint.HintValueContext;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.dal.DALStatement;
@@ -45,6 +46,8 @@ public final class DALStatementBindEngine {
     
     private final HintValueContext hintValueContext;
     
+    private final DatabaseType databaseType;
+    
     /**
      * Bind DAL statement.
      *
@@ -52,7 +55,7 @@ public final class DALStatementBindEngine {
      * @return bound DAL statement
      */
     public DALStatement bind(final DALStatement statement) {
-        SQLStatementBinderContext binderContext = new 
SQLStatementBinderContext(metaData, currentDatabaseName, hintValueContext, 
statement);
+        SQLStatementBinderContext binderContext = new 
SQLStatementBinderContext(metaData, currentDatabaseName, hintValueContext, 
databaseType, statement);
         if (statement instanceof OptimizeTableStatement) {
             return new 
OptimizeTableStatementBinder().bind((OptimizeTableStatement) statement, 
binderContext);
         }
diff --git 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/type/DCLStatementBindEngine.java
 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/type/DCLStatementBindEngine.java
index fa0d8f0aabe..7ea911aa758 100644
--- 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/type/DCLStatementBindEngine.java
+++ 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/type/DCLStatementBindEngine.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.infra.binder.engine.type;
 import lombok.RequiredArgsConstructor;
 import 
org.apache.shardingsphere.infra.binder.engine.statement.SQLStatementBinderContext;
 import 
org.apache.shardingsphere.infra.binder.engine.statement.dcl.DenyUserStatementBinder;
+import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
 import org.apache.shardingsphere.infra.hint.HintValueContext;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.dcl.DCLStatement;
@@ -37,6 +38,8 @@ public final class DCLStatementBindEngine {
     
     private final HintValueContext hintValueContext;
     
+    private final DatabaseType databaseType;
+    
     /**
      * Bind DCL statement.
      *
@@ -44,7 +47,7 @@ public final class DCLStatementBindEngine {
      * @return bound DCL statement
      */
     public DCLStatement bind(final DCLStatement statement) {
-        SQLStatementBinderContext binderContext = new 
SQLStatementBinderContext(metaData, currentDatabaseName, hintValueContext, 
statement);
+        SQLStatementBinderContext binderContext = new 
SQLStatementBinderContext(metaData, currentDatabaseName, hintValueContext, 
databaseType, statement);
         if (statement instanceof DenyUserStatement) {
             return new DenyUserStatementBinder().bind((DenyUserStatement) 
statement, binderContext);
         }
diff --git 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/type/DDLStatementBindEngine.java
 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/type/DDLStatementBindEngine.java
index f579afbf8ab..d1239ee9a88 100644
--- 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/type/DDLStatementBindEngine.java
+++ 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/type/DDLStatementBindEngine.java
@@ -31,6 +31,7 @@ import 
org.apache.shardingsphere.infra.binder.engine.statement.ddl.DropTableStat
 import 
org.apache.shardingsphere.infra.binder.engine.statement.ddl.DropViewStatementBinder;
 import 
org.apache.shardingsphere.infra.binder.engine.statement.ddl.RenameTableStatementBinder;
 import 
org.apache.shardingsphere.infra.binder.engine.statement.ddl.TruncateStatementBinder;
+import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
 import org.apache.shardingsphere.infra.hint.HintValueContext;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterIndexStatement;
@@ -59,6 +60,8 @@ public final class DDLStatementBindEngine {
     
     private final HintValueContext hintValueContext;
     
+    private final DatabaseType databaseType;
+    
     /**
      * Bind DDL statement.
      *
@@ -66,7 +69,7 @@ public final class DDLStatementBindEngine {
      * @return bound DDL statement
      */
     public DDLStatement bind(final DDLStatement statement) {
-        SQLStatementBinderContext binderContext = new 
SQLStatementBinderContext(metaData, currentDatabaseName, hintValueContext, 
statement);
+        SQLStatementBinderContext binderContext = new 
SQLStatementBinderContext(metaData, currentDatabaseName, hintValueContext, 
databaseType, statement);
         if (statement instanceof CursorStatement) {
             return new CursorStatementBinder().bind((CursorStatement) 
statement, binderContext);
         }
diff --git 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/type/DMLStatementBindEngine.java
 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/type/DMLStatementBindEngine.java
index f6fbf255689..4a42932b189 100644
--- 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/type/DMLStatementBindEngine.java
+++ 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/type/DMLStatementBindEngine.java
@@ -50,14 +50,15 @@ public final class DMLStatementBindEngine {
     
     private final HintValueContext hintValueContext;
     
+    private final DatabaseType databaseType;
+    
     /**
      * Bind DML statement.
      *
-     * @param databaseType database type
      * @param statement to be bound DML statement
      * @return bound DML statement
      */
-    public DMLStatement bind(final DatabaseType databaseType, final 
DMLStatement statement) {
+    public DMLStatement bind(final DMLStatement statement) {
         SQLStatementBinderContext binderContext = new 
SQLStatementBinderContext(metaData, currentDatabaseName, hintValueContext, 
databaseType, statement);
         if (statement instanceof SelectStatement) {
             return new SelectStatementBinder().bind((SelectStatement) 
statement, binderContext);
diff --git 
a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/DeleteStatementBinderTest.java
 
b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/DeleteStatementBinderTest.java
index 5b011b7c620..4c0860a7394 100644
--- 
a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/DeleteStatementBinderTest.java
+++ 
b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/DeleteStatementBinderTest.java
@@ -18,10 +18,12 @@
 package org.apache.shardingsphere.infra.binder.engine.statement.dml;
 
 import 
org.apache.shardingsphere.infra.binder.engine.statement.SQLStatementBinderContext;
+import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
 import org.apache.shardingsphere.infra.hint.HintValueContext;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
 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.simple.LiteralExpressionSegment;
@@ -47,6 +49,8 @@ import static org.mockito.Mockito.when;
 
 class DeleteStatementBinderTest {
     
+    private final DatabaseType databaseType = 
TypedSPILoader.getService(DatabaseType.class, "FIXTURE");
+    
     @Test
     void assertBind() {
         DeleteStatement deleteStatement = new SQL92DeleteStatement();
@@ -54,7 +58,7 @@ class DeleteStatementBinderTest {
         deleteStatement.setTable(simpleTableSegment);
         deleteStatement.setWhere(new WhereSegment(0, 0, new 
BinaryOperationExpression(0, 0, new ColumnSegment(0, 0, new 
IdentifierValue("status")),
                 new LiteralExpressionSegment(0, 0, 0), "=", "status = 1")));
-        DeleteStatement actual = new 
DeleteStatementBinder().bind(deleteStatement, new 
SQLStatementBinderContext(createMetaData(), "foo_db", new HintValueContext(), 
deleteStatement));
+        DeleteStatement actual = new 
DeleteStatementBinder().bind(deleteStatement, new 
SQLStatementBinderContext(createMetaData(), "foo_db", new HintValueContext(), 
databaseType, deleteStatement));
         assertThat(actual, not(deleteStatement));
         assertThat(actual.getTable(), not(deleteStatement.getTable()));
         assertThat(actual.getTable(), instanceOf(SimpleTableSegment.class));
diff --git 
a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/InsertStatementBinderTest.java
 
b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/InsertStatementBinderTest.java
index ba025b76c7c..84cf5863ef0 100644
--- 
a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/InsertStatementBinderTest.java
+++ 
b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/InsertStatementBinderTest.java
@@ -18,10 +18,12 @@
 package org.apache.shardingsphere.infra.binder.engine.statement.dml;
 
 import 
org.apache.shardingsphere.infra.binder.engine.statement.SQLStatementBinderContext;
+import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
 import org.apache.shardingsphere.infra.hint.HintValueContext;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.assignment.InsertValuesSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.ColumnSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.InsertColumnsSegment;
@@ -55,6 +57,8 @@ import static org.mockito.Mockito.when;
 
 class InsertStatementBinderTest {
     
+    private final DatabaseType databaseType = 
TypedSPILoader.getService(DatabaseType.class, "FIXTURE");
+    
     @Test
     void assertBindInsertValues() {
         InsertStatement insertStatement = new SQL92InsertStatement();
@@ -63,7 +67,7 @@ class InsertStatementBinderTest {
                 new ColumnSegment(0, 0, new IdentifierValue("user_id")), new 
ColumnSegment(0, 0, new IdentifierValue("status")))));
         insertStatement.getValues().add(new InsertValuesSegment(0, 0, 
Arrays.asList(new LiteralExpressionSegment(0, 0, 1),
                 new LiteralExpressionSegment(0, 0, 1), new 
LiteralExpressionSegment(0, 0, "OK"))));
-        InsertStatement actual = new 
InsertStatementBinder().bind(insertStatement, new 
SQLStatementBinderContext(createMetaData(), "foo_db", new HintValueContext(), 
insertStatement));
+        InsertStatement actual = new 
InsertStatementBinder().bind(insertStatement, new 
SQLStatementBinderContext(createMetaData(), "foo_db", new HintValueContext(), 
databaseType, insertStatement));
         assertThat(actual, not(insertStatement));
         assertTrue(actual.getTable().isPresent());
         assertTrue(insertStatement.getTable().isPresent());
@@ -108,7 +112,7 @@ class InsertStatementBinderTest {
         insertStatement.setInsertSelect(new SubquerySegment(0, 0, 
subSelectStatement, ""));
         insertStatement.getValues().add(new InsertValuesSegment(0, 0, 
Arrays.asList(new LiteralExpressionSegment(0, 0, 1),
                 new LiteralExpressionSegment(0, 0, 1), new 
LiteralExpressionSegment(0, 0, "OK"))));
-        InsertStatement actual = new 
InsertStatementBinder().bind(insertStatement, new 
SQLStatementBinderContext(createMetaData(), "foo_db", new HintValueContext(), 
insertStatement));
+        InsertStatement actual = new 
InsertStatementBinder().bind(insertStatement, new 
SQLStatementBinderContext(createMetaData(), "foo_db", new HintValueContext(), 
databaseType, insertStatement));
         assertThat(actual, not(insertStatement));
         assertTrue(actual.getTable().isPresent());
         assertTrue(insertStatement.getTable().isPresent());
@@ -132,7 +136,7 @@ class InsertStatementBinderTest {
         insertStatement.setInsertSelect(new SubquerySegment(0, 0, 
subSelectStatement, ""));
         insertStatement.getValues().add(new InsertValuesSegment(0, 0, 
Arrays.asList(new LiteralExpressionSegment(0, 0, 1),
                 new LiteralExpressionSegment(0, 0, 1), new 
LiteralExpressionSegment(0, 0, "OK"))));
-        InsertStatement actual = new 
InsertStatementBinder().bind(insertStatement, new 
SQLStatementBinderContext(createMetaData(), "foo_db", new HintValueContext(), 
insertStatement));
+        InsertStatement actual = new 
InsertStatementBinder().bind(insertStatement, new 
SQLStatementBinderContext(createMetaData(), "foo_db", new HintValueContext(), 
databaseType, insertStatement));
         assertThat(actual, not(insertStatement));
         assertTrue(actual.getTable().isPresent());
         assertTrue(insertStatement.getTable().isPresent());
diff --git 
a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/SelectStatementBinderTest.java
 
b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/SelectStatementBinderTest.java
index dd435d20566..bc5aca0a4ed 100644
--- 
a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/SelectStatementBinderTest.java
+++ 
b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/SelectStatementBinderTest.java
@@ -18,10 +18,12 @@
 package org.apache.shardingsphere.infra.binder.engine.statement.dml;
 
 import 
org.apache.shardingsphere.infra.binder.engine.statement.SQLStatementBinderContext;
+import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
 import org.apache.shardingsphere.infra.hint.HintValueContext;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
 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.FunctionSegment;
@@ -53,6 +55,8 @@ import static org.mockito.Mockito.when;
 
 class SelectStatementBinderTest {
     
+    private final DatabaseType databaseType = 
TypedSPILoader.getService(DatabaseType.class, "FIXTURE");
+    
     @Test
     void assertBind() {
         SelectStatement selectStatement = new SQL92SelectStatement();
@@ -67,7 +71,7 @@ class SelectStatementBinderTest {
         SimpleTableSegment simpleTableSegment = new SimpleTableSegment(new 
TableNameSegment(0, 0, new IdentifierValue("t_order")));
         selectStatement.setFrom(simpleTableSegment);
         selectStatement.setWhere(mockWhereSegment());
-        SelectStatement actual = new 
SelectStatementBinder().bind(selectStatement, new 
SQLStatementBinderContext(createMetaData(), "foo_db", new HintValueContext(), 
selectStatement));
+        SelectStatement actual = new 
SelectStatementBinder().bind(selectStatement, new 
SQLStatementBinderContext(createMetaData(), "foo_db", new HintValueContext(), 
databaseType, selectStatement));
         assertThat(actual, not(selectStatement));
         assertTrue(actual.getFrom().isPresent());
         assertThat(actual.getFrom().get(), not(simpleTableSegment));
diff --git 
a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/UpdateStatementBinderTest.java
 
b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/UpdateStatementBinderTest.java
index 6d87ee53caa..f1d03f0fe6f 100644
--- 
a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/UpdateStatementBinderTest.java
+++ 
b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/UpdateStatementBinderTest.java
@@ -18,10 +18,12 @@
 package org.apache.shardingsphere.infra.binder.engine.statement.dml;
 
 import 
org.apache.shardingsphere.infra.binder.engine.statement.SQLStatementBinderContext;
+import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
 import org.apache.shardingsphere.infra.hint.HintValueContext;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
 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.simple.LiteralExpressionSegment;
@@ -47,6 +49,8 @@ import static org.mockito.Mockito.when;
 
 class UpdateStatementBinderTest {
     
+    private final DatabaseType databaseType = 
TypedSPILoader.getService(DatabaseType.class, "FIXTURE");
+    
     @Test
     void assertBind() {
         UpdateStatement updateStatement = new SQL92UpdateStatement();
@@ -54,7 +58,7 @@ class UpdateStatementBinderTest {
         updateStatement.setTable(simpleTableSegment);
         updateStatement.setWhere(new WhereSegment(0, 0, new 
BinaryOperationExpression(0, 0, new ColumnSegment(0, 0, new 
IdentifierValue("status")),
                 new LiteralExpressionSegment(0, 0, 0), "=", "status = 1")));
-        UpdateStatement actual = new 
UpdateStatementBinder().bind(updateStatement, new 
SQLStatementBinderContext(createMetaData(), "foo_db", new HintValueContext(), 
updateStatement));
+        UpdateStatement actual = new 
UpdateStatementBinder().bind(updateStatement, new 
SQLStatementBinderContext(createMetaData(), "foo_db", new HintValueContext(), 
databaseType, updateStatement));
         assertThat(actual, not(updateStatement));
         assertThat(actual.getTable(), not(updateStatement.getTable()));
         assertThat(actual.getTable(), instanceOf(SimpleTableSegment.class));

Reply via email to