0

在 aws-emr 执行我的 Spark 作业时,尝试从 s3 存储桶读取 avro 文件时出现此错误:它发生在版本中:

  • 电子病历 - 5.5.0
  • 电子病历 - 5.9.0

这是代码:

val files  = 0 until numOfDaysToFetch map { i =>
  s"s3n://bravos/clicks/${fromDate.minusDays(i)}/*"
}
spark.read.format("com.databricks.spark.avro").load(files: _*)

例外:

java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: 1037330823653531755-2017-10-16T03:06:00.avro
    at org.apache.hadoop.fs.Path.initialize(Path.java:205)
    at org.apache.hadoop.fs.Path.<init>(Path.java:171)
    at org.apache.hadoop.fs.Path.<init>(Path.java:93)
    at org.apache.hadoop.fs.Globber.glob(Globber.java:241)
    at org.apache.hadoop.fs.FileSystem.globStatus(FileSystem.java:1732)
    at org.apache.hadoop.fs.FileSystem.globStatus(FileSystem.java:1713)
    at com.amazon.ws.emr.hadoop.fs.EmrFileSystem.globStatus(EmrFileSystem.java:362)
    at org.apache.spark.deploy.SparkHadoopUtil.globPath(SparkHadoopUtil.scala:237)
    at org.apache.spark.deploy.SparkHadoopUtil.globPathIfNecessary(SparkHadoopUtil.scala:243)
    at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$14.apply(DataSource.scala:374)
    at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$14.apply(DataSource.scala:370)
    at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
    at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
    at scala.collection.immutable.List.foreach(List.scala:381)
    at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:241)
    at scala.collection.immutable.List.flatMap(List.scala:344)
    at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:370)
    at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:152)

`

4

2 回答 2

0

我从 /* 中删除了最后一个 * 并且它正常工作

于 2017-10-17T15:22:38.163 回答
0

Path不支持冒号。它将 1037330823653531755-2017-10-16T03: 解释为 URI 模式,然后对任何填充的“/”不满意..即使它走到了那一步,它也会在“没有模式的文件系统”1037330823653531755-2017-10-16T03 上失败"

修复:不要在文件名中使用“:”。

于 2017-10-17T10:05:38.633 回答