-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[SPARK-22822][TEST] Basic tests for WindowFrameCoercion and DecimalPrecision #20008
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 #85058 has finished for PR 20008 at commit
|
SELECT cast(1 as tinyint) + cast(1 as decimal(20, 1)) FROM t; | ||
SELECT cast(1 as tinyint) + cast(1 as decimal(21, 1)) FROM t; | ||
SELECT cast(1 as tinyint) + cast(1 as decimal(38, 1)) FROM t; | ||
SELECT cast(1 as tinyint) + cast(1 as decimal(39, 1)) 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.
Do we need all these cases? Could you simplify them?
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.
How about only these 4 decimals: DECIMAL(3, 0)
, DECIMAL(5, 0)
, DECIMAL(10, 0)
and DECIMAL(20, 0)
.
spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/DecimalPrecision.scala
Lines 54 to 57 in 00d176d
* - BYTE gets turned into DECIMAL(3, 0) | |
* - SHORT gets turned into DECIMAL(5, 0) | |
* - INT gets turned into DECIMAL(10, 0) | |
* - LONG gets turned into DECIMAL(20, 0) |
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.
OK
|
Test build #85111 has finished for PR 20008 at commit
|
@@ -25,7 +25,7 @@ SELECT array(cast(1 as tinyint), cast(1 as float)) FROM t; | |||
SELECT array(cast(1 as tinyint), cast(1 as double)) FROM t; | |||
SELECT array(cast(1 as tinyint), cast(1 as decimal(10, 0))) FROM t; | |||
SELECT array(cast(1 as tinyint), cast(1 as string)) FROM t; | |||
SELECT array(cast(1 as tinyint), cast('1' as binary)) FROM t; | |||
SELECT size(array(cast(1 as tinyint), cast('1' as binary))) 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.
Replace array(cast(1 as tinyint), cast('1' as binary))
with size(array(cast(1 as tinyint), cast('1' as binary)))
to avoid binary type with collection error.
Test build #85143 has finished for PR 20008 at commit
|
functionArgumentConversion.sql has too many combinations. Let us get rid of this one? |
Test build #85156 has finished for PR 20008 at commit
|
retest this, please. |
Test build #85162 has finished for PR 20008 at commit
|
@@ -252,7 +252,7 @@ case class SpecifiedWindowFrame( | |||
case e: Expression if !frameType.inputType.acceptsType(e.dataType) => | |||
TypeCheckFailure( | |||
s"The data type of the $location bound '${e.dataType} does not match " + | |||
s"the expected data type '${frameType.inputType}'.") | |||
s"the expected data type '${frameType.inputType.simpleString}'.") |
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.
Otherwise the result is:
cannot resolve 'RANGE BETWEEN CURRENT ROW AND CAST(1 AS STRING) FOLLOWING' due to data type mismatch: The data type of the upper bound 'StringType does not match the expected data type 'org.apache.spark.sql.types.TypeCollection@7ff36201'.; line 1 pos 21
Test build #85186 has finished for PR 20008 at commit
|
Test build #85187 has finished for PR 20008 at commit
|
Test build #85215 has finished for PR 20008 at commit
|
Test build #85217 has finished for PR 20008 at commit
|
retest this please |
Test build #85233 has finished for PR 20008 at commit
|
The test failure is not related to this PR. LGTM Thanks! Merged to master. |
What changes were proposed in this pull request?
Test Coverage for
WindowFrameCoercion
andDecimalPrecision
, this is a Sub-tasks for SPARK-22722.How was this patch tested?
N/A