You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2024/05/02 15:43:03 UTC
(spark) branch branch-3.4 updated: Revert "[SPARK-48081] Fix ClassCastException in NTile.checkInputDataTypes() when argument is non-foldable or of wrong type"
This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch branch-3.4
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.4 by this push:
new 4baf5ee19ba4 Revert "[SPARK-48081] Fix ClassCastException in NTile.checkInputDataTypes() when argument is non-foldable or of wrong type"
4baf5ee19ba4 is described below
commit 4baf5ee19ba410ea39d784380b8e5ae434cf8601
Author: Dongjoon Hyun <dh...@apple.com>
AuthorDate: Thu May 2 08:42:48 2024 -0700
Revert "[SPARK-48081] Fix ClassCastException in NTile.checkInputDataTypes() when argument is non-foldable or of wrong type"
This reverts commit 32789ba3bbaa98dd14537d80204ed4aab8f77d9b.
---
.../catalyst/expressions/windowExpressions.scala | 4 +--
.../sql/catalyst/analysis/AnalysisErrorSuite.scala | 34 ----------------------
2 files changed, 2 insertions(+), 36 deletions(-)
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala
index adc32866f58d..2d11b581ee4c 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala
@@ -848,7 +848,7 @@ case class NTile(buckets: Expression) extends RowNumberLike with SizeBasedWindow
// for each partition.
override def checkInputDataTypes(): TypeCheckResult = {
if (!buckets.foldable) {
- return DataTypeMismatch(
+ DataTypeMismatch(
errorSubClass = "NON_FOLDABLE_INPUT",
messageParameters = Map(
"inputName" -> "buckets",
@@ -859,7 +859,7 @@ case class NTile(buckets: Expression) extends RowNumberLike with SizeBasedWindow
}
if (buckets.dataType != IntegerType) {
- return DataTypeMismatch(
+ DataTypeMismatch(
errorSubClass = "UNEXPECTED_INPUT_TYPE",
messageParameters = Map(
"paramIndex" -> "1",
diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisErrorSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisErrorSuite.scala
index 5a2aa87d7a83..cbd6749807f7 100644
--- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisErrorSuite.scala
+++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisErrorSuite.scala
@@ -316,40 +316,6 @@ class AnalysisErrorSuite extends AnalysisTest {
listRelation.select(Explode($"list").as("a"), Explode($"list").as("b")),
"only one generator" :: "explode" :: Nil)
- errorClassTest(
- "the buckets of ntile window function is not foldable",
- testRelation2.select(
- WindowExpression(
- NTile(Literal(99.9f)),
- WindowSpecDefinition(
- UnresolvedAttribute("a") :: Nil,
- SortOrder(UnresolvedAttribute("b"), Ascending) :: Nil,
- UnspecifiedFrame)).as("window")),
- errorClass = "DATATYPE_MISMATCH.UNEXPECTED_INPUT_TYPE",
- messageParameters = Map(
- "sqlExpr" -> "\"ntile(99.9)\"",
- "paramIndex" -> "first",
- "inputSql" -> "\"99.9\"",
- "inputType" -> "\"FLOAT\"",
- "requiredType" -> "\"INT\""))
-
-
- errorClassTest(
- "the buckets of ntile window function is not int literal",
- testRelation2.select(
- WindowExpression(
- NTile(AttributeReference("b", IntegerType)()),
- WindowSpecDefinition(
- UnresolvedAttribute("a") :: Nil,
- SortOrder(UnresolvedAttribute("b"), Ascending) :: Nil,
- UnspecifiedFrame)).as("window")),
- errorClass = "DATATYPE_MISMATCH.NON_FOLDABLE_INPUT",
- messageParameters = Map(
- "sqlExpr" -> "\"ntile(b)\"",
- "inputName" -> "`buckets`",
- "inputExpr" -> "\"b\"",
- "inputType" -> "\"INT\""))
-
errorClassTest(
"unresolved attributes",
testRelation.select($"abcd"),
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org