在文档中有包含以下文本的spark.files:
Comma-separated list of files to be placed in the working directory of each executor. Globs are allowed.它是否与spark-submit中的--files相同?
我试着在#中使用--conf spark.files来重命名,但似乎不起作用。
会有人知道吗?
发布于 2019-04-20 03:44:41
您应该尝试使用spark.yarn.dist.files属性
val spark = SparkSession
.builder()
.enableHiveSupport()
.getOrCreate()SparkContext是在实例化spark对象时创建的。在SparkContext实例化期间,如果将spark.files属性配置为将要下载的文件添加到所有executor节点,则会调用addFile方法。
def addFile(path: String, recursive: Boolean): Unit = {
val uri = new Path(path).toUri
val schemeCorrectedPath = uri.getScheme match {
case null | "local" => new File(path).getCanonicalFile.toURI.toString
case _ => path
}
val hadoopPath = new Path(schemeCorrectedPath)
....
}例如,如果路径值localfile.txt#renamed.txt,被转换为localfile.txt%23renamed.txt,,则hadoopPath将"#“之后的部分视为文件路径的一部分,而不是片段。所以它抛出了FileNotFoundException。
通过--files, spark.yarn.dist.files的deploy函数将Client.scala中指定的文件复制到executors节点中,其中碎片得到了正确处理。
https://stackoverflow.com/questions/55764743
复制相似问题