You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "LuciferYang (via GitHub)" <gi...@apache.org> on 2023/11/28 07:12:17 UTC

[PR] [SPARK-46134][PROTOBUF][TESTS] Replace `df.take(1).toSeq(0)` with `df.first()` in `ProtobufFunctionsSuite` [spark]

LuciferYang opened a new pull request, #44048:
URL: https://github.com/apache/spark/pull/44048

   ### What changes were proposed in this pull request?
   In `ProtobufFunctionsSuite`, there are some cases where `df.take(1).toSeq(0)` is used to get the first data in the DataFrame. This pr changes them to use the `.first()` API to achieve the same purpose, which looks relatively clearer and more concise.
   
   ### Why are the changes needed?
   `.first()` API appears to have clearer semantics.
   
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   
   ### How was this patch tested?
   Pass GitHub Actions
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No
   


-- 
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-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46134][PROTOBUF][TESTS] Replace `df.take(1).toSeq(0)` with `df.first()` in `ProtobufFunctionsSuite` [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on code in PR #44048:
URL: https://github.com/apache/spark/pull/44048#discussion_r1407686205


##########
connector/protobuf/src/test/scala/org/apache/spark/sql/protobuf/ProtobufFunctionsSuite.scala:
##########
@@ -503,9 +503,9 @@ class ProtobufFunctionsSuite extends QueryTest with SharedSparkSession with Prot
       }
     }
     assert(
-      toProtoDfToFromProtoDf.select("toProtoToFromProto.value").take(1).toSeq(0).get(0) == null)
+      toProtoDfToFromProtoDf.select("toProtoToFromProto.value").first().isNullAt(0))

Review Comment:
   Let's consult the developer of this module :)
   
   friendly ping @SandishKumarHN @rangadi 



-- 
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-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46134][PROTOBUF][TESTS] Replace `df.take(1).toSeq(0)` with `df.first()` in `ProtobufFunctionsSuite` [spark]

Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on code in PR #44048:
URL: https://github.com/apache/spark/pull/44048#discussion_r1407681613


##########
connector/protobuf/src/test/scala/org/apache/spark/sql/protobuf/ProtobufFunctionsSuite.scala:
##########
@@ -503,9 +503,9 @@ class ProtobufFunctionsSuite extends QueryTest with SharedSparkSession with Prot
       }
     }
     assert(
-      toProtoDfToFromProtoDf.select("toProtoToFromProto.value").take(1).toSeq(0).get(0) == null)
+      toProtoDfToFromProtoDf.select("toProtoToFromProto.value").first().isNullAt(0))

Review Comment:
   Looks good. But I don't know if it's used to test `take(1)`?



-- 
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-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46134][PROTOBUF][TESTS] Replace `df.take(1).toSeq(0)` with `df.first()` in `ProtobufFunctionsSuite` [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #44048:
URL: https://github.com/apache/spark/pull/44048#issuecomment-1830548012

   Merged to master. Thank you, @LuciferYang , @beliefer , @rangadi , @SandishKumarHN .


-- 
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-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-46134][PROTOBUF][TESTS] Replace `df.take(1).toSeq(0)` with `df.first()` in `ProtobufFunctionsSuite` [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun closed pull request #44048: [SPARK-46134][PROTOBUF][TESTS] Replace `df.take(1).toSeq(0)` with `df.first()` in `ProtobufFunctionsSuite`
URL: https://github.com/apache/spark/pull/44048


-- 
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-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org