-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[SPARK-22821][TEST] Basic tests for WidenSetOperationTypes, BooleanEquality, StackCoercion and Division #20006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Test build #85039 has finished for PR 20006 at commit
|
SELECT true = cast('1' as binary) FROM t; | ||
SELECT true = cast('1' as boolean) FROM t; | ||
SELECT true = cast('2017-12-11 09:30:00.0' as timestamp) FROM t; | ||
SELECT true = cast('2017-12-11 09:30:00' as date) FROM t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also please add the cases for false = 0
Test build #85052 has finished for PR 20006 at commit
|
SELECT true = cast('1' as binary) FROM t; | ||
SELECT true = cast(1 as boolean) FROM t; | ||
SELECT true = cast('2017-12-11 09:30:00.0' as timestamp) FROM t; | ||
SELECT true = cast('2017-12-11 09:30:00' as date) FROM t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we just use one side?
For example, let us get rid of true = cast(1 as tinyint)
and keep cast(1 as tinyint) = true
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep both, we have some below usage:
spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
Lines 486 to 489 in 6d7ebf2
case EqualTo(bool @ BooleanType(), Literal(value, _: NumericType)) | |
if falseValues.contains(value) => Not(bool) | |
case EqualTo(Literal(value, _: NumericType), bool @ BooleanType()) | |
if trueValues.contains(value) => bool |
spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
Lines 134 to 135 in 6d7ebf2
case (StringType, TimestampType) => Some(StringType) | |
case (TimestampType, StringType) => Some(StringType) |
SELECT cast(1 as string) / cast('2017-12-11 09:30:00.0' as timestamp) FROM t; | ||
SELECT cast(1 as string) / cast('2017-12-11 09:30:00' as date) FROM t; | ||
|
||
SELECT cast(1 as string) / cast(1 as tinyint) FROM t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicates?
|
||
CREATE TEMPORARY VIEW t AS SELECT 1; | ||
|
||
SELECT stack(cast(1 as tinyint), cast(1 as tinyint), null) FROM t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This suite is not needed.
SELECT cast('2017-12-12 09:30:00' as date) FROM t UNION SELECT cast('2017-12-11 09:30:00.0' as timestamp) FROM t; | ||
SELECT cast('2017-12-12 09:30:00' as date) FROM t UNION SELECT cast('2017-12-11 09:30:00' as date) FROM t; | ||
|
||
-- EXCEPT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not need EXCEPT and INTERSECT
Test build #85103 has finished for PR 20006 at commit
|
LGTM |
Thanks! Merged to master. |
What changes were proposed in this pull request?
Test Coverage for
WidenSetOperationTypes
,BooleanEquality
,StackCoercion
andDivision
, this is a Sub-tasks for SPARK-22722.How was this patch tested?
N/A