strongduanmu commented on code in PR #30249:
URL: https://github.com/apache/shardingsphere/pull/30249#discussion_r1501273606
##########
test/it/parser/src/main/resources/case/dml/select.xml:
##########
@@ -6517,7 +6517,84 @@
<simple-table name="employees" start-index="210" stop-index="218"
literal-start-index="210" literal-stop-index="218" />
</from>
</select>
-
+
+ <select sql-case-id="select_with_trim_function2">
+ <projections start-index="7" stop-index="57">
+ <expression-projection text="TRIM( '.,! ' FROM ' # test
.')" start-index="7" stop-index="57" alias="Result">
+ <expr>
+ <function function-name="TRIM" start-index="7"
stop-index="47" text="TRIM( '.,! ' FROM ' # test .')">
+ <parameter>
+ <literal-expression value=".,! " start-index="13"
stop-index="18" />
+ </parameter>
+ <parameter>
+ <literal-expression value=" # test ."
start-index="25" stop-index="46" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_with_trim_function3">
+ <projections start-index="7" stop-index="66">
+ <expression-projection text="TRIM(LEADING '.,! ' FROM ' .#
test .')" start-index="7" stop-index="66" alias="Result">
+ <expr>
+ <function function-name="TRIM" start-index="7"
stop-index="56" text="TRIM(LEADING '.,! ' FROM ' .# test .')">
+ <parameter>
+ <literal-expression value="LEADING"
start-index="12" stop-index="18" />
+ </parameter>
+ <parameter>
+ <literal-expression value=".,! " start-index="20"
stop-index="25" />
+ </parameter>
+ <parameter>
+ <literal-expression value=" .# test ."
start-index="33" stop-index="55" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_with_trim_function4">
+ <projections start-index="7" stop-index="66">
+ <expression-projection text="TRIM(TRAILING '.,! ' FROM ' .#
test .')" start-index="7" stop-index="66" alias="Result">
+ <expr>
+ <function function-name="TRIM" start-index="7"
stop-index="56" text="TRIM(TRAILING '.,! ' FROM ' .# test .')">
+ <parameter>
+ <literal-expression value="TRAILING"
start-index="12" stop-index="19" />
+ </parameter>
+ <parameter>
+ <literal-expression value=".,! " start-index="21"
stop-index="26" />
+ </parameter>
+ <parameter>
+ <literal-expression value=" .# test ."
start-index="33" stop-index="55" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_with_trim_function5">
Review Comment:
Please rename the sql-case-id with a meaningful name.
##########
parser/sql/dialect/sqlserver/src/main/antlr4/imports/sqlserver/BaseRule.g4:
##########
@@ -315,9 +315,14 @@ distinct
;
specialFunction
- : conversionFunction | charFunction | openJsonFunction | jsonFunction |
openRowSetFunction | windowFunction | approxFunction | openDatasourceFunction |
rowNumberFunction | graphFunction
+ : conversionFunction | charFunction | openJsonFunction | jsonFunction |
openRowSetFunction | windowFunction | approxFunction | openDatasourceFunction |
rowNumberFunction | graphFunction | trimFunction
;
+ trimFunction
Review Comment:
Please keep the same indentation as the other rules.
##########
test/it/parser/src/main/resources/case/dml/select.xml:
##########
@@ -6517,7 +6517,84 @@
<simple-table name="employees" start-index="210" stop-index="218"
literal-start-index="210" literal-stop-index="218" />
</from>
</select>
-
+
+ <select sql-case-id="select_with_trim_function2">
+ <projections start-index="7" stop-index="57">
+ <expression-projection text="TRIM( '.,! ' FROM ' # test
.')" start-index="7" stop-index="57" alias="Result">
+ <expr>
+ <function function-name="TRIM" start-index="7"
stop-index="47" text="TRIM( '.,! ' FROM ' # test .')">
+ <parameter>
+ <literal-expression value=".,! " start-index="13"
stop-index="18" />
+ </parameter>
+ <parameter>
+ <literal-expression value=" # test ."
start-index="25" stop-index="46" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_with_trim_function3">
+ <projections start-index="7" stop-index="66">
+ <expression-projection text="TRIM(LEADING '.,! ' FROM ' .#
test .')" start-index="7" stop-index="66" alias="Result">
+ <expr>
+ <function function-name="TRIM" start-index="7"
stop-index="56" text="TRIM(LEADING '.,! ' FROM ' .# test .')">
+ <parameter>
+ <literal-expression value="LEADING"
start-index="12" stop-index="18" />
+ </parameter>
+ <parameter>
+ <literal-expression value=".,! " start-index="20"
stop-index="25" />
+ </parameter>
+ <parameter>
+ <literal-expression value=" .# test ."
start-index="33" stop-index="55" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_with_trim_function4">
Review Comment:
Please rename the sql-case-id with a meaningful name.
##########
test/it/parser/src/main/resources/case/dml/select.xml:
##########
@@ -6436,7 +6436,7 @@
</order-by>
</select>
- <select sql-case-id="select_with_trim_function">
+ <select sql-case-id="select_with_trim_function1">
Review Comment:
Please rename the sql-case-id with a meaningful name.
##########
test/it/parser/src/main/resources/case/dml/select.xml:
##########
@@ -6517,7 +6517,84 @@
<simple-table name="employees" start-index="210" stop-index="218"
literal-start-index="210" literal-stop-index="218" />
</from>
</select>
-
+
+ <select sql-case-id="select_with_trim_function2">
Review Comment:
Please rename the sql-case-id with a meaningful name.
##########
test/it/parser/src/main/resources/case/dml/select.xml:
##########
@@ -6517,7 +6517,84 @@
<simple-table name="employees" start-index="210" stop-index="218"
literal-start-index="210" literal-stop-index="218" />
</from>
</select>
-
+
+ <select sql-case-id="select_with_trim_function2">
+ <projections start-index="7" stop-index="57">
+ <expression-projection text="TRIM( '.,! ' FROM ' # test
.')" start-index="7" stop-index="57" alias="Result">
+ <expr>
+ <function function-name="TRIM" start-index="7"
stop-index="47" text="TRIM( '.,! ' FROM ' # test .')">
+ <parameter>
+ <literal-expression value=".,! " start-index="13"
stop-index="18" />
+ </parameter>
+ <parameter>
+ <literal-expression value=" # test ."
start-index="25" stop-index="46" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_with_trim_function3">
Review Comment:
Please rename the sql-case-id with a meaningful name.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]