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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to