Skip to content

Commit 9cc291b

Browse files
[Feat][Spark] Update snakeyaml to 2.x.x version (#312)
* Update snakeyaml to 2.x.x version On branch 311-update-snakeyaml Changes to be committed: modified: spark/pom.xml modified: spark/src/main/scala/com/alibaba/graphar/EdgeInfo.scala modified: spark/src/main/scala/com/alibaba/graphar/GraphInfo.scala modified: spark/src/main/scala/com/alibaba/graphar/VertexInfo.scala * Fix code style On branch 311-update-snakeyaml Changes to be committed: modified: spark/src/main/scala/com/alibaba/graphar/GraphInfo.scala modified: spark/src/main/scala/com/alibaba/graphar/VertexInfo.scala
1 parent 730004f commit 9cc291b

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

spark/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
<dependency>
8383
<groupId>org.yaml</groupId>
8484
<artifactId>snakeyaml</artifactId>
85-
<version>1.26</version>
85+
<version>2.0</version>
8686
</dependency>
8787
<dependency>
8888
<groupId>com.aliyun.odps</groupId>

spark/src/main/scala/com/alibaba/graphar/EdgeInfo.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import org.apache.spark.sql.{SparkSession}
2121
import org.yaml.snakeyaml.{Yaml, DumperOptions}
2222
import org.yaml.snakeyaml.constructor.Constructor
2323
import scala.beans.BeanProperty
24+
import org.yaml.snakeyaml.LoaderOptions
2425

2526
/** Edge info is a class to store the edge meta information. */
2627
class EdgeInfo() {
@@ -670,7 +671,7 @@ object EdgeInfo {
670671
val path = new Path(edgeInfoPath)
671672
val fs = path.getFileSystem(spark.sparkContext.hadoopConfiguration)
672673
val input = fs.open(path)
673-
val yaml = new Yaml(new Constructor(classOf[EdgeInfo]))
674+
val yaml = new Yaml(new Constructor(classOf[EdgeInfo], new LoaderOptions()))
674675
return yaml.load(input).asInstanceOf[EdgeInfo]
675676
}
676677
}

spark/src/main/scala/com/alibaba/graphar/GraphInfo.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import org.apache.spark.sql.{SparkSession}
2121
import org.yaml.snakeyaml.{Yaml, DumperOptions}
2222
import org.yaml.snakeyaml.constructor.Constructor
2323
import scala.beans.BeanProperty
24+
import org.yaml.snakeyaml.LoaderOptions
2425

2526
/** Main data type in gar enumeration */
2627
object GarType extends Enumeration {
@@ -366,7 +367,9 @@ object GraphInfo {
366367
val path = new Path(graphInfoPath)
367368
val fs = path.getFileSystem(spark.sparkContext.hadoopConfiguration)
368369
val input = fs.open(path)
369-
val yaml = new Yaml(new Constructor(classOf[GraphInfo]))
370+
val yaml = new Yaml(
371+
new Constructor(classOf[GraphInfo], new LoaderOptions())
372+
)
370373
val graph_info = yaml.load(input).asInstanceOf[GraphInfo]
371374
if (graph_info.getPrefix == "") {
372375
val pos = graphInfoPath.lastIndexOf('/')

spark/src/main/scala/com/alibaba/graphar/VertexInfo.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import org.apache.spark.sql.{SparkSession}
2121
import org.yaml.snakeyaml.{Yaml, DumperOptions}
2222
import org.yaml.snakeyaml.constructor.Constructor
2323
import scala.beans.BeanProperty
24+
import org.yaml.snakeyaml.LoaderOptions
2425

2526
/** VertexInfo is a class to store the vertex meta information. */
2627
class VertexInfo() {
@@ -288,7 +289,9 @@ object VertexInfo {
288289
val path = new Path(vertexInfoPath)
289290
val fs = path.getFileSystem(spark.sparkContext.hadoopConfiguration)
290291
val input = fs.open(path)
291-
val yaml = new Yaml(new Constructor(classOf[VertexInfo]))
292+
val yaml = new Yaml(
293+
new Constructor(classOf[VertexInfo], new LoaderOptions())
294+
)
292295
return yaml.load(input).asInstanceOf[VertexInfo]
293296
}
294297
}

0 commit comments

Comments
 (0)