Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add spark version validation #69

Merged
merged 2 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
}
}