Re: [I] Order of Interval Addition Should Affect Final Output [datafusion]

2024-06-23 Thread via GitHub


alamb commented on issue #11055:
URL: https://github.com/apache/datafusion/issues/11055#issuecomment-2185275095

   > Thanks so much. Should I fix it in sqlparser?
   
   I think that is probably the best way -- though it is likely pretty tricky 
(likely related to operator precidence). I think the correct first step would 
be to do some research and see how such arithmetic is parsed by other databases


-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org



Re: [I] Order of Interval Addition Should Affect Final Output [datafusion]

2024-06-23 Thread via GitHub


alamb commented on issue #11055:
URL: https://github.com/apache/datafusion/issues/11055#issuecomment-2184954245

   
   
   I agree with @Lordworms the root cause is related to the precidence rules in 
sqlparser which control if expressions like
   
   ```sl
 DATE '2019-02-28' + INTERVAL '1 YEAR' + INTERVAL '1 DAY' AS FEB,
   ```
   
   are parsed like this
   
   ```sql
 ((DATE '2019-02-28' + INTERVAL '1 YEAR') + INTERVAL '1 DAY' AS FEB),
   ```
   
   Or like
   ```sql
 (DATE '2019-02-28' + (INTERVAL '1 YEAR' + INTERVAL '1 DAY' AS FEB)),
   ```
   
   Users who want to control the order of expression evaluation can use `(` and 
`)` to explicitly control the evaluation order.


-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org