Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions core/src/main/resources/error/error-classes.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,6 @@
"message" : [ "Failed to rename as %s was not found" ],
"sqlState" : "22023"
},
"ROW_FROM_CSV_PARSER_NOT_EXPECTED" : {
"message" : [ "Expected one row from CSV parser." ],
"sqlState" : "42000"
},
"SECOND_FUNCTION_ARGUMENT_NOT_INTEGER" : {
"message" : [ "The second argument of '%s' function needs to be an integer." ],
"sqlState" : "22023"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3591,7 +3591,8 @@ class Analyzer(override val catalogManager: CatalogManager)
case u @ UpCast(child, _, _) if !child.resolved => u

case UpCast(_, target, _) if target != DecimalType && !target.isInstanceOf[DataType] =>
throw QueryCompilationErrors.unsupportedAbstractDataTypeForUpCastError(target)
throw new IllegalStateException(
s"UpCast only supports DecimalType as AbstractDataType yet, but got: $target")

case UpCast(child, target, walkedTypePath) if target == DecimalType
&& child.dataType.isInstanceOf[DecimalType] =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ case class CsvToStructs(
assert(!rows.hasNext)
result
} else {
throw QueryExecutionErrors.rowFromCSVParserNotExpectedError
throw new IllegalStateException("Expected one row from CSV parser.")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do believe this shouldn't happen. cc @HyukjinKwon

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,6 @@ object QueryCompilationErrors {
)
}

def unsupportedAbstractDataTypeForUpCastError(gotType: AbstractDataType): Throwable = {
new AnalysisException(
errorClass = "UNSUPPORTED_FEATURE",
messageParameters =
Array(s"UpCast only support DecimalType as AbstractDataType yet, but got: $gotType")
)
}

def outerScopeFailureForNewInstanceError(className: String): Throwable = {
new AnalysisException(
s"Unable to generate an encoder for inner class `$className` without " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,6 @@ object QueryExecutionErrors {
}
}

def rowFromCSVParserNotExpectedError(): Throwable = {
new SparkIllegalArgumentException(errorClass = "ROW_FROM_CSV_PARSER_NOT_EXPECTED",
messageParameters = Array.empty)
}

def inputTypeUnsupportedError(dataType: DataType): Throwable = {
new IllegalArgumentException(s"Unsupported input type ${dataType.catalogString}")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@

package org.apache.spark.sql.errors

import org.apache.spark.sql.{AnalysisException, Dataset, QueryTest}
import org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute
import org.apache.spark.sql.catalyst.expressions.{Alias, UpCast}
import org.apache.spark.sql.catalyst.plans.logical.Project
import org.apache.spark.sql.{AnalysisException, QueryTest}
import org.apache.spark.sql.functions.{grouping, grouping_id}
import org.apache.spark.sql.test.SharedSparkSession
import org.apache.spark.sql.types.NumericType

case class StringLongClass(a: String, b: Long)

Expand Down Expand Up @@ -63,21 +59,6 @@ class QueryCompilationErrorsSuite extends QueryTest with SharedSparkSession {
""".stripMargin.trim + " of the field in the target object")
}

test("UNSUPPORTED_FEATURE: UpCast only support DecimalType as AbstractDataType") {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test was added by #35366 recently while porting on error classes. So, it is safe to remove it.

val df = sql("select 1 as value")

val msg = intercept[AnalysisException] {
val plan = Project(
Seq(Alias(UpCast(UnresolvedAttribute("value"), NumericType), "value")()),
df.logicalPlan)

Dataset.ofRows(spark, plan)
}.message
assert(msg.matches("The feature is not supported: " +
"UpCast only support DecimalType as AbstractDataType yet," +
""" but got: org.apache.spark.sql.types.NumericType\$\@\w+"""))
}

test("UNSUPPORTED_GROUPING_EXPRESSION: filter with grouping/grouping_Id expression") {
val df = Seq(
(536361, "85123A", 2, 17850),
Expand Down