Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
acezen committed Mar 1, 2023
1 parent c92c328 commit 4789ae6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ object GraphReader {
/** Loads the vertex chunks as DataFrame with the vertex infos.
*
* @param prefix The absolute prefix.
* @param vertexInfos The map of (vertex label -> VertexInfo) for the graph..
* @param spark The Spark session for the transformer.
* @param vertexInfos The map of (vertex label -> VertexInfo) for the graph.
* @param spark The Spark session for the reading.
* @return The map of (vertex label -> DataFrame)
*/
private def readAllVertices(prefix: String, vertexInfos: Map[String, VertexInfo], spark: SparkSession): Map[String, DataFrame] = {
Expand All @@ -42,8 +42,8 @@ object GraphReader {
/** Loads the edge chunks as DataFrame with the edge infos.
*
* @param prefix The absolute prefix.
* @param edgeInfos The map of (srcLabel_edgeLabel_dstlabel -> EdgeInfo) for the graph..
* @param spark The Spark session for the transformer.
* @param edgeInfos The map of (srcLabel_edgeLabel_dstlabel -> EdgeInfo) for the graph.
* @param spark The Spark session for the reading.
* @return The map of (srcLabel_edgeLabel_dstlabel -> (adj_list_type_str -> DataFrame))
*/
private def readAllEdges(prefix: String, edgeInfos: Map[String, EdgeInfo], spark: SparkSession): Map[String, Map[String, DataFrame]] = {
Expand Down
17 changes: 10 additions & 7 deletions spark/src/main/scala/com/alibaba/graphar/graph/GraphWriter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ object GraphWriter {
* @param vertexInfos The map of (vertex label -> VertexInfo) for the graph.
* @param vertexNumMap vertex num of vertices, a map of (vertex label -> vertex num)
* @param vertexDataFrames vertex dataframes, a map of (vertex label -> DataFrame)
* @param spark The Spark session for the transformer.
* @param spark The Spark session for the writing.
*/
private def writeAllVertices(prefix: String,
vertexInfos: Map[String, VertexInfo],
Expand All @@ -53,8 +53,8 @@ object GraphWriter {
* @param edgeInfos The map of (srclabel_edgeLabel_dstLabel -> EdgeInfo) for the graph.
* @param vertexNumMap vertex num of vertices, a map of (vertex label -> vertex num)
* @param vertexDataFrames vertex dataframes, a map of (vertex label -> DataFrame)
* @param edgeDataFrames: edge dataframes, a map of (srcLabel_edgeLabel_dstLabel -> DataFrame)
* @param spark The Spark session for the transformer.
* @param edgeDataFrames edge dataframes, a map of (srcLabel_edgeLabel_dstLabel -> DataFrame)
* @param spark The Spark session for the writing.
*/
private def writeAllEdges(prefix: String,
vertexInfos: Map[String, VertexInfo],
Expand Down Expand Up @@ -95,12 +95,15 @@ object GraphWriter {

/** Writing the graph DataFrames to GAR with the graph info object.
*
* @param graphInfoPath The graph info object of the graph.
* @param graphInfo The graph info object of the graph.
* @param vertexDataFrames: vertex dataframes, a map of (vertex label -> DataFrame)
* @param edgeDataFrames: edge dataframes, a map of (srcLabel_edgeLabel_dstLabel -> DataFrame)
* @param spark The Spark session for the loading.
* @param spark The Spark session for the writing.
*/
def write(graphInfo: GraphInfo, vertexDataFrames: Map[String, DataFrame], edgeDataFrames: Map[String, DataFrame], spark: SparkSession): Unit = {
def write(graphInfo: GraphInfo,
vertexDataFrames: Map[String, DataFrame],
edgeDataFrames: Map[String, DataFrame],
spark: SparkSession): Unit = {
// get the vertex num of each vertex dataframe
val vertex_num_map: Map[String, Long] = vertexDataFrames.map { case (k, v) => (k, v.count()) }
val prefix = graphInfo.getPrefix
Expand All @@ -119,7 +122,7 @@ object GraphWriter {
* @param graphInfoPath The path of the graph info yaml.
* @param vertexDataFrames: vertex dataframes, a map of (vertex label -> DataFrame)
* @param edgeDataFrames: edge dataframes, a map of (srcLabel_edgeLabel_dstLabel -> DataFrame)
* @param spark The Spark session for the loading.
* @param spark The Spark session for the writing.
*/
def write(graphInfoPath: String, vertexDataFrames: Map[String, DataFrame], edgeDataFrames: Map[String, DataFrame], spark: SparkSession): Unit = {
// load graph info
Expand Down

0 comments on commit 4789ae6

Please sign in to comment.