You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "Leibnizhu (via GitHub)" <gi...@apache.org> on 2023/04/04 13:14:27 UTC

[GitHub] [spark] Leibnizhu commented on a diff in pull request #40634: [SPARK-42840][SQL] Rename the error class _LEGACY_ERROR_TEMP_2004 to NO_DEFAULT_FOR_DATA_TYPE

Leibnizhu commented on code in PR #40634:
URL: https://github.com/apache/spark/pull/40634#discussion_r1157229607


##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/LiteralExpressionSuite.scala:
##########
@@ -88,6 +88,17 @@ class LiteralExpressionSuite extends SparkFunSuite with ExpressionEvalHelper {
     checkEvaluation(Literal.default(StructType(StructField("a", StringType) :: Nil)), Row(""))
     // ExamplePointUDT.sqlType is ArrayType(DoubleType, false).
     checkEvaluation(Literal.default(new ExamplePointUDT), Array())
+
+    // DateType without default value`
+    List(CharType(1), VarcharType(1)).foreach(errType => {
+      checkError(
+        exception = intercept[SparkRuntimeException] {
+          Literal.default(errType)

Review Comment:
   no. 
   
   As analyzed in the this PR's description, if user defines a DataType which is not supported in `Literal.default`, then this DataType does not have a matched Encoder in `RowEncoder#encoderForDataType`, and his code doesn't work.
   
   I will change the exception to `SparkException.internalError()`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org