diff --git a/README.md b/README.md index a9f8795..bbedb9c 100644 --- a/README.md +++ b/README.md @@ -111,19 +111,23 @@ If you want to write the algorithm execution result into NebulaGraph(`sink: nebu | bfs | dfs | string | | jaccard | jaccard | string | | node2vec | node2vec | string | - + + + + ## Version Compatibility Matrix -| Nebula Algorithm Version | Nebula Version | -|:------------------------:|:--------------:| -| 2.0.0 | 2.0.0, 2.0.1 | -| 2.1.0 | 2.0.0, 2.0.1 | -| 2.5.0 | 2.5.0, 2.5.1 | -| 2.6.0 | 2.6.0, 2.6.1 | -| 2.6.1 | 2.6.0, 2.6.1 | -| 2.6.2 | 2.6.0, 2.6.1 | -| 3.0.0 | 3.0.x, 3.1.x, 3.2.x, 3.3.x | -| 3.0-SNAPSHOT | nightly | +| NebulaGraph Algorithm Version | NebulaGraph Version | Spark Version | +| :---------------------------: | :------------------------: | ------------- | +| 2.0.0 | 2.0.0, 2.0.1 | 2.4 | +| 2.1.0 | 2.0.0, 2.0.1 | 2.4 | +| 2.5.0 | 2.5.0, 2.5.1 | 2.4 | +| 2.6.0 | 2.6.0, 2.6.1 | 2.4 | +| 2.6.1 | 2.6.0, 2.6.1 | 2.4 | +| 2.6.2 | 2.6.0, 2.6.1 | 2.4 | +| 3.0.0, 3.1.x | 3.0.x, 3.1.x, 3.2.x, 3.3.x | 2.4 | +| 3.0-SNAPSHOT | nightly | 2.4 | + ## Contribute diff --git a/nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/config/SparkConfig.scala b/nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/config/SparkConfig.scala index 4e1383e..8a9d60d 100644 --- a/nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/config/SparkConfig.scala +++ b/nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/config/SparkConfig.scala @@ -25,6 +25,17 @@ object SparkConfig { session.config(key, sparkConfigs(key)) } partitionNum = sparkConfigs.getOrElse("spark.app.partitionNum", "0") - SparkConfig(session.getOrCreate(), partitionNum) + val spark = session.getOrCreate() + validate(spark.version, "2.4.*") + SparkConfig(spark, partitionNum) + } + + def validate(sparkVersion: String, supportedVersions: String*): Unit = { + if (sparkVersion != "UNKNOWN" && !supportedVersions.exists(sparkVersion.matches)) { + throw new RuntimeException( + s"""Your current spark version ${sparkVersion} is not supported by the current NebulaGraph Algorithm. + | please visit https://github.com/vesoft-inc/nebula-algorithm#version-compatibility-matrix to know which version you need. + | """.stripMargin) + } } }