Hive创建表脚本-AWS Data Pipeline

问题描述

我正在尝试更改在线找到的数据管道脚本-https://github.com/amazon-archives/data-pipeline-samples/blob/master/samples/dynamo-db-export-as-csv/ddb-to-csv.json

该脚本将从我的dynamodb表中获取所有数据,并将其作为csv插入S3。

一个配置单元脚本可以为我重新映射列,但我以前从未使用过配置单元,并且对如何使用它没有很好的了解。

下面是有问题的蜂巢脚本

drop table if exists raw_data;

CREATE EXTERNAL TABLE raw_data(`device_uuid` string,`ts` int,`device_vendor_id` string,`drone_id` string,`RSSi` int,`venue_id` string)
ROW FORMAT SERDE 'org.apache.hadoop.hive.dynamodb.DynamoDBExportSerDe'
LOCATION \"#{input.directoryPath}/#{format(@scheduledStartTime,'YYYY-MM-dd_hh.mm')}\"
TBLPROPERTIES (\"dynamodb.column.mapping\"=\"device_uuid:device_uuid,ts:ts,device_vendor_id:device_vendor_id,drone_id:drone_id,RSSi:RSSi,venue_id:venue_id\");

drop table if exists csv_data;\ncreate table csv_data (`device_uuid` string,`ts` number,`RSSi` number,`venue_id` string)
row format delimited\nfields terminated by ',' lines terminated by '\\n'\nlocation '#{output.directoryPath}/';

insert overwrite table csv_data select * from raw_data;

运行此脚本时,出现以下错误Error,return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. java.lang.RuntimeException: MetaException(message:org.apache.hadoop.hive.serde2.SerDeException Unsupported type: int)

阅读配置单元文档后,我认为int是有效的类型,但看来我一定读错了东西。

我不确定是否需要在任何地方使用类型number,因为这是动态类型,因此我决定将所有int类型替换为number,但出现错误cannot recognize input near 'number' ',' 'device_vendor_id' in column type

上说些什么

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)