rangadi commented on code in PR #38515:
URL: https://github.com/apache/spark/pull/38515#discussion_r1014668826
##########
connector/protobuf/src/test/scala/org/apache/spark/sql/protobuf/ProtobufCatalystDataConversionSuite.scala:
##########
@@ -123,16 +123,21 @@ class ProtobufCatalystDataConversionSuite
StringType -> ("StringMsg", ""))
testingTypes.foreach { dt =>
- val seed = 1 + scala.util.Random.nextInt((1024 - 1) + 1)
+ val seed = scala.util.Random.nextInt(RandomDataGenerator.MAX_STR_LEN)
test(s"single $dt with seed $seed") {
val (messageName, defaultValue) =
catalystTypesToProtoMessages(dt.fields(0).dataType)
val rand = new scala.util.Random(seed)
val generator = RandomDataGenerator.forType(dt, rand = rand).get
var data = generator()
- while (data.asInstanceOf[Row].get(0) == defaultValue) // Do not use
default values, since
- data = generator() // from_protobuf()
returns null in v3.
+ // Do not use default values, since from_protobuf() returns null in v3.
+ while (
+ data != null &&
Review Comment:
This should just be `data == null || data.asInstanceOf[Row].get(0) ==
defaultValue`?
--
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]