Skip to content

Commit 8cc4ad8

Browse files
committed
getUnityCatalogSparkArtifact
Signed-off-by: Yi Li <yi.li@databricks.com>
1 parent 44685d3 commit 8cc4ad8

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

examples/scala/build.sbt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,18 @@ def resolveSparkVersion(deltaVersion: String): String = {
162162
else lookupSparkVersion.apply(getMajorMinor(deltaVersion))
163163
}
164164

165+
// The OSS Unity Catalog project publishes one Spark connector artifact per Spark major.minor
166+
// (e.g. unitycatalog-spark_4.1_2.13) and, unlike delta-spark, has no unsuffixed backward-compat
167+
// variant. So its suffix must track the resolved Spark version -- matching what
168+
// setup_unitycatalog_main.sh publishes -- rather than `getSparkPackageSuffix`, which is empty for
169+
// the default Spark version (since `delta-spark_2.13` resolves unsuffixed).
170+
val getUnityCatalogSparkArtifact = settingKey[String](
171+
"Unity Catalog Spark connector artifact base name, suffixed with the resolved Spark major.minor.")
172+
getUnityCatalogSparkArtifact := {
173+
val (sparkMajor, sparkMinor) = getMajorMinor(resolveSparkVersion(getDeltaVersion.value))
174+
s"unitycatalog-spark_${sparkMajor}.${sparkMinor}"
175+
}
176+
165177
def getLibraryDependencies(
166178
deltaVersion: String,
167179
deltaArtifactName: String,
@@ -216,7 +228,7 @@ lazy val root = (project in file("."))
216228
scalaBinaryVersion.value,
217229
getSupportIceberg.value),
218230
libraryDependencies ++= Seq(
219-
"io.unitycatalog" %% s"unitycatalog-spark${getSparkPackageSuffix.value}" % unityCatalogVersion excludeAll(
231+
"io.unitycatalog" %% getUnityCatalogSparkArtifact.value % unityCatalogVersion excludeAll(
220232
ExclusionRule(organization = "com.fasterxml.jackson.core"),
221233
ExclusionRule(organization = "com.fasterxml.jackson.module"),
222234
ExclusionRule(organization = "com.fasterxml.jackson.datatype"),

0 commit comments

Comments
 (0)