This is an automated email from the ASF dual-hosted git repository. dongjoon pushed a commit to branch branch-3.5 in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.5 by this push: new d82403f98033 Revert "[SPARK-48081] Fix ClassCastException in NTile.checkInputDataTypes() when argument is non-foldable or of wrong type" d82403f98033 is described below commit d82403f980334cd40b1f24518c9c766827710c8c Author: Dongjoon Hyun <dh...@apple.com> AuthorDate: Thu May 2 08:42:24 2024 -0700 Revert "[SPARK-48081] Fix ClassCastException in NTile.checkInputDataTypes() when argument is non-foldable or of wrong type" This reverts commit 3d72063ccec6167bd3fe92e24a0ebd11bec8637b. --- .../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 a4ce78d1bb6d..50c98c01645d 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 @@ -850,7 +850,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", @@ -861,7 +861,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 48d9266542f1..e8dc9061199c 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 @@ -344,40 +344,6 @@ class AnalysisErrorSuite extends AnalysisTest { "inputType" -> "\"BOOLEAN\"", "requiredType" -> "\"INT\"")) - 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-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org