nikolamand-db commented on code in PR #46180:
URL: https://github.com/apache/spark/pull/46180#discussion_r1601309336


##########
connector/connect/common/src/main/scala/org/apache/spark/sql/connect/common/DataTypeProtoConverter.scala:
##########
@@ -80,7 +81,7 @@ object DataTypeProtoConverter {
   }
 
   private def toCatalystStringType(t: proto.DataType.String): StringType =
-    StringType(t.getCollationId)
+    StringType(if (t.getCollation.nonEmpty) t.getCollation else "UTF8_BINARY")

Review Comment:
   Please check protobuf 
[comment](https://github.com/apache/spark/pull/46180#discussion_r1601306785). 
The goal here is to support backwards compatibility in case of old PySpark 
client version for example. From protobuf 
[docs](https://protobuf.dev/programming-guides/proto3/#default), the default 
value for string is empty string so if client fails to set this field (in case 
of old client), we interpret collation as `UTF8_BINARY`.



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