【问题标题】:Spark 3.0 scala.None$ is not a valid external type for schema of stringSpark 3.0 scala.None$ 不是字符串模式的有效外部类型
【发布时间】:2021-07-23 11:53:06
【问题描述】:

使用 elasticsearch-hadoop 库读取具有空属性的 elasticsearch 索引时,出现异常

Caused by: java.lang.RuntimeException: scala.None$ is not a valid external type for schema of string

在 github 中存在相同的开放缺陷,并提供了重现它的步骤:https://github.com/elastic/elasticsearch-hadoop/issues/1635

火花:3.1.1
Elasticsearch-Hadoop:elasticsearch-spark-30_2.12-7.12.0
弹性搜索:2.3.4

【问题讨论】:

    标签: scala apache-spark elasticsearch elasticsearch-hadoop


    【解决方案1】:

    它通过设置 elasticsearch-hadoop 属性 es.field.read.empty.as.null = no

    起作用
    .option("es.field.read.empty.as.null", "no")
    

    来自 Elasticsearch Link
    es.field.read.empty.as.null(默认是)
    elasticsearch-hadoop是否会将空字段视为null。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-29
      • 2022-08-16
      • 2018-03-01
      • 2020-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-25
      相关资源
      最近更新 更多