未验证 提交 33aca175 编写于 作者: 流浪诗人 提交者: GitHub

Fix 4782. (#4803)

上级 124dfc7f
......@@ -20,6 +20,7 @@ package org.apache.shardingsphere.sql.parser.integrate.asserts.segment.expressio
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.sql.parser.integrate.asserts.SQLCaseAssertContext;
import org.apache.shardingsphere.sql.parser.integrate.asserts.segment.SQLSegmentAssert;
import org.apache.shardingsphere.sql.parser.integrate.asserts.statement.dml.impl.SelectStatementAssert;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.domain.segment.impl.expr.complex.ExpectedCommonExpression;
import org.apache.shardingsphere.sql.parser.integrate.jaxb.domain.segment.impl.expr.simple.ExpectedLiteralExpression;
......@@ -83,8 +84,7 @@ public final class ExpressionAssert {
assertNotNull(assertContext.getText("Expected common expression should exist."));
String expectedText = SQLCaseType.Literal == assertContext.getSqlCaseType() && null != expected.getLiteralText() ? expected.getLiteralText() : expected.getText();
assertThat(assertContext.getText("Common expression text assertion error: "), actual.getText(), is(expectedText));
// TODO assert start index and stop index
// SQLSegmentAssert.assertIs(assertContext, actual, expected);
SQLSegmentAssert.assertIs(assertContext, actual, expected);
}
/**
......
......@@ -69,7 +69,7 @@
<literal-expression value="insert" />
</assignment-value>
<assignment-value>
<common-expression text="now()" />
<common-expression text="now()" start-index="104" stop-index="108" literal-start-index="109" literal-stop-index="113"/>
</assignment-value>
</value>
</values>
......@@ -468,7 +468,7 @@
<assignment start-index="89" stop-index="111" literal-start-index="94" literal-stop-index="116">
<column name="status" start-index="89" stop-index="94" literal-start-index="94" literal-stop-index="99" />
<assignment-value>
<common-expression text="VALUES(status)" />
<common-expression text="VALUES(status)" start-index="98" stop-index="111" literal-start-index="103" literal-stop-index="116" />
</assignment-value>
</assignment>
</on-duplicate-key-columns>
......@@ -542,7 +542,7 @@
<owner name="t_order" start-index="113" stop-index="119" literal-start-index="118" literal-stop-index="124" />
</column>
<assignment-value>
<common-expression text="VALUES(t_order.status)" />
<common-expression text="VALUES(t_order.status)" start-index="130" stop-index="151" literal-start-index="135" literal-stop-index="156" />
</assignment-value>
</assignment>
</on-duplicate-key-columns>
......@@ -744,7 +744,7 @@
<literal-expression value="200" />
</assignment-value>
<assignment-value>
<common-expression text="ST_GeographyFromText('SRID=4326;POINT(100 200)')" />
<common-expression text="ST_GeographyFromText('SRID=4326;POINT(100 200)')" start-index="71" stop-index="118" literal-start-index="73" literal-stop-index="120" />
</assignment-value>
<assignment-value>
<parameter-marker-expression value="2" />
......@@ -873,7 +873,7 @@
<values>
<value>
<assignment-value>
<common-expression text="curdate()" />
<common-expression text="curdate()" start-index="61" stop-index="69" literal-start-index="61" literal-stop-index="69" />
</assignment-value>
<assignment-value>
<parameter-marker-expression value="0" />
......@@ -937,7 +937,7 @@
<values>
<value>
<assignment-value>
<common-expression text="unix_timestamp(?)" literal-text="unix_timestamp(2019-10-19)" />
<common-expression text="unix_timestamp(?)" literal-text="unix_timestamp(2019-10-19)" start-index="55" stop-index="71" literal-start-index="55" literal-stop-index="80"/>
</assignment-value>
<assignment-value>
<parameter-marker-expression value="1" />
......@@ -987,7 +987,7 @@
<value>
<assignment-value>
<parameter-marker-expression value="0" />
<common-expression text="str_to_date(?,'%Y-%m-%d')" literal-text="str_to_date(2019-12-10,'%Y-%m-%d')" />
<common-expression text="str_to_date(?,'%Y-%m-%d')" literal-text="str_to_date(2019-12-10,'%Y-%m-%d')" start-index="61" stop-index="86" literal-start-index="61" literal-stop-index="95" />
</assignment-value>
<assignment-value>
<parameter-marker-expression value="1" />
......@@ -1100,7 +1100,7 @@
<value>
<assignment-value>
<parameter-marker-expression value="0" />
<common-expression text="date_add(now(),interval?second)" literal-text="date_add(now(),interval1second)" />
<common-expression text="date_add(now(),interval?second)" literal-text="date_add(now(),interval1second)" start-index="61" stop-index="93" literal-start-index="61" literal-stop-index="93" />
</assignment-value>
<assignment-value>
<parameter-marker-expression value="1" />
......
......@@ -48,7 +48,7 @@
<column-left-value name="order_id" start-index="51" stop-index="58" />
<operator type="&gt;" />
<compare-right-value>
<common-expression text="1-1" />
<common-expression text="1-1" start-index="62" stop-index="64" literal-start-index="62" literal-stop-index="64" />
</compare-right-value>
</predicate>
</and-predicate>
......@@ -68,7 +68,7 @@
<column-left-value name="order_id" start-index="51" stop-index="58" />
<operator type="&gt;" />
<compare-right-value>
<common-expression text="1-1" />
<common-expression text="1-1" start-index="62" stop-index="66" literal-start-index="62" literal-stop-index="66"/>
</compare-right-value>
</predicate>
</and-predicate>
......
......@@ -108,7 +108,7 @@
<assignment start-index="47" stop-index="116" literal-start-index="58" literal-stop-index="131">
<column name="start_point" start-index="47" stop-index="57" literal-start-index="58" literal-stop-index="68" />
<assignment-value>
<common-expression text="ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')')" literal-text="ST_GeographyFromText('SRID=4326;POINT('||100||' '||200||')')" />
<common-expression text="ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')')" literal-text="ST_GeographyFromText('SRID=4326;POINT('||100||' '||200||')')" start-index="61" stop-index="116" literal-start-index="72" literal-stop-index="131"/>
</assignment-value>
</assignment>
<assignment start-index="119" stop-index="133" literal-start-index="134" literal-stop-index="166">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册