viirya commented on PR #3690:
URL: https://github.com/apache/arrow-rs/pull/3690#issuecomment-1457670060

   > Could you expand on this, how does it decide the output precision/scale to 
unify to? Is it the same as the input? Is it data dependent? Unless I am 
mistaken in arrow the precision and scale are an immutable part of the column's 
schema that must be established at plan time.
   
   Spark type coercion rule decides the output precision/scale: e.g., 
https://github.com/apache/spark/blob/branch-3.2/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/DecimalPrecision.scala#L126-L136.
 It is dependent on input precision/scale. Yea, it is established at plan 
(query analysis) time.
   
   > I wonder if the issue is that DataFusion is not inspecting the precision 
in order to work out if there is a potential for overflow, and scaling the 
input as appropriate based on this information? This is what I had understood 
the whole purpose of the precision argument as being for?
   
   I think it is not possible to inspect potential overflow for input. Because 
overflowing or not isn't just dependent on precision/scale only but the actual 
input data.


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