siying commented on code in PR #49473:
URL: https://github.com/apache/spark/pull/49473#discussion_r1914207839


##########
connector/protobuf/src/main/scala/org/apache/spark/sql/protobuf/ProtobufSerializer.scala:
##########
@@ -52,6 +52,10 @@ private[sql] class ProtobufSerializer(
         rootCatalystType match {
           case st: StructType =>
             newStructConverter(st, rootDescriptor, Nil, Nil).asInstanceOf[Any 
=> Any]
+          case _ =>
+            throw QueryCompilationErrors.cannotConvertSqlTypeToProtobufError(
+              rootDescriptor.getName,
+              rootCatalystType)

Review Comment:
   @HyukjinKwon the catching below is only for `AnalysisException`, we are not 
catching MatchError here.
   
   Without this change, the new unit test will fail.



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala:
##########
@@ -3783,6 +3783,14 @@ private[sql] object QueryCompilationErrors extends 
QueryErrorsBase with Compilat
       cause = Option(cause))
   }
 
+  def cannotConvertSqlTypeToProtobufError(

Review Comment:
   Oh I didn't know `Option(null)` is None. We can obviously reuse then!



-- 
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-unsubscr...@spark.apache.org

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


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

Reply via email to