From 1ea290e246ad819d52331a8c8061a24ae07169b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=89=E7=90=86?= Date: Wed, 15 Feb 2023 14:53:55 +0800 Subject: [PATCH 1/2] Fix --- .../src/main/scala/com/alibaba/graphar/writer/EdgeWriter.scala | 2 +- .../main/scala/com/alibaba/graphar/writer/VertexWriter.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spark/src/main/scala/com/alibaba/graphar/writer/EdgeWriter.scala b/spark/src/main/scala/com/alibaba/graphar/writer/EdgeWriter.scala index 45e83024c..5e00411ab 100644 --- a/spark/src/main/scala/com/alibaba/graphar/writer/EdgeWriter.scala +++ b/spark/src/main/scala/com/alibaba/graphar/writer/EdgeWriter.scala @@ -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) { diff --git a/spark/src/main/scala/com/alibaba/graphar/writer/VertexWriter.scala b/spark/src/main/scala/com/alibaba/graphar/writer/VertexWriter.scala index bb7e029e6..a5ae34165 100644 --- a/spark/src/main/scala/com/alibaba/graphar/writer/VertexWriter.scala +++ b/spark/src/main/scala/com/alibaba/graphar/writer/VertexWriter.scala @@ -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) From 8cea0b997fb7ae19fbfdfb60f207c7538ec60eee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=89=E7=90=86?= Date: Wed, 15 Feb 2023 15:39:32 +0800 Subject: [PATCH 2/2] Fix --- .../main/scala/com/alibaba/graphar/utils/IndexGenerator.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spark/src/main/scala/com/alibaba/graphar/utils/IndexGenerator.scala b/spark/src/main/scala/com/alibaba/graphar/utils/IndexGenerator.scala index 5d075b8ab..32c04c4d8 100644 --- a/spark/src/main/scala/com/alibaba/graphar/utils/IndexGenerator.scala +++ b/spark/src/main/scala/com/alibaba/graphar/utils/IndexGenerator.scala @@ -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) } @@ -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) }