justaparth commented on code in PR #41108:
URL: https://github.com/apache/spark/pull/41108#discussion_r1189463819


##########
connector/protobuf/src/test/scala/org/apache/spark/sql/protobuf/ProtobufFunctionsSuite.scala:
##########
@@ -1531,6 +1531,47 @@ class ProtobufFunctionsSuite extends QueryTest with 
SharedSparkSession with Prot
     }
   }
 
+  test("test unsigned integer types") {
+    // The java type for uint32 and uint64 is signed integer and long 
respectively.
+    // Let's check that we're converting correctly
+    val sample = spark.range(1).select(
+      lit(
+        SimpleMessage
+          .newBuilder()
+          .setUint32Value(Integer.MIN_VALUE)
+          .setUint64Value(Long.MinValue)
+          .build()
+          .toByteArray
+      ).as("raw_proto"))
+
+    val expected = spark.range(1).select(
+      
lit(Integer.toUnsignedLong(Integer.MIN_VALUE).longValue).as("uint32_value"),

Review Comment:
   using MIN_VALUE as its all 1s in binary and is the largest possible number 
if its interpreted as "unsigned"



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