[SPARK-35170][SQL] Extend BinaryOperator by SubtractDates and SubtractTimestamps#32267
[SPARK-35170][SQL] Extend BinaryOperator by SubtractDates and SubtractTimestamps#32267MaxGekk wants to merge 3 commits intoapache:masterfrom
BinaryOperator by SubtractDates and SubtractTimestamps#32267Conversation
|
@gengliangwang @cloud-fan FYI, this PR changes behavior in errors slightly (I guess it is not critical) : |
|
Though, no. It changes the behavior actually - an exception instead of NULL: |
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
| struct<> | ||
| -- !query output | ||
| NULL | ||
| org.apache.spark.sql.AnalysisException |
There was a problem hiding this comment.
@cloud-fan @gengliangwang Are we ok to change the behavior?
There was a problem hiding this comment.
This doesn't look good...Why does that happen?
There was a problem hiding this comment.
Probably because we have special type coercion logic for BinaryOperators?
| -- !query output | ||
| org.apache.spark.sql.AnalysisException | ||
| cannot resolve '(CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) - CAST(1 AS DECIMAL(3,0)))' due to data type mismatch: argument 2 requires timestamp type, however, 'CAST(1 AS DECIMAL(3,0))' is of decimal(3,0) type.; line 1 pos 7 | ||
| cannot resolve '(CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) - CAST(1 AS DECIMAL(3,0)))' due to data type mismatch: differing types in '(CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) - CAST(1 AS DECIMAL(3,0)))' (timestamp and decimal(3,0)).; line 1 pos 7 |
There was a problem hiding this comment.
From my point of view, old error looks better.
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #137724 has finished for PR 32267 at commit
|
|
Test build #137733 has finished for PR 32267 at commit
|
|
I am closing this because:
|
What changes were proposed in this pull request?
In the PR, I propose to modify the
SubtractDatesandSubtractTimestampsexpressions to extendBinaryOperatorinstead ofBinaryExpression.Why are the changes needed?
To improve code maintenance.
Does this PR introduce any user-facing change?
No
How was this patch tested?
By existing test suites.