Skip to content

Commit

Permalink
[BugFix] Fix the Spark Writer bug when the column name contains a dot…
Browse files Browse the repository at this point in the history
…(.) (#101)
  • Loading branch information
lixueclaire authored Feb 15, 2023
1 parent 789fe48 commit c2c5ec6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ object IndexGenerator {
val srcCol = GeneralParams.srcIndexCol;
val indexCol = GeneralParams.vertexIndexCol;
val srcPrimaryKey = GeneralParams.primaryCol;
val trans_df = spark.sql(f"select src_vertex.$indexCol%s as $srcCol%s, edge.* from edge inner join src_vertex on src_vertex.$srcPrimaryKey%s=edge.$srcColumnName%s")
val trans_df = spark.sql(f"select src_vertex.`$indexCol` as `$srcCol`, edge.* from edge inner join src_vertex on src_vertex.`$srcPrimaryKey`=edge.`$srcColumnName`")
// drop the old src id col
trans_df.drop(srcColumnName)
}
Expand All @@ -131,7 +131,7 @@ object IndexGenerator {
val dstCol = GeneralParams.dstIndexCol;
val indexCol = GeneralParams.vertexIndexCol;
val dstPrimaryKey = GeneralParams.primaryCol;
val trans_df = spark.sql(f"select dst_vertex.$indexCol%s as $dstCol%s, edges.* from edges inner join dst_vertex on dst_vertex.$dstPrimaryKey%s=edges.$dstColumnName%s")
val trans_df = spark.sql(f"select dst_vertex.`$indexCol` as `$dstCol`, edges.* from edges inner join dst_vertex on dst_vertex.`$dstPrimaryKey`=edges.`$dstColumnName`")
// drop the old dst id col
trans_df.drop(dstColumnName)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class EdgeWriter(prefix: String, edgeInfo: EdgeInfo, adjListType: AdjListType.V
val p_it = propertyGroup.getProperties().iterator
while (p_it.hasNext()) {
val property = p_it.next()
property_list += property.getName()
property_list += "`" + property.getName() + "`"
}
var chunk_index: Long = 0
for (chunk <- chunks) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class VertexWriter(prefix: String, vertexInfo: VertexInfo, vertexDf: DataFrame)
val it = propertyGroup.getProperties().iterator
while (it.hasNext()) {
val property = it.next()
property_list += property.getName()
property_list += "`" + property.getName() + "`"
}
val pg_df = chunks.select(property_list.map(col): _*)
FileSystem.writeDataFrame(pg_df, propertyGroup.getFile_type(), output_prefix)
Expand Down

0 comments on commit c2c5ec6

Please sign in to comment.