为什么 Athena JsonSerde 字段名称映射不起作用?

Why Athena JsonSerde field name mapping not working?

根据文档 here

使用此 Athena table 定义

CREATE EXTERNAL TABLE ctc.rets (
  `L_ListingID` string 
) 
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
WITH SERDEPROPERTIES (
  'mapping.systemID' = 'L_ListingID'  
) 
LOCATION 's3://dmh.bucket/retsdata/'
TBLPROPERTIES ('has_encrypted_data'='false');

我应该得到一个名为 systemID

的列

相反,我得到:

为什么忽略了列名映射?

您应该将 table 列名称指定为 systemID,然后映射将从 JSON 属性解析该列 L_ListingID:

CREATE EXTERNAL TABLE ctc.rets (
  `systemID` string 
) 
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
WITH SERDEPROPERTIES (
  'mapping.systemID' = 'L_ListingID'  
) 
LOCATION 's3://dmh.bucket/retsdata/'
TBLPROPERTIES ('has_encrypted_data'='false');