heyihong commented on code in PR #54016:
URL: https://github.com/apache/spark/pull/54016#discussion_r2736731819
##########
sql/connect/common/src/main/scala/org/apache/spark/sql/connect/client/SparkConnectClient.scala:
##########
@@ -1103,7 +1104,13 @@ object SparkConnectClient {
responseListener: ClientCall.Listener[RespT],
headers: Metadata): Unit = {
metadata.foreach { case (key, value) =>
- headers.put(Metadata.Key.of(key,
Metadata.ASCII_STRING_MARSHALLER), value)
+ if (key != null && key.endsWith("-bin")) {
Review Comment:
No problem! IMHO, the code might be simpler or more understandable if we
handle these null checks elsewhere (e.g., in the constructor). An analogy is
that, to guarantee thread safety, we don’t need to add synchronization or
atomic values to every class.
Besides, a null key or a null value will also cause
headers.put(Metadata.Key.of(key, Metadata.ASCII_STRING_MARSHALLER), value) to
fail.
##########
sql/connect/common/src/main/scala/org/apache/spark/sql/connect/client/SparkConnectClient.scala:
##########
@@ -1103,7 +1104,13 @@ object SparkConnectClient {
responseListener: ClientCall.Listener[RespT],
headers: Metadata): Unit = {
metadata.foreach { case (key, value) =>
- headers.put(Metadata.Key.of(key,
Metadata.ASCII_STRING_MARSHALLER), value)
+ if (key != null && key.endsWith("-bin")) {
Review Comment:
No problem! IMHO, the code might be simpler or more understandable if we
handle these null checks elsewhere (e.g., in the constructor). An analogy is
that, to guarantee thread safety, we don’t need to add synchronization or
atomic values to every class.
Besides, a null key or a null value will also cause
`headers.put(Metadata.Key.of(key, Metadata.ASCII_STRING_MARSHALLER), value)` to
fail.
--
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]