Support Questions
Find answers, ask questions, and share your expertise

How to move files from HDFS to HIVE?

Solved Go to solution
Highlighted

How to move files from HDFS to HIVE?

Explorer

Hi..

I have set of .csv files in HDFS folder with different columns, i want to move this files to HIVE dynamically. How to move this set of files to HIVE ? please help me and thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How to move files from HDFS to HIVE?

@Manikandan Durairaj

Here is the sample code:

CREATE EXTERNAL TABLE IF NOT EXISTS Cars(
        Name STRING, 
        Miles_per_Gallon INT,
        Cylinders INT,
        Displacement INT,
        Horsepower INT, 
        Weight_in_lbs INT,
        Acceleration DECIMAL,
        Year DATE,
        Origin CHAR(1))
    COMMENT 'Data about cars from a public database'
    ROW FORMAT DELIMITED
    FIELDS TERMINATED BY ','
    STORED AS TEXTFILE
    location '/user/<username>/visdata'; 

Link might help you more

https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.0/bk_dataintegration/content/moving_data_from...

View solution in original post

3 REPLIES 3
Highlighted

Re: How to move files from HDFS to HIVE?

@Manikandan Durairaj

Here is the sample code:

CREATE EXTERNAL TABLE IF NOT EXISTS Cars(
        Name STRING, 
        Miles_per_Gallon INT,
        Cylinders INT,
        Displacement INT,
        Horsepower INT, 
        Weight_in_lbs INT,
        Acceleration DECIMAL,
        Year DATE,
        Origin CHAR(1))
    COMMENT 'Data about cars from a public database'
    ROW FORMAT DELIMITED
    FIELDS TERMINATED BY ','
    STORED AS TEXTFILE
    location '/user/<username>/visdata'; 

Link might help you more

https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.0/bk_dataintegration/content/moving_data_from...

View solution in original post

Highlighted

Re: How to move files from HDFS to HIVE?

Explorer

thanks for ur reply sri but i have following doubt please give any solution

how to create the hive table dynamically based on the csv files.

for example, if csv1 file consists of 3 columns and csv2 file consists of 4 columns how to create hive table dynamically for both

Highlighted

Re: How to move files from HDFS to HIVE?

Explorer

how to create the hive table dynamically based on the csv files.

for example, if csv1 file consists of 3 columns and csv2 file consists of 4 columns how to create hive table dynamically for both

Don't have an account?