scala - Spark 3.0 scala.None$ 不是字符串模式的有效外部类型
问题描述
在使用 elasticsearch-hadoop 库读取具有空属性的弹性搜索索引时,出现异常
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
Spark:3.1.1
Elasticsearch-Hadoop:elasticsearch-spark-30_2.12-7.12.0
Elasticsearch:2.3.4
解决方案
它通过设置 elasticsearch-hadoop 属性es.field.read.empty.as.null = no
.option("es.field.read.empty.as.null", "no")
来自 Elasticsearch链接:
es.field.read.empty.as.null(默认是)elasticsearch
-hadoop 是否会将空字段视为 null。
推荐阅读
- wpf - 调整大小时 BitmapCache 性能不佳
- java - 如何在java中将投影EPSG:3857转换为EPSG:4326(地理空间)
- uitableview - 使用 RxSwift 在 UITableView 中进行 2 路绑定
- go - 为什么从数据库中删除一些数据后它没有插入到同一个表中
- node.js - Firebase Cloud Function:在“catch”中结束 HTTP 函数
- regex - 如何在scala中使用正则表达式模式匹配替换部分字符串?
- java - java - 如何使用Object参数而不是java中的实际参数类型调用方法?
- react-native - 反应本机文本输入滚动问题
- javascript - 按钮在 Firefox 中不起作用,但在 Chrome 中起作用
- azure - portal.azure.com 仪表板上 VM 诊断指标的数字似乎不正确