alamb commented on code in PR #7037:
URL: https://github.com/apache/arrow-datafusion/pull/7037#discussion_r1269577899


##########
datafusion/core/tests/sqllogictests/test_files/decimal.slt:
##########
@@ -415,13 +415,13 @@ select c1/c5 from decimal_simple;
 
 
 query T
-select arrow_typeof(c5%cast(0.00001 as decimal(5,5))) from decimal_simple 
limit 1;
+select arrow_typeof(c5 % cast(0.00001 as decimal(5,5))) from decimal_simple 
limit 1;

Review Comment:
   I believe this was due to 
https://github.com/sqlparser-rs/sqlparser-rs/pull/913 from @izveigor  where 
without a space this is parsed to something different.
   
   I think this is a bug in sqlparser
   
   
   
   `c1%c5` is being parsed like this (note the value is 5, not c5)
   ```
                                   BinaryOp {
                                       left: Identifier(
                                           Ident {
                                               value: "c1",
                                               quote_style: None,
                                           },
                                       ),
                                       op: Modulo,
                                       right: Value(
                                           Number(
                                               "5",
                                               false,
                                           ),
                                       ),
                                   },
   ```
   
   
   With spaces, `c1 % c5` is parsed correctly:
   
   ```
                                   BinaryOp {
                                       left: Identifier(
                                           Ident {
                                               value: "c1",
                                               quote_style: None,
                                           },
                                       ),
                                       op: Modulo,
                                       right: Identifier(
                                           Ident {
                                               value: "c5",
                                               quote_style: None,
                                           },
                                       ),
                                   },```
   ```
   
   
   I will file a ticket in sqlparser



##########
datafusion/core/tests/sqllogictests/test_files/decimal.slt:
##########
@@ -415,13 +415,13 @@ select c1/c5 from decimal_simple;
 
 
 query T
-select arrow_typeof(c5%cast(0.00001 as decimal(5,5))) from decimal_simple 
limit 1;
+select arrow_typeof(c5 % cast(0.00001 as decimal(5,5))) from decimal_simple 
limit 1;

Review Comment:
   https://github.com/sqlparser-rs/sqlparser-rs/issues/926



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