'How to load csv file in hive table?

I create table in hive and load csv file also from hdfs but when try to perform select query on created table I am getting results in encrypted format, can you please provide solution for this.

create table if not exists studentsinforamtion(
  studentnumber string ,
  universityname  string,
  collegename   string,
  studentname string, 
  branch string, 
  percentage string,
  areaters string,
  rankatuniversity INT,
  eligibleforcompnay string,
  selectedcompanylist int) 
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
stored as textfile;

load data inpath '/user/root/jobportal/studentinfo.ods' overwrite into table studentsinforamtion;

select * from studentsinforamtion limit 5;

ERROR:

OK
PK5:�C�l9�.mimetypeapplication/vnd.oasis.opendocument.spreadsheetPK5:�C�{C44meta.xml<?xml version="1.0" encoding="UTF-8"?>  NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
<office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:grddl="http://www.w3.org/2


Solution 1:[1]

Looks like your file is not pure comma-separated-file (or tab-separated as I see from your table's delimiter). It has some opendocument metadata "mimetypeapplication/vnd.oasis.opendocument.spreadsheetPK5:?C?{C44meta.xml". Try to save your doc in .csv format or use simple text editor to create needed spreadsheets.

FYI - 'NULL' in select result usually means that column type and value type are different - e.g. you have table with column types (int, int, int) and you've downloaded file into it with values (15, 23, userinfo) - select should return 15, 23, NULL. Hive doesn't check types of values during upload, so pay attention to them.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Valery Yesypenko