juliuszsompolski commented on code in PR #41742:
URL: https://github.com/apache/spark/pull/41742#discussion_r1243835719


##########
core/src/main/scala/org/apache/spark/api/r/SerDe.scala:
##########
@@ -404,6 +404,22 @@ private[spark] object SerDe {
             writeKeyValue(dos, k1.asInstanceOf[Object], 
v1.asInstanceOf[Object], jvmObjectTracker)
           }
 
+        // Handle Set - write as list
+        case v: java.util.Set[_] =>
+          writeType(dos, "list")
+          writeInt(dos, v.size)
+          val iter = v.iterator
+          while (iter.hasNext) {
+            val elem = iter.next()
+            writeObject(dos, elem.asInstanceOf[Object], jvmObjectTracker)
+          }
+        case v: scala.collection.Set[_] =>
+          writeType(dos, "list")
+          writeInt(dos, v.size)
+          v.foreach { elem =>
+            writeObject(dos, elem.asInstanceOf[Object], jvmObjectTracker)
+          }

Review Comment:
   Added SerDe for Set, so that getJobTags work:
   ```
   > getJobTags()
   list()
   > addJobTag("a")
   > getJobTags()
   [[1]]
   [1] "a"
   
   > clearJobTags()
   > getJobTags()
   list()
   > addJobTag("b")
   > addJobTag("c")
   > getJobTags()
   [[1]]
   [1] "b"
   
   [[2]]
   [1] "c"
   ```



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