harshmotw-db commented on code in PR #47808:
URL: https://github.com/apache/spark/pull/47808#discussion_r1730264999
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala:
##########
@@ -902,7 +902,7 @@ object IntervalUtils extends SparkIntervalUtils {
case DAY => Decimal(v / MICROS_PER_DAY)
case HOUR => Decimal(v / MICROS_PER_HOUR)
case MINUTE => Decimal(v / MICROS_PER_MINUTE)
- case SECOND => Decimal(v, Decimal.MAX_LONG_DIGITS, 6)
+ case SECOND => Decimal(v, Decimal.MAX_LONG_DIGITS + 1, 6)
Review Comment:
The only place where this function (dayTimeIntervalToDecimal) is called is
in `Cast.scala` when casting from dt-intervals to decimal. Even there, the
[precision of the result is
changed](https://github.com/apache/spark/blob/0c18fc072b05671bc9c74a43de49b563a1ef7907/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala#L995-L998)
from the intermediate precision (which is what I am changing here) to a target
precision (which my code does not touch).
There is no reason to believe that my code changes anything about the output.
--
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]