Skip to content

Conversation

eejbyfeldt
Copy link

Only adds scala CI builds as I don't belive there is any pre-built
pyspark release using scala 2.13.

@codecov-commenter
Copy link

codecov-commenter commented Aug 25, 2022

Codecov Report

Merging #417 (80fb0f5) into master (82f7979) will not change coverage.
The diff coverage is 0.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@           Coverage Diff           @@
##           master     #417   +/-   ##
=======================================
  Coverage   91.19%   91.19%           
=======================================
  Files          18       18           
  Lines         829      829           
  Branches       49       49           
=======================================
  Hits          756      756           
  Misses         73       73           
Impacted Files Coverage Δ
...main/scala/org/graphframes/lib/ShortestPaths.scala 96.00% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -54,7 +54,7 @@ class ShortestPaths private[graphframes] (private val graph: GraphFrame) extends
* The list of landmark vertex ids. Shortest paths will be computed to each landmark.
*/
def landmarks(value: util.ArrayList[Any]): this.type = {
landmarks(value.asScala)
landmarks(value.asScala.toSeq)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change this ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking it a bit closer to why this was needed in probably this change in scala 2.13 (https://github.com/scala/scala/releases/tag/v2.13.0)


* Immutable scala.Seq
  * Seq is now an alias for collection.immutable.Seq
    * Before, it was an alias for the possibly-mutable collection.Seq.

So when the java.util.ArrayList[Any] is converted we end up with a scala.collection.mutable.Buffer[Any]. In scala 2.12 this is a sub type of Seq[Any] while in scala 2.13 it it not (it only a subtype of mutable.Seq). So my fix of doing toSeq probably makes a extra copy. One other solution might be that one change Seq to collection.Seq in the needed places to keep the 2.12 semantics. With this change

diff --git a/src/main/scala/org/graphframes/lib/ShortestPaths.scala b/src/main/scala/org/graphframes/lib/ShortestPaths.scala
index f110d6f..4641ce7 100644
--- a/src/main/scala/org/graphframes/lib/ShortestPaths.scala
+++ b/src/main/scala/org/graphframes/lib/ShortestPaths.scala
@@ -19,6 +19,7 @@ package org.graphframes.lib
 
 import java.util
 
+import scala.collection
 import scala.collection.JavaConverters._
 
 import org.apache.spark.graphx.{lib => graphxlib}
@@ -39,12 +40,12 @@ import org.graphframes.GraphFrame
  *    the shortest-path distance to each reachable landmark vertex.
  */
 class ShortestPaths private[graphframes] (private val graph: GraphFrame) extends Arguments {
-  private var lmarks: Option[Seq[Any]] = None
+  private var lmarks: Option[collection.Seq[Any]] = None
 
   /**
    * The list of landmark vertex ids. Shortest paths will be computed to each landmark.
    */
-  def landmarks(value: Seq[Any]): this.type = {
+  def landmarks(value: collection.Seq[Any]): this.type = {
     // TODO(tjh) do some initial checks here, without running queries.
     lmarks = Some(value)
     this
@@ -54,7 +55,7 @@ class ShortestPaths private[graphframes] (private val graph: GraphFrame) extends
    * The list of landmark vertex ids. Shortest paths will be computed to each landmark.
    */
   def landmarks(value: util.ArrayList[Any]): this.type = {
-    landmarks(value.asScala.toSeq)
+    landmarks(value.asScala)
   }
 
   def run(): DataFrame = {
@@ -64,7 +65,7 @@ class ShortestPaths private[graphframes] (private val graph: GraphFrame) extends
 
 private object ShortestPaths {
 
-  private def run(graph: GraphFrame, landmarks: Seq[Any]): DataFrame = {
+  private def run(graph: GraphFrame, landmarks: collection.Seq[Any]): DataFrame = {
     val idType = graph.vertices.schema(GraphFrame.ID).dataType
     val longIdToLandmark = landmarks.map(l => GraphXConversions.integralId(graph, l) -> l).toMap
     val gx = graphxlib.ShortestPaths.run(

it also compile both in 2.12 and 2.13.

@rjurney
Copy link
Collaborator

rjurney commented Oct 19, 2022

Can we merge this?

@RRajdev
Copy link

RRajdev commented Feb 21, 2023

@eejbyfeldt I would be grateful if you could please merge this as my team and I would like to use it

@eejbyfeldt
Copy link
Author

@RRajdev I am not a committer to this project so I do not have the rights needed to merge the PR. We would need the reviewer @WeichenXu123 or some other committer to merge it.

Only adds scala CI builds as I don't belive there is any pre-built
pyspark release using scala 2.13.
@RRajdev
Copy link

RRajdev commented Feb 21, 2023 via email

@RRajdev
Copy link

RRajdev commented Feb 21, 2023

@WeichenXu123 @codecov-commenter @rjurney can this please be merged in as our team could use this change - tia

@WeichenXu123 WeichenXu123 merged commit 3d76998 into graphframes:master Feb 22, 2023
@rjurney
Copy link
Collaborator

rjurney commented Feb 22, 2023

Cool!

@morazow morazow mentioned this pull request Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants