Databricks Connect:DependencyCheckWarning:远程集群上可能不存在 java class

Databricks Connect: DependencyCheckWarning: The java class may not be present on the remote cluster

我正在对 Databricks 上的远程 Spark 集群执行另一次本地 Scala 代码并得到了这个。

Exception in thread "main" com.databricks.service.DependencyCheckWarning: The java class <something> may not be present on the remote cluster. It can be found in <something>/target/scala-2.11/classes. To resolve this, package the classes in <something>/target/scala-2.11/classes into a jar file and then call sc.addJar() on the package jar. You can disable this check by setting the SQL conf spark.databricks.service.client.checkDeps=false.

我已经尝试重新导入、清理和重新编译 sbt 项目,但都无济于事。

有人知道怎么处理吗?

显然文档中有 covered:

spark.sparkContext.addJar("./target/scala-2.11/hello-world_2.11-1.0.jar")

我想将您作为 Spark 外部代码编写的所有内容都视为依赖项是有道理的。所以一个简单的 sbt publishLocal 然后在上面的命令中指向 jar 路径将解决你的问题。

我的主要困惑来自于我不需要在很长一段时间内执行此操作,直到某个时候该机制将其踢掉。我会说相当不一致的行为。


使用此设置后的个人观察是,您似乎只需要一次发布一个 jar。我一直在多次更改我的代码,即使我没有为我所做的新更改连续发布 jar,更改也会反映出来。这使得整个任务一次性完成。虽然仍然令人困惑。