Hive. Does ALTER TABLE tablename CHANGE name1 name2 newdatatype; Remove the underline data for name1?

huangapple go评论67阅读模式
英文:

Hive. Does ALTER TABLE tablename CHANGE name1 name2 newdatatype; Remove the underline data for name1?

问题

这可能与一些在线教程中的解释不同。我在运行ALTER TABLE tablename CHANGE name1 name2 newdatatype;之后找到的。下划线数据被删除了吗?有人可以帮助理解这个命令是否会删除数据,而不仅仅是重命名列吗?

英文:

This may differ from the explanation for some online tutorial. That I found after I run ALTER TABLE tablename CHANGE name1 name2 newdatatype; The underline data is removed? Can someone help understand if this command will wipe out the data rather than just rename the column?

答案1

得分: 1

根据文档:
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-RulesforColumnNames

列更改命令只会修改Hive的元数据,不会修改数据。用户应确保表/分区的实际数据布局与元数据定义相符。

我认为修改列名或数据类型不会移除数据,可能有其他进程正在清除数据,或者可能有其他并行用户。

英文:

As per the documentation :
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-RulesforColumnNames

> 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.

I don't think altering the column name or datatype would have removed the data, there might be some other process which is wiping the data or may be some parallel user.

huangapple
  • 本文由 发表于 2020年1月3日 14:49:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/59574319.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定