Skip to content

Commit

Permalink
support java 17 in UDF
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-bli committed Dec 12, 2023
1 parent 5456174 commit b0f3274
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,8 @@ class UDXRegistrationHandler(session: Session) extends Logging {
} else ""
val createUdfQuery = s"CREATE $tempType " +
s"FUNCTION $udfName($sqlFunctionArgs) RETURNS " +
s"$returnSqlType LANGUAGE JAVA $importSql HANDLER='$className.$methodName' " +
s"$returnSqlType LANGUAGE JAVA $getRuntimeVersion" +
s"$importSql HANDLER='$className.$methodName' " +
s"target_path='$targetJarStageLocation' " + packageSql +
"AS $$ \n" + code + "\n$$"
logDebug(s"""
Expand Down Expand Up @@ -1156,4 +1157,15 @@ class UDXRegistrationHandler(session: Session) extends Logging {
}
}
}

private def getRuntimeVersion: String = {
val version = Utils.JavaVersion
if (version.startsWith("17")) {
"runtime_version = '17'"
} else {
// for any other version of JVM, let's use the default jvm, which is java 11.
// it is current behavior.
""
}
}
}

0 comments on commit b0f3274

Please sign in to comment.