jingshanglu commented on a change in pull request #8604:
URL: https://github.com/apache/shardingsphere/pull/8604#discussion_r546475011



##########
File path: 
shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/case/dml/select-expression.xml
##########
@@ -1498,30 +1520,34 @@
         </where>
     </select>
 
-    <select sql-case-id="select_where_with_simple_expr_with_match">
+    <select sql-case-id="select_where_with_simple_expr_with_match" 
parameters="'keyword'">
         <from start-index="14" stop-index="20">
-            <simple-table name="t_order" start-index="14" stop-index="20"/>
+            <simple-table name="t_order" start-index="14" stop-index="20" />
         </from>
-        <projections distinct-row="false" start-index="7" stop-index="7">
-            <shorthand-projection start-index="7" stop-index="7"/>
+        <projections start-index="7" stop-index="7">
+            <shorthand-projection start-index="7" stop-index="7" />
         </projections>
-        <where start-index="22" stop-index="88">
+        <where start-index="22" stop-index="80" literal-stop-index="88">
             <expr>
-                <common-expression text="MATCH (order_id) AGAINST ('keyword' 
IN NATURAL LANGUAGE MODE)" start-index="28" stop-index="88"/>
+                <common-expression text="MATCH (order_id) AGAINST (? IN 
NATURAL LANGUAGE MODE)"
+                                   literal-text="MATCH (order_id) AGAINST 
('keyword' IN NATURAL LANGUAGE MODE)"
+                                   start-index="28" stop-index="80" 
literal-stop-index="88"/>
             </expr>
         </where>
     </select>
 
-    <select sql-case-id="select_where_with_simple_expr_with_case">
+    <select sql-case-id="select_where_with_simple_expr_with_case" 
parameters="1,'true','false'">
         <from start-index="14" stop-index="20">
-            <simple-table name="t_order" start-index="14" stop-index="20"/>
+            <simple-table name="t_order" start-index="14" stop-index="20" />
         </from>
-        <projections distinct-row="false" start-index="7" stop-index="7">
-            <shorthand-projection start-index="7" stop-index="7"/>
+        <projections start-index="7" stop-index="7">
+            <shorthand-projection start-index="7" stop-index="7" />
         </projections>
-        <where start-index="22" stop-index="78">
+        <where start-index="22" stop-index="67" literal-stop-index="78">
             <expr>
-                <common-expression text="CASE WHEN order_id &gt; 2 THEN 'true' 
ELSE 'false' END" start-index="28" stop-index="78"/>
+                <common-expression text="CASE WHEN order_id &gt; ? THEN ? ELSE 
? END"
+                                   literal-text="CASE WHEN order_id > 1 THEN 
'true' ELSE 'false' END"
+                                   start-index="28" stop-index="67" 
literal-stop-index="78" />

Review comment:
       @lwtdev merge to one line.

##########
File path: 
shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/case/dml/select.xml
##########
@@ -731,54 +736,60 @@
         </where>
     </select>
 
-    <select sql-case-id="select_count_like_concat_for_oracle_and_sqlserver" 
parameters="1, 2, 9, 10">
+    <select sql-case-id="select_count_like_concat_oracle_sqlserver" 
parameters="'init', 1, 2, 9, 10">
         <from>
             <simple-table name="t_order" alias="o" start-index="37" 
stop-index="45" />
         </from>
         <projections start-index="7" stop-index="30">
             <aggregation-projection type="COUNT" inner-expression="(0)" 
alias="orders_count" start-index="7" stop-index="14" />
         </projections>
-        <where start-index="47" stop-index="147" literal-stop-index="148">
+        <where start-index="47" stop-index="142" literal-stop-index="148">
             <expr>
-                <binary-operation-expression start-index="53" stop-index="147" 
literal-stop-index="148">
+                <binary-operation-expression start-index="53" stop-index="142" 
literal-stop-index="148">
                     <left>
-                        <binary-operation-expression start-index="53" 
stop-index="116">
+                        <binary-operation-expression start-index="53" 
stop-index="111" literal-stop-index="116">
                             <left>
-                                <binary-operation-expression start-index="53" 
stop-index="92">
+                                <common-expression text="o.status LIKE 
CONCAT('%%', ?, '%%')"
+                                                   literal-text="o.status LIKE 
CONCAT('%%', 'init', '%%')"
+                                                   start-index="53" 
stop-index="87" literal-stop-index="92"/>
+
+                                <binary-operation-expression start-index="53" 
stop-index="87" literal-stop-index="92">
                                     <left>
                                         <column name="status" start-index="53" 
stop-index="60">
                                             <owner name="o" start-index="53" 
stop-index="53" />
                                         </column>
                                     </left>
                                     <operator>LIKE</operator>
                                     <right>
-                                        <list-expression start-index="67" 
stop-index="92">
+                                        <list-expression start-index="67" 
stop-index="87">
                                             <items>
-                                                <expression-projection 
text="CONCAT('%%','init','%%')" start-index="67" stop-index="92" />
+                                                <!-- 'text' is different from 
other database -->
+                                                <expression-projection 
text="CONCAT('%%',?,'%%')"
+                                                                       
literal-text="CONCAT('%%','init','%%')"
+                                                                       
start-index="67" stop-index="87" literal-stop-index="92" />

Review comment:
       @lwtdev merge into one line.

##########
File path: 
shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/case/dml/select.xml
##########
@@ -731,54 +736,60 @@
         </where>
     </select>
 
-    <select sql-case-id="select_count_like_concat_for_oracle_and_sqlserver" 
parameters="1, 2, 9, 10">
+    <select sql-case-id="select_count_like_concat_oracle_sqlserver" 
parameters="'init', 1, 2, 9, 10">
         <from>
             <simple-table name="t_order" alias="o" start-index="37" 
stop-index="45" />
         </from>
         <projections start-index="7" stop-index="30">
             <aggregation-projection type="COUNT" inner-expression="(0)" 
alias="orders_count" start-index="7" stop-index="14" />
         </projections>
-        <where start-index="47" stop-index="147" literal-stop-index="148">
+        <where start-index="47" stop-index="142" literal-stop-index="148">
             <expr>
-                <binary-operation-expression start-index="53" stop-index="147" 
literal-stop-index="148">
+                <binary-operation-expression start-index="53" stop-index="142" 
literal-stop-index="148">
                     <left>
-                        <binary-operation-expression start-index="53" 
stop-index="116">
+                        <binary-operation-expression start-index="53" 
stop-index="111" literal-stop-index="116">
                             <left>
-                                <binary-operation-expression start-index="53" 
stop-index="92">
+                                <common-expression text="o.status LIKE 
CONCAT('%%', ?, '%%')"
+                                                   literal-text="o.status LIKE 
CONCAT('%%', 'init', '%%')"
+                                                   start-index="53" 
stop-index="87" literal-stop-index="92"/>
+

Review comment:
       @lwtdev  merge into one line.

##########
File path: 
shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/case/dml/select.xml
##########
@@ -652,54 +652,59 @@
         </where>
     </select>
 
-    <select sql-case-id="select_count_like_concat" parameters="1, 2, 9, 10">
+    <select sql-case-id="select_count_like_concat" parameters="'init', 1, 2, 
9, 10">
         <from>
             <simple-table name="t_order" alias="o" start-index="37" 
stop-index="45" />
         </from>
         <projections start-index="7" stop-index="30">
             <aggregation-projection type="COUNT" inner-expression="(0)" 
alias="orders_count" start-index="7" stop-index="14" />
         </projections>
-        <where start-index="47" stop-index="147" literal-stop-index="148">
+        <where start-index="47" stop-index="142" literal-stop-index="148">
             <expr>
-                <binary-operation-expression start-index="53" stop-index="147" 
literal-stop-index="148">
+                <binary-operation-expression start-index="53" stop-index="142" 
literal-stop-index="148">
                     <left>
-                        <binary-operation-expression start-index="53" 
stop-index="116">
+                        <binary-operation-expression start-index="53" 
stop-index="111" literal-stop-index="116">
                             <left>
-                                <binary-operation-expression start-index="53" 
stop-index="92">
+                                <common-expression text="o.status LIKE 
CONCAT('%%', ?, '%%')"
+                                                   literal-text="o.status LIKE 
CONCAT('%%', 'init', '%%')"
+                                                   start-index="53" 
stop-index="87" literal-stop-index="92"/>
+

Review comment:
       @lwtdev merge into one line

##########
File path: 
shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/case/dml/select.xml
##########
@@ -652,54 +652,59 @@
         </where>
     </select>
 
-    <select sql-case-id="select_count_like_concat" parameters="1, 2, 9, 10">
+    <select sql-case-id="select_count_like_concat" parameters="'init', 1, 2, 
9, 10">
         <from>
             <simple-table name="t_order" alias="o" start-index="37" 
stop-index="45" />
         </from>
         <projections start-index="7" stop-index="30">
             <aggregation-projection type="COUNT" inner-expression="(0)" 
alias="orders_count" start-index="7" stop-index="14" />
         </projections>
-        <where start-index="47" stop-index="147" literal-stop-index="148">
+        <where start-index="47" stop-index="142" literal-stop-index="148">
             <expr>
-                <binary-operation-expression start-index="53" stop-index="147" 
literal-stop-index="148">
+                <binary-operation-expression start-index="53" stop-index="142" 
literal-stop-index="148">
                     <left>
-                        <binary-operation-expression start-index="53" 
stop-index="116">
+                        <binary-operation-expression start-index="53" 
stop-index="111" literal-stop-index="116">
                             <left>
-                                <binary-operation-expression start-index="53" 
stop-index="92">
+                                <common-expression text="o.status LIKE 
CONCAT('%%', ?, '%%')"
+                                                   literal-text="o.status LIKE 
CONCAT('%%', 'init', '%%')"
+                                                   start-index="53" 
stop-index="87" literal-stop-index="92"/>
+
+                                <binary-operation-expression start-index="53" 
stop-index="87" literal-stop-index="92">
                                     <left>
                                         <column name="status" start-index="53" 
stop-index="60">
                                             <owner name="o" start-index="53" 
stop-index="53" />
                                         </column>
                                     </left>
                                     <operator>LIKE</operator>
                                     <right>
-                                        <list-expression start-index="67" 
stop-index="92">
+                                        <list-expression start-index="67" 
stop-index="87">
                                             <items>
-                                                <expression-projection 
text="CONCAT('%%', 'init', '%%')" start-index="67" stop-index="92" />
+                                                <expression-projection 
text="CONCAT('%%', ?, '%%')"
+                                                                       
literal-text="CONCAT('%%', 'init', '%%')"
+                                                                       
start-index="67" stop-index="87" literal-stop-index="92" />

Review comment:
       @lwtdev merge into one line.

##########
File path: 
shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/case/dml/select.xml
##########
@@ -1800,33 +1821,36 @@
                                     </between-expr>
                                     <and-expr>
                                         <common-expression 
text="'{&quot;rule3&quot;:&quot;null3&quot;}'::jsonb" start-index="72" 
stop-index="97" />
+                                        <parameter-marker-expression value="1" 
start-index="54" stop-index="61" />
                                     </and-expr>
                                 </between-expression>
                             </left>
                             <operator>AND</operator>
                             <right>
-                                <binary-operation-expression start-index="103" 
stop-index="174">
+                                <binary-operation-expression start-index="67" 
stop-index="134" literal-start-index="103" literal-stop-index="174">
                                     <left>
-                                        <column name="start_point" 
start-index="103" stop-index="113" />
+                                        <column name="start_point" 
start-index="67" stop-index="77" literal-start-index="103" 
literal-stop-index="113" />
                                     </left>
                                     <operator>=</operator>
                                     <right>
-                                        <common-expression 
text="ST_GeographyFromText('SRID=4326;POINT('||100||' '||200||')')" 
start-index="115" stop-index="174" />
+                                        <common-expression 
text="ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')')"
+                                                           
literal-text="ST_GeographyFromText('SRID=4326;POINT('||100||' '||200||')')"
+                                                           start-index="79" 
stop-index="134" literal-start-index="115" literal-stop-index="174" />

Review comment:
       @lwtdev merge into one line.

##########
File path: 
shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/case/dml/select.xml
##########
@@ -2547,29 +2571,32 @@
             <expression-projection text="CURRENT_USER" start-index="7" 
stop-index="18" />
         </projections>
     </select>
-    <select sql-case-id="select_with_match_against" parameters="10">
+
+    <select sql-case-id="select_with_match_against" parameters="'hello', 10">
         <from>
             <simple-table name="t_order_item" start-index="14" stop-index="25" 
/>
         </from>
         <projections start-index="7" stop-index="7">
             <shorthand-projection start-index="7" stop-index="7" />
         </projections>
-        <where start-index="27" stop-index="122" literal-stop-index="123">
+        <where start-index="27" stop-index="116" literal-stop-index="123">
             <expr>
-                <binary-operation-expression start-index="33" stop-index="122" 
literal-stop-index="123">
+                <binary-operation-expression start-index="33" stop-index="116" 
literal-stop-index="123">
                     <left>
-                        <common-expression 
text="MATCH(t_order_item.description) AGAINST ('hello' IN NATURAL LANGUAGE 
MODE)" start-index="33" stop-index="106" />
+                        <common-expression 
text="MATCH(t_order_item.description) AGAINST (? IN NATURAL LANGUAGE MODE)"
+                                           
literal-text="MATCH(t_order_item.description) AGAINST ('hello' IN NATURAL 
LANGUAGE MODE)"
+                                           start-index="33" stop-index="100" 
literal-stop-index="106"/>

Review comment:
       @lwtdev merge into one line.

##########
File path: 
shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/main/resources/case/dml/select.xml
##########
@@ -1618,70 +1631,73 @@
         </where>
     </select>
 
-    <select sql-case-id="select_equal_with_geography" parameters="1, 2">
+    <select sql-case-id="select_equal_with_geography" 
parameters="'{&quot;rule2&quot;:&quot;null2&quot;}', 100, 200, 1, 2">
         <from>
             <simple-table name="t_order" start-index="14" stop-index="20" />
         </from>
         <projections start-index="7" stop-index="7">
             <shorthand-projection start-index="7" stop-index="7" />
         </projections>
-        <where start-index="22" stop-index="170">
+        <where start-index="22" stop-index="148" literal-stop-index="170">
             <expr>
-                <binary-operation-expression start-index="28" stop-index="170">
+                <binary-operation-expression start-index="28" stop-index="148" 
literal-stop-index="170">
                     <left>
-                        <binary-operation-expression start-index="28" 
stop-index="153">
+                        <binary-operation-expression start-index="28" 
stop-index="131" literal-stop-index="153">
                             <left>
-                                <binary-operation-expression start-index="28" 
stop-index="137">
+                                <binary-operation-expression start-index="28" 
stop-index="115" literal-stop-index="137">
                                     <left>
-                                        <binary-operation-expression 
start-index="28" stop-index="60">
+                                        <binary-operation-expression 
start-index="28" stop-index="42" literal-stop-index="60">
                                             <left>
                                                 <column name="rule" 
start-index="28" stop-index="31" />
                                             </left>
                                             <operator>=</operator>
                                             <right>
                                                 <common-expression 
text="'{&quot;rule2&quot;:&quot;null2&quot;}'::jsonb" start-index="35" 
stop-index="60" />
+                                                <parameter-marker-expression 
value="0" start-index="35" stop-index="42" />
                                             </right>
                                         </binary-operation-expression>
                                     </left>
                                     <operator>AND</operator>
                                     <right>
-                                        <binary-operation-expression 
start-index="66" stop-index="137">
+                                        <binary-operation-expression 
start-index="48" stop-index="115" literal-start-index="66" 
literal-stop-index="137">
                                             <left>
-                                                <column name="start_point" 
start-index="66" stop-index="76" />
+                                                <column name="start_point" 
start-index="48" stop-index="58" literal-start-index="66" 
literal-stop-index="76" />
                                             </left>
                                             <operator>=</operator>
                                             <right>
-                                                <common-expression 
text="ST_GeographyFromText('SRID=4326;POINT('||100||' '||200||')')" 
start-index="78" stop-index="137" />
+                                                <common-expression 
text="ST_GeographyFromText('SRID=4326;POINT('||?||' '||?||')')"
+                                                                   
literal-text="ST_GeographyFromText('SRID=4326;POINT('||100||' '||200||')')"
+                                                                   
start-index="60" stop-index="115" literal-start-index="78" 
literal-stop-index="137" />

Review comment:
       @lwtdev merge into one line.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to