hivesql-create表

tkclm6bt  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(422)

在使用脚本创建表时,是否需要遵循顺序?

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 '

你知道为什么第一个查询会导致这个问题吗?

u3r8eeie

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, ...)]

默认情况下,存储为文本的表已经使用换行符

相关问题