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 7a5dd9d1483 Move package of WithAvailable (#35737)
7a5dd9d1483 is described below

commit 7a5dd9d1483b315ba68913ff8edfc7f358f06642
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Jun 17 21:13:56 2025 +0800

    Move package of WithAvailable (#35737)
    
    * Move package of WithAvailable
    
    * Move package of WithAvailable
---
 .../sql/with/EncryptWithClauseSupportedChecker.java     |  9 +++------
 .../sql/with/EncryptWithClauseSupportedCheckerTest.java |  2 +-
 .../statement/type/dml/DeleteStatementContext.java      | 10 +---------
 .../statement/type/dml/InsertStatementContext.java      |  9 +--------
 .../statement/type/dml/SelectStatementContext.java      |  9 +--------
 .../statement/type/dml/UpdateStatementContext.java      | 10 +---------
 .../core/statement/available}/WithAvailable.java        |  2 +-
 .../statement/core/statement/dml/DeleteStatement.java   | 17 +++++++----------
 .../statement/core/statement/dml/InsertStatement.java   | 17 +++++++----------
 .../statement/core/statement/dml/SelectStatement.java   | 17 +++++++----------
 .../statement/core/statement/dml/UpdateStatement.java   | 17 +++++++----------
 11 files changed, 37 insertions(+), 82 deletions(-)

diff --git 
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/sql/with/EncryptWithClauseSupportedChecker.java
 
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/sql/with/EncryptWithClauseSupportedChecker.java
index 7b0687eeaf4..9582bbfe2c3 100644
--- 
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/sql/with/EncryptWithClauseSupportedChecker.java
+++ 
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/sql/with/EncryptWithClauseSupportedChecker.java
@@ -22,13 +22,11 @@ import org.apache.shardingsphere.encrypt.rule.EncryptRule;
 import org.apache.shardingsphere.infra.annotation.HighFrequencyInvocation;
 import 
org.apache.shardingsphere.infra.binder.context.extractor.SQLStatementContextExtractor;
 import 
org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
-import org.apache.shardingsphere.infra.binder.context.type.WithAvailable;
 import org.apache.shardingsphere.infra.checker.SupportedSQLChecker;
 import 
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
 import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
-
-import java.util.Collection;
+import 
org.apache.shardingsphere.sql.parser.statement.core.statement.available.WithAvailable;
 
 /**
  * With clause supported checker for encrypt.
@@ -38,13 +36,12 @@ public final class EncryptWithClauseSupportedChecker 
implements SupportedSQLChec
     
     @Override
     public boolean isCheck(final SQLStatementContext sqlStatementContext) {
-        return sqlStatementContext instanceof WithAvailable && 
((WithAvailable) sqlStatementContext).getWith().isPresent();
+        return sqlStatementContext.getSqlStatement() instanceof WithAvailable 
&& ((WithAvailable) 
sqlStatementContext.getSqlStatement()).getWith().isPresent();
     }
     
     @Override
     public void check(final EncryptRule rule, final ShardingSphereDatabase 
database, final ShardingSphereSchema currentSchema, final SQLStatementContext 
sqlStatementContext) {
-        Collection<String> tableNames = 
SQLStatementContextExtractor.getTableNames(database, sqlStatementContext);
-        for (String each : tableNames) {
+        for (String each : 
SQLStatementContextExtractor.getTableNames(database, sqlStatementContext)) {
             
ShardingSpherePreconditions.checkState(!rule.findEncryptTable(each).isPresent(),
 () -> new UnsupportedEncryptSQLException("WITH"));
         }
     }
diff --git 
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/sql/with/EncryptWithClauseSupportedCheckerTest.java
 
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/sql/with/EncryptWithClauseSupportedCheckerTest.java
index 76916654968..b4583baf78a 100644
--- 
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/sql/with/EncryptWithClauseSupportedCheckerTest.java
+++ 
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/sql/with/EncryptWithClauseSupportedCheckerTest.java
@@ -38,7 +38,7 @@ class EncryptWithClauseSupportedCheckerTest {
     @Test
     void assertIsCheck() {
         SelectStatementContext sqlStatementContext = 
mock(SelectStatementContext.class, RETURNS_DEEP_STUBS);
-        when(sqlStatementContext.getWith().isPresent()).thenReturn(true);
+        
when(sqlStatementContext.getSqlStatement().getWith().isPresent()).thenReturn(true);
         assertTrue(new 
EncryptWithClauseSupportedChecker().isCheck(sqlStatementContext));
     }
     
diff --git 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/DeleteStatementContext.java
 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/DeleteStatementContext.java
index 1ece6af6a20..67fb08e4e0c 100644
--- 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/DeleteStatementContext.java
+++ 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/DeleteStatementContext.java
@@ -21,7 +21,6 @@ import lombok.Getter;
 import 
org.apache.shardingsphere.infra.binder.context.segment.table.TablesContext;
 import 
org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
 import org.apache.shardingsphere.infra.binder.context.type.WhereAvailable;
-import org.apache.shardingsphere.infra.binder.context.type.WithAvailable;
 import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
 import 
org.apache.shardingsphere.sql.parser.statement.core.extractor.ColumnExtractor;
 import 
org.apache.shardingsphere.sql.parser.statement.core.extractor.ExpressionExtractor;
@@ -29,7 +28,6 @@ import 
org.apache.shardingsphere.sql.parser.statement.core.extractor.TableExtrac
 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.predicate.WhereSegment;
-import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.WithSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.dml.DeleteStatement;
 
@@ -37,13 +35,12 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.Map;
-import java.util.Optional;
 
 /**
  * Delete statement context.
  */
 @Getter
-public final class DeleteStatementContext implements SQLStatementContext, 
WhereAvailable, WithAvailable {
+public final class DeleteStatementContext implements SQLStatementContext, 
WhereAvailable {
     
     private final DatabaseType databaseType;
     
@@ -112,9 +109,4 @@ public final class DeleteStatementContext implements 
SQLStatementContext, WhereA
     public Collection<BinaryOperationExpression> getJoinConditions() {
         return joinConditions;
     }
-    
-    @Override
-    public Optional<WithSegment> getWith() {
-        return sqlStatement.getWith();
-    }
 }
diff --git 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/InsertStatementContext.java
 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/InsertStatementContext.java
index beb29bdfebf..fe902af360d 100644
--- 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/InsertStatementContext.java
+++ 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/InsertStatementContext.java
@@ -28,7 +28,6 @@ import 
org.apache.shardingsphere.infra.binder.context.segment.insert.values.OnDu
 import 
org.apache.shardingsphere.infra.binder.context.segment.table.TablesContext;
 import 
org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
 import org.apache.shardingsphere.infra.binder.context.type.WhereAvailable;
-import org.apache.shardingsphere.infra.binder.context.type.WithAvailable;
 import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
 import org.apache.shardingsphere.infra.database.core.type.DatabaseTypeRegistry;
 import 
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
@@ -49,7 +48,6 @@ import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.Bina
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.ExpressionSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.subquery.SubquerySegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.predicate.WhereSegment;
-import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.WithSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.dml.InsertStatement;
 
@@ -67,7 +65,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 /**
  * Insert SQL statement context.
  */
-public final class InsertStatementContext implements SQLStatementContext, 
ParameterAware, WhereAvailable, WithAvailable {
+public final class InsertStatementContext implements SQLStatementContext, 
ParameterAware, WhereAvailable {
     
     private final ShardingSphereMetaData metaData;
     
@@ -337,9 +335,4 @@ public final class InsertStatementContext implements 
SQLStatementContext, Parame
     public Collection<BinaryOperationExpression> getJoinConditions() {
         return null == insertSelectContext ? Collections.emptyList() : 
insertSelectContext.getSelectStatementContext().getJoinConditions();
     }
-    
-    @Override
-    public Optional<WithSegment> getWith() {
-        return sqlStatement.getWith();
-    }
 }
diff --git 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/SelectStatementContext.java
 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/SelectStatementContext.java
index 88fe7ab5ded..1027c132f45 100644
--- 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/SelectStatementContext.java
+++ 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/SelectStatementContext.java
@@ -39,7 +39,6 @@ import 
org.apache.shardingsphere.infra.binder.context.segment.select.projection.
 import 
org.apache.shardingsphere.infra.binder.context.segment.table.TablesContext;
 import 
org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
 import org.apache.shardingsphere.infra.binder.context.type.WhereAvailable;
-import org.apache.shardingsphere.infra.binder.context.type.WithAvailable;
 import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
 import 
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
 import 
org.apache.shardingsphere.infra.exception.dialect.exception.syntax.database.NoDatabaseSelectedException;
@@ -65,7 +64,6 @@ import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.order.ite
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.order.item.OrderByItemSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.order.item.TextOrderByItemSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.predicate.WhereSegment;
-import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.WithSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.bound.ColumnSegmentBoundInfo;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.JoinTableSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
@@ -89,7 +87,7 @@ import java.util.stream.Collectors;
  */
 @Getter
 @Setter
-public final class SelectStatementContext implements SQLStatementContext, 
WhereAvailable, ParameterAware, WithAvailable {
+public final class SelectStatementContext implements SQLStatementContext, 
WhereAvailable, ParameterAware {
     
     private final DatabaseType databaseType;
     
@@ -424,9 +422,4 @@ public final class SelectStatementContext implements 
SQLStatementContext, WhereA
     public void setUpParameters(final List<Object> params) {
         paginationContext = new 
PaginationContextEngine(getDatabaseType()).createPaginationContext(sqlStatement,
 projectionsContext, params, whereSegments);
     }
-    
-    @Override
-    public Optional<WithSegment> getWith() {
-        return sqlStatement.getWith();
-    }
 }
diff --git 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/UpdateStatementContext.java
 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/UpdateStatementContext.java
index 1c20df02dfa..d8f792ba867 100644
--- 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/UpdateStatementContext.java
+++ 
b/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/UpdateStatementContext.java
@@ -21,7 +21,6 @@ import lombok.Getter;
 import 
org.apache.shardingsphere.infra.binder.context.segment.table.TablesContext;
 import 
org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
 import org.apache.shardingsphere.infra.binder.context.type.WhereAvailable;
-import org.apache.shardingsphere.infra.binder.context.type.WithAvailable;
 import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
 import 
org.apache.shardingsphere.sql.parser.statement.core.extractor.ColumnExtractor;
 import 
org.apache.shardingsphere.sql.parser.statement.core.extractor.ExpressionExtractor;
@@ -29,19 +28,17 @@ import 
org.apache.shardingsphere.sql.parser.statement.core.extractor.TableExtrac
 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.predicate.WhereSegment;
-import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.WithSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.dml.UpdateStatement;
 
 import java.util.Collection;
 import java.util.LinkedList;
-import java.util.Optional;
 
 /**
  * Update SQL statement context.
  */
 @Getter
-public final class UpdateStatementContext implements SQLStatementContext, 
WhereAvailable, WithAvailable {
+public final class UpdateStatementContext implements SQLStatementContext, 
WhereAvailable {
     
     private final DatabaseType databaseType;
     
@@ -85,9 +82,4 @@ public final class UpdateStatementContext implements 
SQLStatementContext, WhereA
     public Collection<ColumnSegment> getColumnSegments() {
         return columnSegments;
     }
-    
-    @Override
-    public Optional<WithSegment> getWith() {
-        return sqlStatement.getWith();
-    }
 }
diff --git 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/type/WithAvailable.java
 
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/available/WithAvailable.java
similarity index 93%
rename from 
infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/type/WithAvailable.java
rename to 
parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/available/WithAvailable.java
index 1568270158b..1b98619272c 100644
--- 
a/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/type/WithAvailable.java
+++ 
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/available/WithAvailable.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.binder.context.type;
+package 
org.apache.shardingsphere.sql.parser.statement.core.statement.available;
 
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.WithSegment;
 
diff --git 
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dml/DeleteStatement.java
 
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dml/DeleteStatement.java
index 6508d0ccb78..866e628bc0a 100644
--- 
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dml/DeleteStatement.java
+++ 
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dml/DeleteStatement.java
@@ -27,6 +27,7 @@ import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.Outpu
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.WithSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.AbstractSQLStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.core.statement.available.WithAvailable;
 
 import java.util.Optional;
 
@@ -35,7 +36,7 @@ import java.util.Optional;
  */
 @Getter
 @Setter
-public final class DeleteStatement extends AbstractSQLStatement implements 
DMLStatement {
+public final class DeleteStatement extends AbstractSQLStatement implements 
DMLStatement, WithAvailable {
     
     private TableSegment table;
     
@@ -78,15 +79,6 @@ public final class DeleteStatement extends 
AbstractSQLStatement implements DMLSt
         return Optional.ofNullable(limit);
     }
     
-    /**
-     * Get with.
-     *
-     * @return with
-     */
-    public Optional<WithSegment> getWith() {
-        return Optional.ofNullable(with);
-    }
-    
     /**
      * Get returning.
      *
@@ -104,4 +96,9 @@ public final class DeleteStatement extends 
AbstractSQLStatement implements DMLSt
     public Optional<OutputSegment> getOutput() {
         return Optional.ofNullable(output);
     }
+    
+    @Override
+    public Optional<WithSegment> getWith() {
+        return Optional.ofNullable(with);
+    }
 }
diff --git 
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dml/InsertStatement.java
 
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dml/InsertStatement.java
index a7d5db22502..36743e84efc 100644
--- 
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dml/InsertStatement.java
+++ 
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dml/InsertStatement.java
@@ -37,6 +37,7 @@ import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.Outpu
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.WithSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.AbstractSQLStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.core.statement.available.WithAvailable;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -48,7 +49,7 @@ import java.util.Optional;
  */
 @Getter
 @Setter
-public final class InsertStatement extends AbstractSQLStatement implements 
DMLStatement {
+public final class InsertStatement extends AbstractSQLStatement implements 
DMLStatement, WithAvailable {
     
     private SimpleTableSegment table;
     
@@ -138,15 +139,6 @@ public final class InsertStatement extends 
AbstractSQLStatement implements DMLSt
         return Optional.ofNullable(setAssignment);
     }
     
-    /**
-     * Get with.
-     *
-     * @return with
-     */
-    public Optional<WithSegment> getWith() {
-        return Optional.ofNullable(with);
-    }
-    
     /**
      * Get output.
      *
@@ -227,4 +219,9 @@ public final class InsertStatement extends 
AbstractSQLStatement implements DMLSt
     public Optional<FunctionSegment> getRowSetFunction() {
         return Optional.ofNullable(rowSetFunction);
     }
+    
+    @Override
+    public Optional<WithSegment> getWith() {
+        return Optional.ofNullable(with);
+    }
 }
diff --git 
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dml/SelectStatement.java
 
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dml/SelectStatement.java
index 495f12b8566..ae237af065f 100644
--- 
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dml/SelectStatement.java
+++ 
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dml/SelectStatement.java
@@ -34,6 +34,7 @@ import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.Windo
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.WithSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.AbstractSQLStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.core.statement.available.WithAvailable;
 
 import java.util.Optional;
 
@@ -42,7 +43,7 @@ import java.util.Optional;
  */
 @Getter
 @Setter
-public final class SelectStatement extends AbstractSQLStatement implements 
DMLStatement {
+public final class SelectStatement extends AbstractSQLStatement implements 
DMLStatement, WithAvailable {
     
     private ProjectionsSegment projections;
     
@@ -128,15 +129,6 @@ public final class SelectStatement extends 
AbstractSQLStatement implements DMLSt
         return Optional.ofNullable(combine);
     }
     
-    /**
-     * Get with.
-     *
-     * @return with.
-     */
-    public Optional<WithSegment> getWith() {
-        return Optional.ofNullable(with);
-    }
-    
     /**
      * Get subquery type.
      *
@@ -199,4 +191,9 @@ public final class SelectStatement extends 
AbstractSQLStatement implements DMLSt
     public Optional<WithTableHintSegment> getWithTableHint() {
         return Optional.ofNullable(withTableHint);
     }
+    
+    @Override
+    public Optional<WithSegment> getWith() {
+        return Optional.ofNullable(with);
+    }
 }
diff --git 
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dml/UpdateStatement.java
 
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dml/UpdateStatement.java
index 11b92dae8b3..b59b729fa35 100644
--- 
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dml/UpdateStatement.java
+++ 
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dml/UpdateStatement.java
@@ -30,6 +30,7 @@ import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.Outpu
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.WithSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.AbstractSQLStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.core.statement.available.WithAvailable;
 
 import java.util.Optional;
 
@@ -38,7 +39,7 @@ import java.util.Optional;
  */
 @Getter
 @Setter
-public final class UpdateStatement extends AbstractSQLStatement implements 
DMLStatement {
+public final class UpdateStatement extends AbstractSQLStatement implements 
DMLStatement, WithAvailable {
     
     private TableSegment table;
     
@@ -100,15 +101,6 @@ public final class UpdateStatement extends 
AbstractSQLStatement implements DMLSt
         return Optional.ofNullable(limit);
     }
     
-    /**
-     * Get with.
-     *
-     * @return with
-     */
-    public Optional<WithSegment> getWith() {
-        return Optional.ofNullable(with);
-    }
-    
     /**
      * Get option hint.
      *
@@ -162,4 +154,9 @@ public final class UpdateStatement extends 
AbstractSQLStatement implements DMLSt
     public Optional<WithTableHintSegment> getWithTableHint() {
         return Optional.ofNullable(withTableHint);
     }
+    
+    @Override
+    public Optional<WithSegment> getWith() {
+        return Optional.ofNullable(with);
+    }
 }

Reply via email to