Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

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

@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

@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...

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

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

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.