diff --git a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/CreateTableStatement.java b/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/CreateTableStatement.java index 7f3dead8897ba..2442084da9482 100644 --- a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/CreateTableStatement.java +++ b/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/CreateTableStatement.java @@ -23,9 +23,11 @@ import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.constraint.ConstraintDefinitionSegment; import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment; import org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement; +import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement; import java.util.Collection; import java.util.LinkedList; +import java.util.Optional; /** * Create table statement. @@ -36,7 +38,18 @@ public abstract class CreateTableStatement extends AbstractSQLStatement implemen private SimpleTableSegment table; + private SelectStatement selectStatement; + private final Collection columnDefinitions = new LinkedList<>(); private final Collection constraintDefinitions = new LinkedList<>(); + + /** + * Get select statement. + * + * @return select statement + */ + public Optional getSelectStatement() { + return Optional.ofNullable(selectStatement); + } } diff --git a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/ddl/SQLServerCreateTableStatement.java b/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/ddl/SQLServerCreateTableStatement.java index d522268493418..a35cab1494490 100644 --- a/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/ddl/SQLServerCreateTableStatement.java +++ b/parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/ddl/SQLServerCreateTableStatement.java @@ -21,12 +21,10 @@ import lombok.Setter; import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.ColumnSegment; import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateTableStatement; -import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement; import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.SQLServerStatement; import java.util.LinkedList; import java.util.List; -import java.util.Optional; /** * SQLServer create table statement. @@ -36,15 +34,4 @@ public final class SQLServerCreateTableStatement extends CreateTableStatement implements SQLServerStatement { private final List columns = new LinkedList<>(); - - private SelectStatement selectStatement; - - /** - * Get select statement. - * - * @return select statement - */ - public Optional getSelectStatement() { - return Optional.ofNullable(selectStatement); - } }