You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/07/15 05:25:02 UTC

[shardingsphere] branch master updated: Remove StringLiteralValue and NumberLiteralValue in SQLSegment (#19195)

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 6cfa2c83536 Remove StringLiteralValue and NumberLiteralValue in SQLSegment (#19195)
6cfa2c83536 is described below

commit 6cfa2c8353663d9df289d025d3d28c04d5ae4b5a
Author: Zhengqiang Duan <du...@apache.org>
AuthorDate: Fri Jul 15 13:24:53 2022 +0800

    Remove StringLiteralValue and NumberLiteralValue in SQLSegment (#19195)
---
 .../mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java     | 4 ++--
 .../sql/dialect/statement/mysql/segment/ResetMasterOptionSegment.java | 3 +--
 .../sql/dialect/statement/mysql/segment/ResetSlaveOptionSegment.java  | 3 +--
 .../asserts/statement/dal/impl/MySQLResetStatementAssert.java         | 4 ++--
 .../cases/domain/segment/impl/reset/ExpectedResetOptionSegment.java   | 2 +-
 5 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
index 63185b4cc38..ac0ce1fc92e 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
@@ -363,7 +363,7 @@ public final class MySQLDALStatementSQLVisitor extends MySQLStatementSQLVisitor
         if (null != ctx.MASTER()) {
             ResetMasterOptionSegment result = new ResetMasterOptionSegment();
             if (null != ctx.binaryLogFileIndexNumber()) {
-                result.setBinaryLogFileIndexNumber((NumberLiteralValue) visit(ctx.binaryLogFileIndexNumber()));
+                result.setBinaryLogFileIndexNumber(((NumberLiteralValue) visit(ctx.binaryLogFileIndexNumber())).getValue().longValue());
             }
             result.setStartIndex(ctx.start.getStartIndex());
             result.setStopIndex(ctx.stop.getStopIndex());
@@ -374,7 +374,7 @@ public final class MySQLDALStatementSQLVisitor extends MySQLStatementSQLVisitor
             result.setAll(true);
         }
         if (null != ctx.channelOption()) {
-            result.setChannelOption((StringLiteralValue) visit(ctx.channelOption()));
+            result.setChannelOption(((StringLiteralValue) visit(ctx.channelOption())).getValue());
         }
         result.setStartIndex(ctx.start.getStartIndex());
         result.setStopIndex(ctx.stop.getStopIndex());
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/segment/ResetMasterOptionSegment.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/segment/ResetMasterOptionSegment.java
index 2cead23c7d6..0fb6ad2a4ee 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/segment/ResetMasterOptionSegment.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/segment/ResetMasterOptionSegment.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.segment
 import lombok.Getter;
 import lombok.Setter;
 import lombok.ToString;
-import org.apache.shardingsphere.sql.parser.sql.common.value.literal.impl.NumberLiteralValue;
 
 /**
  * MySQL reset master option segment.
@@ -34,5 +33,5 @@ public final class ResetMasterOptionSegment extends ResetOptionSegment {
     
     private int stopIndex;
     
-    private NumberLiteralValue binaryLogFileIndexNumber;
+    private Long binaryLogFileIndexNumber;
 }
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/segment/ResetSlaveOptionSegment.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/segment/ResetSlaveOptionSegment.java
index 8ff426ad16d..ff69ceee8e4 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/segment/ResetSlaveOptionSegment.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/segment/ResetSlaveOptionSegment.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.segment
 import lombok.Getter;
 import lombok.Setter;
 import lombok.ToString;
-import org.apache.shardingsphere.sql.parser.sql.common.value.literal.impl.StringLiteralValue;
 
 /**
  * MySQL reset master option segment.
@@ -32,5 +31,5 @@ public final class ResetSlaveOptionSegment extends ResetOptionSegment {
     
     private boolean all;
     
-    private StringLiteralValue channelOption;
+    private String channelOption;
 }
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/MySQLResetStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/MySQLResetStatementAssert.java
index 7831ee518e8..b8c36f85d7f 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/MySQLResetStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/MySQLResetStatementAssert.java
@@ -66,14 +66,14 @@ public final class MySQLResetStatementAssert {
     
     private static void assertMasterOption(final SQLCaseAssertContext assertContext, final ResetMasterOptionSegment actual, final ExpectedResetOptionSegment expected) {
         if (null != expected.getBinaryLogFileIndexNumber()) {
-            assertThat(assertContext.getText("Actual reset master binlog index does not match: "), actual.getBinaryLogFileIndexNumber().getValue(), is(expected.getBinaryLogFileIndexNumber()));
+            assertThat(assertContext.getText("Actual reset master binlog index does not match: "), actual.getBinaryLogFileIndexNumber(), is(expected.getBinaryLogFileIndexNumber()));
         }
     }
     
     private static void assertSlaveOption(final SQLCaseAssertContext assertContext, final ResetSlaveOptionSegment actual, final ExpectedResetOptionSegment expected) {
         assertThat(assertContext.getText("Actual reset slave all does not match: "), actual.isAll(), is(expected.isAll()));
         if (null != expected.getChannel()) {
-            assertThat(assertContext.getText("Actual reset slave channel does not match: "), actual.getChannelOption().getValue(), is(expected.getChannel()));
+            assertThat(assertContext.getText("Actual reset slave channel does not match: "), actual.getChannelOption(), is(expected.getChannel()));
         }
     }
 }
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/reset/ExpectedResetOptionSegment.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/reset/ExpectedResetOptionSegment.java
index 67b51d39435..459d39ed7c5 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/reset/ExpectedResetOptionSegment.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/reset/ExpectedResetOptionSegment.java
@@ -32,7 +32,7 @@ public final class ExpectedResetOptionSegment extends AbstractExpectedSQLSegment
     private boolean master;
     
     @XmlAttribute(name = "binary-log-file-index-number")
-    private Integer binaryLogFileIndexNumber;
+    private Long binaryLogFileIndexNumber;
     
     @XmlAttribute(name = "all")
     private boolean all;