Skip to content

Commit

Permalink
add spark version validation (#69)
Browse files Browse the repository at this point in the history
* add spark version validation

* Add spark version info in Compatibility Matrix

---------

Co-authored-by: Wey Gu <[email protected]>
  • Loading branch information
Nicole00 and wey-gu authored Mar 1, 2023
1 parent 21564be commit 7b59ef5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |



<!--- We cannot change name of this chapter, or the version checker code will be broken --->

## 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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}

0 comments on commit 7b59ef5

Please sign in to comment.