在 Hive 中将列格式从字符串更新为日期
Update the column format from string to date in Hive
我在 Hive 中有一个外部 table
Current:
col1 - string
col2 - string
col3 - string
col4 - float
col5 - int
我想把col3的日期类型改成date
Expected:
col1 - string
col2 - string
col3 - date
col4 - float
col5 - int
我尝试了常规 sql 命令但没有用
alter table table_name modify col3 date;
Error:
Error while compiling statement: FAILED: ParseException line 1:32 cannot recognize input near 'modify' 'col3' 'date' in alter table statement
在此请求帮助。提前致谢。
正确的命令是:
alter table table_name change col3 col3 date;
The column change command will only modify Hive's metadata, and will
not modify data. Users should make sure the actual data layout of the
table/partition conforms with the metadata definition.
在此处查看语法和手册:Change Column Name/Type/Position/Comment
我在 Hive 中有一个外部 table
Current:
col1 - string
col2 - string
col3 - string
col4 - float
col5 - int
我想把col3的日期类型改成date
Expected:
col1 - string
col2 - string
col3 - date
col4 - float
col5 - int
我尝试了常规 sql 命令但没有用
alter table table_name modify col3 date;
Error:
Error while compiling statement: FAILED: ParseException line 1:32 cannot recognize input near 'modify' 'col3' 'date' in alter table statement
在此请求帮助。提前致谢。
正确的命令是:
alter table table_name change col3 col3 date;
The column change command will only modify Hive's metadata, and will not modify data. Users should make sure the actual data layout of the table/partition conforms with the metadata definition.
在此处查看语法和手册:Change Column Name/Type/Position/Comment