MaxGekk commented on code in PR #45183:
URL: https://github.com/apache/spark/pull/45183#discussion_r1497386712


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala:
##########
@@ -1908,8 +1908,8 @@ private[sql] object QueryCompilationErrors extends 
QueryErrorsBase with Compilat
 
   def cannotConvertDataTypeToParquetTypeError(field: StructField): Throwable = 
{
     new AnalysisException(
-      errorClass = "_LEGACY_ERROR_TEMP_1175",
-      messageParameters = Map("dataType" -> field.dataType.catalogString))
+      errorClass = "UNSUPPORTED_DATATYPE",
+      messageParameters = Map("typeName" -> field.dataType.catalogString))

Review Comment:
   Could you quote the type using `toSQLType()` (the function uses slightly 
different converter of Catalyst type to strings. That's more consistent to 
other errors).



##########
sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala:
##########
@@ -962,6 +963,22 @@ class QueryCompilationErrorsSuite
         "methodName" -> "update",
         "className" -> "org.apache.spark.sql.catalyst.expressions.UnsafeRow"))
   }
+
+  test("SPARK-42328: Convert unsupported data type from Spark to Parquet") {
+    val converter = new SparkToParquetSchemaConverter
+    val dummyDataType = new DataType {
+      override def defaultSize: Int = 0
+
+      override private[spark] def asNullable = NullType
+    }
+    checkError(
+      exception = intercept[AnalysisException] {
+        converter.convertField(StructField("test", dummyDataType))

Review Comment:
   Is it possible to reproduce the error using public API. If not, we should 
think of converting to an internal error.



-- 
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