HiveSQL in HDInsight: Load Table Data

To load data into HDFS Hive tables, simply, save the files in table folders at Hive shell (replaced by beeline):

PUT myfile.txt /data/table1

Use LOAD statement:

LOAD data [local] INPATH '/data/source/' INTO TABLE myTable;

Use INSERT and SELECT FROM statement:

INSERT INTO TABLE table2 SELECT Col1, UPPER(Col2) FROM table1;

Use CREATE TABLE AS SELECT statement:

CREATE TABLE table3 ROW FROMAT FIELDS TERMINATED BY '\t'
STORED AS TEXTFILE LOCATION '/data/summaryTable' 
AS SELECT Col1, SUM(Col2) As Total FROM table1 GROUP BY Col1;

Anyhow, refer to the line below for beeline details:

https://docs.microsoft.com/en-us/azure/hdinsight/hdinsight-hadoop-use-hive-beeline

 

my signature
February 24, 2018