期望输入“字符串”不匹配:列规范中的“名称”附近
Posted
技术标签:
【中文标题】期望输入“字符串”不匹配:列规范中的“名称”附近【英文标题】:Mismatched input 'STRING' expecting : near 'name' in column specification 【发布时间】:2014-06-17 02:22:33 【问题描述】:以下代码出现此错误:
FAILED: Parse Error: line 1:111 mismatched input 'STRING' expecting : near 'name' in column specification
CREATE TABLE country2
(name string,
states ARRAY<STRING>,
cities_and_size MAP<STRING, INT>,
parties STRUCT<name STRING, votes FLOAT, members INT>
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
COLLECTION ITEMS TERMINATED BY '\002'
MAP KEYS TERMINATED BY '\003'
LINES TERMINATED BY '\n'
STORED AS TextFile;
如果您有任何建议,请提供帮助。 谢谢
【问题讨论】:
【参考方案1】:对于 STRUCT 类型,字段和数据类型应该用冒号 (:) 分隔。
所以您的查询将如下所示:
CREATE TABLE country2
(name string,
states ARRAY<STRING>,
cities_and_size MAP<STRING, INT>,
parties STRUCT<name:STRING, votes:FLOAT, members:INT>
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
COLLECTION ITEMS TERMINATED BY '\002'
MAP KEYS TERMINATED BY '\003'
LINES TERMINATED BY '\n'
STORED AS TextFile;
希望这会有所帮助...!!!
【讨论】:
以上是关于期望输入“字符串”不匹配:列规范中的“名称”附近的主要内容,如果未能解决你的问题,请参考以下文章