stevomitric commented on code in PR #57680:
URL: https://github.com/apache/spark/pull/57680#discussion_r3749698588
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercionHelper.scala:
##########
@@ -302,6 +302,35 @@ abstract class TypeCoercionHelper {
}
}
+ /** Whether `dt` is on the LTZ/NTZ timestamp fractional-precision axis (a
micro or nanos type). */
+ private def isTimestampFamily(dt: DataType): Boolean =
+ TimestampFamily.fractionalPrecision(dt).isDefined
+
+ /**
+ * Common operand type for [[SubtractTimestamps]] over two differing
timestamp-family operands.
+ * The operands are widened to the larger of the two fractional-second
precisions (the micro types
+ * count as 6, the nanos types carry their own precision `p` in [7, 9]) and
unified in one
+ * time-zone family:
+ * - a cross-family pair unifies in the no-time-zone (NTZ) family,
mirroring the microsecond
+ * precedent where TIMESTAMP - TIMESTAMP_NTZ coerces both operands to
TIMESTAMP_NTZ;
+ * - a same-family pair keeps that family, so a TIMESTAMP -
TIMESTAMP_LTZ(p) style pair still
+ * subtracts in the session time zone (DST-aware) exactly as a pure LTZ
pair does.
+ * The subtraction reads only each operand's epochMicros and always yields a
microsecond-grid
Review Comment:
Qualified both result types
--
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]