Purview ADB Lineage部署中NoSuchElementException异常排查与修复
Purview ADB Lineage Solution Accelerator示例运行异常问题修复
问题场景
正在部署微软Azure团队开发的Purview ADB Lineage Solution Accelerator,已按部署指南完成Azure侧部署,但运行示例Scala文件abfss-in-abfss-out-olsample时,执行代码抛出如下异常:
NoSuchElementException: spark.openlineage.samplestorageaccount
涉事Scala代码
import org.apache.spark.sql.types.{StructType, StructField, IntegerType, StringType} val storageServiceName = spark.conf.get("spark.openlineage.samplestorageaccount") val storageContainerName = spark.conf.get("spark.openlineage.samplestoragecontainer") val adlsRootPath = "wasbs://"+storageContainerName+"@"+storageServiceName+".blob.core.windows.net" val storageKey = dbutils.secrets.get("purview-to-adb-kv", "storageAccessKey") spark.conf.set("fs.azure.account.key."+storageServiceName+".blob.core.windows.net", storageKey)
当前已配置的Spark集群参数
spark.openlineage.host https://functionapppv2dtbr8s6k.azurewebsites.net spark.openlineage.url.param.code bmHFCiNI86nfgqwfkX86Lj5veclRds9Zb1NIJ48uRgNXAzFuQEueiQ== spark.openlineage.namespace https://adb-1900514794152199.12#0160-060038-516wad48 spark.databricks.delta.preview.enabled true spark.openlineage.version v1
异常成因
代码中通过spark.conf.get()尝试读取spark.openlineage.samplestorageaccount和spark.openlineage.samplestoragecontainer两个Spark配置项,但当前集群的Spark配置里未添加这两个参数,Spark找不到对应配置项时就会抛出NoSuchElementException。
修复步骤
- 打开Databricks集群配置页面,进入Advanced Options下的Spark configuration部分
- 添加以下两个配置项,将占位符替换为你实际使用的存储账户名称和容器名称:
spark.openlineage.samplestorageaccount 你的存储账户名 spark.openlineage.samplestoragecontainer 你的存储容器名 - 重启Databricks集群,确保新配置生效
- 重新运行示例Scala代码
额外提示
代码中使用的wasbs://协议适用于Azure Blob存储,如果你实际使用的是ADLS Gen2存储,建议将路径协议替换为abfss://,确保与存储类型匹配。
内容的提问来源于stack exchange,提问作者saf-itpro
相关产品推荐
相关产品推荐

