hive File formats in HIVE Text File


Example

TextFile is the default file format, unless the configuration parameter hive.default.fileformat has a different setting. We can create a table on hive using the field names in our delimited text file. Lets say for example, our csv file contains three fields (id, name, salary) and we want to create a table in hive called "employees". We will use the below code to create the table in hive.
CREATE TABLE employees (id int, name string, salary double) ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘,’;

Now we can load a text file into our table:

LOAD DATA LOCAL INPATH '/home/ourcsvfile.csv' OVERWRITE INTO TABLE employees;

Displaying the contents of our table on hive to check if the data was successfully loaded:

SELECT * FROM employees;