-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace JGraphT with scala-graph #3297
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for finding a new library and implementing those graph algorithms. However there are some serious issues remaining. Please see the comments.
import edu.uci.ics.amber.core.workflow.PhysicalLink | ||
import org.jgrapht.alg.connectivity.BiconnectivityInspector | ||
import edu.uci.ics.amber.core.workflow.{PhysicalLink, PhysicalPlan, WorkflowContext} | ||
import edu.uci.ics.amber.engine.common.{AmberConfig, AmberLogging} | ||
import org.jgrapht.graph.{DirectedAcyclicGraph, DirectedPseudograph} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jgrapht is still used in many other places in the amber module. Please do a thorough check.
operatorList: List[LogicalOp], | ||
links: List[LogicalLink] | ||
): DirectedAcyclicGraph[OperatorIdentity, LogicalLink] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the Graph
class ensure the plan is a DAG? For jgrapht if a plan is not a DAG an error will be thrown. If Graph does not ensure the acyclicity part of a DAG, do we implement that ourselves? The acyclicity is crucial for scheduling (RegionDAG
), which is currently still implemented as a jgrapht DAG.
@transient private lazy val operatorMap: Map[PhysicalOpIdentity, PhysicalOp] = | ||
operators.map(o => (o.id, o)).toMap | ||
|
||
// the dag will be re-computed again once it reaches the coordinator. | ||
@transient lazy val dag: DirectedAcyclicGraph[PhysicalOpIdentity, PhysicalLink] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
Since JgraphT is dual-licensed with EPL and EPL is ok-ish for the apache project, we decided to keep JGraphT.
|
This PR replaces the usage of JGraphT with another library called scala-graph, which is under an apache2.0 license.
I evaluated the support for JGraphT use cases in scala-graph:
(Supported) create a DAG from both a logical and physical plan. This DAG should allow multiple edges between 2 vertices.
(Not supported) find bridges in a DAG. A bridge is an edge whose removal will cause an increase of weakly connected components.
compute maxChains, which requires
(Supported) find weakly connected components.
For the Not supported part, I re-implemented them.