【问题标题】:Error while compiling statement: FAILED: ParseException line 4:22 mismatched input ',' expecting < near 'array' in list type编译语句时出错:FAILED: ParseException line 4:22 mismatched input ',' expecting < near 'array' in list type
【发布时间】:2015-07-14 03:19:08
【问题描述】:

我正在尝试使用 Hadoop Hive Query 创建以下内容:

create table tweets (
created_at string,
entities struct <
hashtags: array ,
text: string>>,
media: array ,
media_url: string,
media_url_https: string,
sizes: array >,
url: string>>,
urls: array ,
url: string>>,
user_mentions: array ,
name: string,
screen_name: string>>>,
geo struct <
coordinates: array ,
type: string>,
id bigint,
id_str string,
in_reply_to_screen_name string,
in_reply_to_status_id bigint,
in_reply_to_status_id_str string,
in_reply_to_user_id int,
in_reply_to_user_id_str string,
retweeted_status struct <
created_at: string,
entities: struct <
hashtags: array ,
text: string>>,
media: array ,
media_url: string,
media_url_https: string,
sizes: array >,
url: string>>,
urls: array ,
url: string>>,
user_mentions: array ,
name: string,
screen_name: string>>>,
geo: struct <
coordinates: array ,
type: string>,
id: bigint,
id_str: string,
in_reply_to_screen_name: string,
in_reply_to_status_id: bigint,
in_reply_to_status_id_str: string,
in_reply_to_user_id: int,
in_reply_to_user_id_str: string,
source: string,
text: string,
user: struct <
id: int,
id_str: string,
name: string,
profile_image_url_https: string,
protected: boolean,
screen_name: string,
verified: boolean>>,
source string,
text string,
user struct <
id: int,
id_str: binary,
name: string,
profile_image_url_https: string,
protected: boolean,
screen_name: string,
verified: boolean>
)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
STORED AS TEXTFILE;

我收到的错误是:

编译语句时出错:FAILED: ParseException line 4:22 mismatched input ',' expecting

任何帮助将不胜感激。

【问题讨论】:

  • 第五行有多余的 '>' 符号

标签: hadoop hive


【解决方案1】:

来自https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-CreateTableAsSelect(CTAS)

当你使用时

array_type
  : ARRAY < data_type >

where data_type
  : primitive_type
  | array_type
  | map_type
  | struct_type
  | union_type 

【讨论】:

    猜你喜欢
    • 2017-11-12
    • 2019-12-07
    • 1970-01-01
    • 2018-06-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-02
    相关资源
    最近更新 更多