Skip to content

Commit

Permalink
add spark version validate for spark3
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicole00 committed Feb 24, 2023
1 parent 18ecfdc commit b6c89b0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package com.vesoft.nebula.connector

import com.vesoft.nebula.connector.ssl.SSLSignType
import com.vesoft.nebula.connector.utils.SparkValidate
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.{
DataFrame,
Expand All @@ -30,6 +31,7 @@ package object connector {

def nebula(connectionConfig: NebulaConnectionConfig,
readConfig: ReadNebulaConfig): NebulaDataFrameReader = {
SparkValidate.validate("3.0.*", "3.1.*", "3.2.*", "3.3.*")
this.connectionConfig = connectionConfig
this.readConfig = readConfig
this
Expand Down Expand Up @@ -179,6 +181,7 @@ package object connector {
*/
def nebula(connectionConfig: NebulaConnectionConfig,
writeNebulaConfig: WriteNebulaConfig): NebulaDataFrameWriter = {
SparkValidate.validate("3.0.*", "3.1.*", "3.2.*", "3.3.*")
this.connectionConfig = connectionConfig
this.writeNebulaConfig = writeNebulaConfig
this
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* Copyright (c) 2022 vesoft inc. All rights reserved.
*
* This source code is licensed under Apache 2.0 License.
*/

package com.vesoft.nebula.connector

import com.vesoft.nebula.connector.utils.SparkValidate
import org.apache.spark.sql.SparkSession
import org.scalatest.funsuite.AnyFunSuite

class SparkVersionValidateSuite extends AnyFunSuite {
test("spark version validate") {
try {
val version = SparkSession.getActiveSession.map(_.version).getOrElse("UNKNOWN")
SparkValidate.validate("3.0.*", "3.1.*", "3.2.*", "3.3.*")
} catch {
case e: Exception => assert(false)
}
}
}

0 comments on commit b6c89b0

Please sign in to comment.