findepi commented on PR #14223:
URL: https://github.com/apache/datafusion/pull/14223#issuecomment-2612059136

   > 1. If it is relatively easy, we can do a quick follow-on PR to parse/type 
literals more intelligently. Maybe always parse as the smallest/narrowest 
datatype that will hold the constant.
   
   Trino parses integer literals as `integer` type unless they do not fit 
32-bit, then they are `bigint`.
   This logic generally makes sense, i don't know what SQL spec or Postgres do.
   
   Smallest possible type may be a step to far. For example 120 + 120 would 
overflow, if 120 is typed as Int8.
   
   Some other systems (eg Snowflake, PostgreSQL) apparently defer literals 
typing, making it contextual. We have discussed this for varchar-like literals 
in date/time argument context, but this approach could perhaps also be 
applicable to numeric literals.


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to