Is it possible to import data into Hive table without copying the data

后端 未结 4 1089
花落未央
花落未央 2021-02-14 00:49

I have log files stored as text in HDFS. When I load the log files into a Hive table, all the files are copied.

Can I avoid having all my text data stored twice?

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-14 01:10

    You can use alter table partition statement to avoid data duplication.

    create External table if not exists TestTable (testcol string) PARTITIONED BY (year INT,month INT,day INT) row format delimited fields terminated by ',';
    
    ALTER table TestTable partition (year='2014',month='2',day='17') location 'hdfs://localhost:8020/data/2014/2/17/';
    

提交回复
热议问题