hive - Amazon Athena 在 geo json 上返回 `HIVE_CURSOR_ERROR: HIVE_CURSOR_ERROR`

标签 hive amazon-athena

我正在尝试使用 Amazon Athena 读取 geojson 文件。

我的输入数据的头部是这样的:

{
"type": "FeatureCollection",
"name": "sql_statement",
"features": [
{ "type": "Feature", "properties": { "gridsize": 500.0, "big_gid": 353, "little_gid": 22482 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -981739.267883020918816, 30855.609566356935829 ], [ -981739.267883020918816, 31355.354737498135364 ], [ -981241.022986860014498, 31355.354737498135364 ], [ -981241.022986860014498, 30855.609566356935829 ], [ -981739.267883020918816, 30855.609566356935829 ] ] ] } },
{ "type": "Feature", "properties": { "gridsize": 500.0, "big_gid": 353, "little_gid": 22483 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -981241.022986860014498, 30855.609566356935829 ], [ -981241.022986860014498, 31355.354737498135364 ], [ -980742.778090699226595, 31355.354737498135364 ], [ -980742.778090699226595, 30855.609566356935829 ], [ -981241.022986860014498, 30855.609566356935829 ] ] ] } },
{ "type": "Feature", "properties": { "gridsize": 500.0, "big_gid": 353, "little_gid": 22484 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -980742.778090699226595, 30855.609566356935829 ], [ -980742.778090699226595, 31355.354737498135364 ], [ -980244.533194538322277, 31355.354737498135364 ], [ -980244.533194538322277, 30855.609566356935829 ], [ -980742.778090699226595, 30855.609566356935829 ] ] ] } },
{ "type": "Feature", "properties": { "gridsize": 500.0, "big_gid": 353, "little_gid": 22485 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -980244.533194538322277, 30855.609566356935829 ], [ -980244.533194538322277, 31355.354737498135364 ], [ -979746.288298377417959, 31355.354737498135364 ], [ -979746.288298377417959, 30855.609566356935829 ], [ -980244.533194538322277, 30855.609566356935829 ] ] ] } },
{ "type": "Feature", "properties": { "gridsize": 500.0, "big_gid": 353, "little_gid": 22486 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -979746.288298377417959, 30855.609566356935829 ], [ -979746.288298377417959, 31355.354737498135364 ], [ -979248.043402216513641, 31355.354737498135364 ], [ -979248.043402216513641, 30855.609566356935829 ], [ -979746.288298377417959, 30855.609566356935829 ] ] ] } },
{ "type": "Feature", "properties": { "gridsize": 500.0, "big_gid": 353, "little_gid": 22487 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -979248.043402216513641, 30855.609566356935829 ], [ -979248.043402216513641, 31355.354737498135364 ], [ -978749.798506055609323, 31355.354737498135364 ], [ -978749.798506055609323, 30855.609566356935829 ], [ -979248.043402216513641, 30855.609566356935829 ] ] ] } },

我使用 geospatial documentation 定义了表格作为模板:

CREATE external TABLE IF NOT EXISTS testdb.grid_500
 (
 gridsize double,
 big_gid int, 
 little_gid int, 
 geometry binary
 )
ROW FORMAT SERDE 'com.esri.hadoop.hive.serde.JsonSerde'
STORED AS INPUTFORMAT 'com.esri.json.hadoop.EnclosedJsonInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION 's3://jdl-athena/grid/'
;

但是,我针对该表运行的任何查询都会返回相同但毫无帮助的错误:

Your query has the following error(s):

HIVE_CURSOR_ERROR: HIVE_CURSOR_ERROR

This query ran against the "testdb" database, unless qualified by the query.
Please post the error message on our forum or contact customer support with 
Query Id: 25d3da93-5cfd-46bb-9f77-4eb014679ba6.

我可能会收到此错误的原因或我可能如何调试它有什么想法吗?我什至不知道如何获得足够的信息来诊断可能发生的事情。

最佳答案

在谷歌之后,我发现(当然)ESRI 已经为地理数据创建了自己的 JSON 格式。我使用的是开放标准 GeoJson,ESRI 格式称为 ESRI Enclosed JSON .对于几何 JSON,Athena 仅支持 ESRI 格式,不支持 GEOJSON。

我在这里发现了这个区别: https://github.com/Esri/gis-tools-for-hadoop/issues/29

看来我需要不同格式的输入数据。

关于hive - Amazon Athena 在 geo json 上返回 `HIVE_CURSOR_ERROR: HIVE_CURSOR_ERROR`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53923848/

相关文章:

java - 日期递增的 Hive UDF

amazon-s3 - 如何在不耗尽资源的情况下使用 Amazon Athena 执行查询?

amazon-web-services - Athena 在 S3 上查询数据的替代方案

amazon-s3 - AWS Glue 爬网程序 - 分区键类型

apache-spark - Spark-Hudi : Save as table to Glue/Hive catalog

sql - 如何在 Hive 查询中回顾 7 天

hadoop - FALSE或NULL在Hive中不起作用

hadoop - 底层目录更改时Hive表能否自动更新

amazon-athena - AWS Athena map 查询

datetime - 将 Unix 纪元时间转换为扩展的 ISO8601