Support Questions

Find answers, ask questions, and share your expertise

I have created a table in hive. What is the command to check it in hdfs path ?

avatar
 
4 REPLIES 4

avatar
@Sudharsan Ganeshkumar

You could find the location with below queries:

1. describe formatted <table_name>;

2. show create table <table_name>;

avatar

Hi @Sindhu,

I tried but i m not getting it.

86522-capture.png

avatar

@Sudharsan Ganeshkumar

You need to run it under beeline / hive cli as below:

[root@xxx ~]# su - hive
[hive@xxx ~]$ hive
Logging initialized using configuration in file:/etc/hive/2.5.3.0-37/0/hive-log4j.properties
hive> show create table flight_orc;
OK
CREATE TABLE `flight_orc`(
  `flightnum` string, 
  `arrtime` int, 
  `deptime` int, 
  `crsarrtime` int, 
  `crsdeptime` int, 
  `arrdelay` int, 
  `depdelay` int, 
  `airtime` int)
ROW FORMAT SERDE 
  'org.apache.hadoop.hive.ql.io.orc.OrcSerde' 
STORED AS INPUTFORMAT 
  'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat' 
OUTPUTFORMAT 
  'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'
LOCATION
  'hdfs://xxx.com:8020/apps/hive/warehouse/flight_orc'
TBLPROPERTIES (
  'numFiles'='3', 
  'numRows'='1000000', 
  'rawDataSize'='110912400', 
  'totalSize'='397173299', 
  'transient_lastDdlTime'='1516645288')
Time taken: 4.901 seconds, Fetched: 23 row(s)
hive>

avatar
Master Mentor

@Sudharsan Ganeshkumar

You are not seeing anything because you are running the command as root user ! You will have to switch to the hive user and use hive or beeline

# su - hive
$ hive

Then at the prompt run the create statement

hive> CREATE TABLE IF NOT EXISTS emp ( eid int, name String,
salary String, destination String)
COMMENT ‘Employee details’
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ‘\t’
LINES TERMINATED BY ‘\n’
STORED AS TEXTFILE;

And then run

hive> show table emp;

HTH