这个问题在这里已经有答案了:
如何从hdfs将数据加载到配置单元而不删除源文件(3个答案)三年前关门了。有人能解释一下如何在不删除源文件的情况下将数据从hdfs加载到hive外部表吗。如果我使用
LOAD DATA INPATH '/user/root/cards/deckofcards.txt' INTO TABLE deck_of_cards;
是文件用户 /user/root/cards 会被删除吗?
/user/root/cards
neekobn81#
为了将数据加载到配置单元表中,我们可以使用当文件已经存在于hdfs中时,使用外部表,即使删除了表,文件也应该保留。示例:-
create external table table_name ( id int, field_name string ) row format delimited fields terminated by <any delimiter>location '/hdfs_location';
create external table table_name (
id int,
field_name string
)
row format delimited
fields terminated by <any delimiter>
location '/hdfs_location';
当配置单元应该管理表的生命周期或生成临时表时,请使用托管表。示例:-
create table table_name ( id int, field_name string ) row format delimited fields terminated by <any delimiter>location '/hdfs_location';
create table table_name (
要了解什么样的table: describe formatted table_name
describe formatted table_name
1条答案
按热度按时间neekobn81#
为了将数据加载到配置单元表中,我们可以使用
当文件已经存在于hdfs中时,使用外部表,即使删除了表,文件也应该保留。
示例:-
当配置单元应该管理表的生命周期或生成临时表时,请使用托管表。
示例:-
要了解什么样的table:
describe formatted table_name