我是hadoop的新手。在创建新表时,我需要有关Hive中遇到的错误的帮助。我已经完成了这个Hive FAILED: ParseException line 2:0 cannot recognize input near ''macaddress'' 'CHAR' '(' in column specification
我的问题:是否有必要在脚本中写一个表的位置?因为我在开始时写表位置而且我害怕编写位置,因为它不应该通过任何多功能操作来干扰我的其余数据库。
这是我的问题:
CREATE TABLE meta_statistics.tank_items (
shop_offers_history_before bigint,
shop_offers_temp bigint,
videos_distinct_temp bigint,
deleted_temp bigint,
t_stamp timestamp )
CLUSTERED BY (
tank_items_id)
INTO 8 BUCKETS
ROW FORMAT SERDE
TBLPROPERTIES (transactional=true)
STORED AS ORC;
我得到的错误是 -
ParseException第1:3行无法识别'TBLPROPERTIES'附近的输入 '(''transactional'
错误的其他可能性是什么?如何删除错误?
答案 0 :(得分:0)
1)ROW FORMAT SERDE
- >你应该通过一些serde
2)TBLPROPERTIES
键值应为双引号
3)如果您给出CLUSTERED BY
值,则应该在给定的列
替换如下
CREATE TABLE meta_statistics.tank_items ( shop_offers_history_before bigint, shop_offers_temp bigint, videos_distinct_temp bigint, deleted_temp bigint, t_stamp timestamp ) CLUSTERED BY (shop_offers_history_before) INTO 8 BUCKETS ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde' STORED AS ORC TBLPROPERTIES ("transactional"="true");
希望这会有所帮助
答案 1 :(得分:0)
您的创建查询中存在语法错误。您共享的错误表示配置单元无法识别'TBLPROPERTIES'
附近的输入。
<强>解决方案:强>
根据hive语法,TBLPROPERTIES
中传递的键值应为双引号。它应该是这样的:TBLPROPERTIES ("transactional"="true")
因此,如果我更正您的查询,它将是:
CREATE TABLE meta_statistics.tank_items (
shop_offers_history_before bigint,
shop_offers_temp bigint,
videos_distinct_temp bigint,
deleted_temp bigint,
t_stamp timestamp
) CLUSTERED BY (tank_items_id) INTO 8 BUCKETS
ROW FORMAT SERDE TBLPROPERTIES ("transactional"="true") STORED AS ORC;
执行上面的查询,然后如果你得到任何其他语法错误,请确保STORED AS , CLUSTERED BY , TBLPROPERTIES
的顺序符合hive语法。
有关详细信息,请参阅此处: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-CreateTable