julant7 commented on issue #31568:
URL: 
https://github.com/apache/shardingsphere/issues/31568#issuecomment-2176096170

   Done everything except `VALUES()`
   For some reason parser interprets `VALUES` as `FunctionSegment` instead of 
`ValuesExpression` and then crashes due `expected = null`
   
   ```java
   java.lang.NullPointerException: Cannot invoke 
"org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.ExpectedSQLSegment.getLiteralStartIndex()"
 because "expected" is null
   ```
   ```xml
   <sql-case id="insert_on_duplicate_key_update_with_values" value="INSERT INTO 
table (a,b,c) VALUES (1,2,3),(4,5,6) ON DUPLICATE KEY UPDATE 
c=VALUES(a)+VALUES(b);" db-types="MySQL" />
   ```
   ```xml
   <insert sql-case-id="insert_on_duplicate_key_update_with_values">
           <table name="table" start-index="12" stop-index="16" />
           <columns start-index="18" stop-index="24">
               <column name="a" start-index="19" stop-index="19" />
               <column name="b" start-index="21" stop-index="21" />
               <column name="c" start-index="23" stop-index="23" />
           </columns>
           <values>
               <value>
                   <assignment-value>
                       <literal-expression value="1" start-index="34" 
stop-index="34" />
                   </assignment-value>
                   <assignment-value>
                       <literal-expression value="2" start-index="36" 
stop-index="36" />
                   </assignment-value>
                   <assignment-value>
                       <literal-expression value="3" start-index="38" 
stop-index="38" />
                   </assignment-value>
               </value>
               <value>
                   <assignment-value>
                       <literal-expression value="4" start-index="42" 
stop-index="42" />
                   </assignment-value>
                   <assignment-value>
                       <literal-expression value="5" start-index="44" 
stop-index="44" />
                   </assignment-value>
                   <assignment-value>
                       <literal-expression value="6" start-index="46" 
stop-index="46" />
                   </assignment-value>
               </value>
           </values>
           <on-duplicate-key-columns start-index="51" stop-index="93" 
literal-start-index="48" literal-stop-index="93">
               <assignment start-index="73" stop-index="93">
                   <column name="c" start-index="73" stop-index="73" />
                   <assignment-value>
                       <binary-operation-expression start-index="75" 
stop-index="93" literal-start-index="75" literal-stop-index="93">
                           <left>
                               <values-expression>
                                   <values>
                                       <value>
                                           <assignment-value>
                                               <column name="a" 
start-index="82" stop-index="82" literal-start-index="82" 
literal-stop-index="82"  />
                                           </assignment-value>
                                       </value>
                                   </values>
                               </values-expression>
                           </left>
                           <operator>+</operator>
                           <right>
                               <values-expression>
                               <values>
                                       <value>
                                           <assignment-value>
                                               <column name="b" 
start-index="92" stop-index="92" literal-start-index="92" 
literal-stop-index="92"  />
                                           </assignment-value>
                                       </value>
                                   </values>
                               </values-expression>
                           </right>
                       </binary-operation-expression>
                   </assignment-value>
               </assignment>
           </on-duplicate-key-columns>
       </insert>
   ```
   
![image](https://github.com/apache/shardingsphere/assets/101992203/8c6bcbf9-8149-4e9a-bb56-77b92d52cf7c)
   


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

Reply via email to