Load csv file to Hive Table Load csv file to Hive Table hadoop hadoop

Load csv file to Hive Table


Try this (cellphone...)

create external table if not exists AdventureWorks2014.Department ( DepartmentID smallint , Name string , GroupName string, rate_code string, ModifiedDate timestamp )ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'      STORED AS TEXTFILE LOCATION 'wasb:///ds/Department' 

** Limitation **
This SerDe treats all columns to be of type String. Even if you create a table with non-string column types using this SerDe, the DESCRIBE TABLE output would show string column type. The type information is retrieved from the SerDe. To convert columns to the desired type in a table, you can create a view over the table that does the CAST to the desired type.

https://cwiki.apache.org/confluence/display/Hive/CSV+Serde


FIELDS TERMINATED BY '","' is incorrect. Your fields are terminated by a , not ",". Change your DDL to FIELDS TERMINATED BY ','.


LOAD DATA LOCAL INPATH '/home/hadoop/hive/log_2013805_16210.log'into table_name