在使用脚本创建表时,是否需要遵循顺序?
hive (testdb)> create table test(id int,name string,age int)
> row format delimited
> lines terminated by '\n'
> fields terminated by ','
> stored as textfile;
FAILED: ParseException line 4:0 missing EOF at 'fields' near ''\n''
上面的查询导致并返回错误。看到同一个脚本只是我重新排序的行和字段。
hive (testdb)> create table test(id int,name string,age int)
> row format delimited
> fields terminated by ','
> lines terminated by '\n'
> stored as textfile;
OK
Time taken: 0.175 seconds '
你知道为什么第一个查询会导致这个问题吗?
1条答案
按热度按时间u3r8eeie1#
配置单元ddl在wiki上可用
秩序很重要。
FIELDS TERMINATED BY
在前面LINES TERMINATED BY
```row_format
: DELIMITED [FIELDS TERMINATED BY char [ESCAPED BY char]] [COLLECTION ITEMS TERMINATED BY char]
[MAP KEYS TERMINATED BY char] [LINES TERMINATED BY char]
[NULL DEFINED AS char] -- (Note: Available in Hive 0.13 and later)
| SERDE serde_name [WITH SERDEPROPERTIES (property_name=property_value, property_name=property_value, ...)]