0
votes

I have created external table in Hive in the hdfs path 'hdfs://localhost.localdomain:8020/user/hive/training'. If I apply describe command I can find the table path as below. But when I browse through the namenode web page, the table name does not showing in the path.

hive> describe extended testtable4;
OK
firstname   string  
lastname    string  
address string  
city    string  
state   string  
country string  

Detailed Table Information  Table(tableName:testtable4, dbName:default, owner:cloudera, createTime:1408765301, lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:firstname, type:string, comment:null), FieldSchema(name:lastname, type:string, comment:null), FieldSchema(name:address, type:string, comment:null), FieldSchema(name:city, type:string, comment:null), FieldSchema(name:state, type:string, comment:null), FieldSchema(name:country, type:string, comment:null)], location:hdfs://localhost.localdomain:8020/user/hive/training, inputFormat:org.apache.hadoop.mapred.TextInputFormat, outputFormat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat, compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, serializationLib:org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, parameters:{serialization.format=,, field.delim=,, line.delim=    
}), bucketCols:[], sortCols:[], parameters:{}, skewedInfo:SkewedInfo(skewedColNames:[], skewedColValues:[], skewedColValueLocationMaps:{}), storedAsSubDirectories:false), partitionKeys:[], parameters:{EXTERNAL=TRUE, transient_lastDdlTime=1408765301}, viewOriginalText:null, viewExpandedText:null, tableType:EXTERNAL_TABLE)       
Time taken: 0.7 seconds
1
I guess it might be in /user/hive/warehouse/. Please check this path in HDFS.scalauser
satha.ilangovan, if I create the external table in the default path(/user/hive/warehouse), I can see the table in the path. The table is not in default hive path (/user/hive/warehouse/) , instead I have created it in the path hdfs://localhost.localdomain:8020/user/hive/training, if you scroll to right end, you can see the full path of the table.Green

1 Answers

1
votes

I apologize for that. I guess in case of internal hive table creation we could see the table name in respective databases in /user/hive/warehouse.

In case of External table creation a file needs to be put in the specified HDFS location and we can not able to see the table names.

Please find below some definitions from Hive wiki

"The user can create an external table that points to a specified location within HDFS. In this particular usage, the user can copy a file into the specified location using the HDFS put or copy commands and create a table pointing to this location with all the relevant row format information."

I believe the following links might be having the exact information you looking for.

Difference between Hive internal tables and external tables?

https://cwiki.apache.org/confluence/display/Hive/Tutorial