MAPREDUCE服务 MRS-加载数据到Hive表中:样例代码

时间:2024-06-13 09:38:22

样例代码

-- 从本地文件系统/opt/hive_examples_data/目录下将employee_info.txt加载进employees_info表中.
---- 用新数据覆盖原有数据 
LOAD DATA LOCAL INPATH '/opt/hive_examples_data/employee_info.txt' OVERWRITE INTO TABLE employees_info; 
---- 保留原有数据,将新数据追加到表中
LOAD DATA LOCAL INPATH '/opt/hive_examples_data/employee_info.txt' INTO TABLE employees_info;
 
-- 从HDFS上/user/hive_examples_data/employee_info.txt加载进employees_info表中. 
---- 用新数据覆盖原有数据
LOAD DATA INPATH '/user/hive_examples_data/employee_info.txt' OVERWRITE INTO TABLE employees_info; 
---- 保留原有数据,将新数据追加到表中
LOAD DATA INPATH '/user/hive_examples_data/employee_info.txt' INTO TABLE employees_info;   

加载数据的实质是将数据复制到HDFS上指定表的目录下。

support.huaweicloud.com/devg-lts-mrs/mrs_07_110020.html