heyihong commented on code in PR #52270:
URL: https://github.com/apache/spark/pull/52270#discussion_r2337232144


##########
sql/connect/common/src/main/scala/org/apache/spark/sql/connect/common/LiteralValueProtoConverter.scala:
##########
@@ -434,11 +434,18 @@ object LiteralValueProtoConverter {
       case proto.DataType.KindCase.BOOLEAN => v => v.getBoolean
       case proto.DataType.KindCase.STRING => v => v.getString
       case proto.DataType.KindCase.BINARY => v => v.getBinary.toByteArray
-      case proto.DataType.KindCase.DATE => v => v.getDate
-      case proto.DataType.KindCase.TIMESTAMP => v => v.getTimestamp
-      case proto.DataType.KindCase.TIMESTAMP_NTZ => v => v.getTimestampNtz
-      case proto.DataType.KindCase.DAY_TIME_INTERVAL => v => 
v.getDayTimeInterval
-      case proto.DataType.KindCase.YEAR_MONTH_INTERVAL => v => 
v.getYearMonthInterval
+      case proto.DataType.KindCase.DATE =>
+        v => SparkDateTimeUtils.toJavaDate(v.getDate)

Review Comment:
   @cloud-fan The client side does not know how to convert external Java 
objects into internal Catalyst values if I understand correctly. The conversion 
occurs 
[here](https://github.com/apache/spark/blob/master/sql/connect/common/src/main/scala/org/apache/spark/sql/connect/common/LiteralValueProtoConverter.scala#L135-L152)
 in LiteralValueProtoConverter and the server just converts the Proto value 
back to the Java object.
   
   This code path is also needed in the Scala client, since the client may need 
to convert temporal values from proto observed metrics into Java objects.



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