Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dengziming committed Oct 18, 2023
1 parent 09b39b0 commit f6af80d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion common/utils/src/main/resources/error/error-classes.json
Original file line number Diff line number Diff line change
Expand Up @@ -3017,7 +3017,7 @@
},
"UNEXPECTED_SERIALIZER_FOR_CLASS" : {
"message" : [
"Class <clsName> has unexpected serializer: <objSerializer>."
"The class <className> has an unexpected expression serializer. Expects \"STRUCT\" or \"IF\" which returns \"STRUCT\" but found <expr>."
],
"sqlState" : "42846"
},
Expand Down
2 changes: 1 addition & 1 deletion docs/sql-error-conditions.md
Original file line number Diff line number Diff line change
Expand Up @@ -1945,7 +1945,7 @@ Cannot invoke function `<functionName>` because it contains positional argument(

[SQLSTATE: 42846](sql-error-conditions-sqlstates.html#class-42-syntax-error-or-access-rule-violation)

Class `<clsName>` has unexpected serializer: `<objSerializer>`.
The class `<className>` has an unexpected expression serializer. Expects "STRUCT" or "IF" which returns "STRUCT" but found `<expr>`.

### UNKNOWN_PROTOBUF_MESSAGE_TYPE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1364,8 +1364,8 @@ private[sql] object QueryExecutionErrors extends QueryErrorsBase with ExecutionE
new SparkRuntimeException(
errorClass = "UNEXPECTED_SERIALIZER_FOR_CLASS",
messageParameters = Map(
"clsName" -> clsName,
"objSerializer" -> objSerializer.toString()))
"className" -> clsName,
"expr" -> toSQLExpr(objSerializer)))
}

def unsupportedOperandTypeForSizeFunctionError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import org.apache.spark.sql.catalyst.plans.CodegenInterpretedPlanTest
import org.apache.spark.sql.catalyst.plans.logical.LocalRelation
import org.apache.spark.sql.catalyst.types.DataTypeUtils.toAttributes
import org.apache.spark.sql.catalyst.util.ArrayData
import org.apache.spark.sql.errors.QueryErrorsBase
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.types._
import org.apache.spark.unsafe.types.{CalendarInterval, UTF8String}
Expand Down Expand Up @@ -138,7 +139,8 @@ case class OptionNestedGeneric[T](list: Option[T])
case class MapNestedGenericKey[T](list: Map[T, Int])
case class MapNestedGenericValue[T](list: Map[Int, T])

class ExpressionEncoderSuite extends CodegenInterpretedPlanTest with AnalysisTest {
class ExpressionEncoderSuite extends CodegenInterpretedPlanTest with AnalysisTest
with QueryErrorsBase {
OuterScopes.addOuterScope(this)

implicit def encoder[T : TypeTag]: ExpressionEncoder[T] = verifyNotLeakingReflectionObjects {
Expand Down Expand Up @@ -590,8 +592,8 @@ class ExpressionEncoderSuite extends CodegenInterpretedPlanTest with AnalysisTes
exception = exception,
errorClass = "UNEXPECTED_SERIALIZER_FOR_CLASS",
parameters = Map(
"clsName" -> Utils.getSimpleName(encoder.clsTag.runtimeClass),
"objSerializer" -> unexpectedSerializer.toString())
"className" -> Utils.getSimpleName(encoder.clsTag.runtimeClass),
"expr" -> toSQLExpr(unexpectedSerializer))
)
}

Expand Down

0 comments on commit f6af80d

Please sign in to comment.