Hive 外部表未显示在 Namenode (Cloudera-QuickstartVm) 中

Posted

技术标签:

【中文标题】Hive 外部表未显示在 Namenode (Cloudera-QuickstartVm) 中【英文标题】:Hive External table does not showing in Namenode (Cloudera-QuickstartVm) 【发布时间】:2014-08-23 04:47:21 【问题描述】:

我在 Hive 中的 hdfs 路径“hdfs://localhost.localdomain:8020/user/hive/training”中创建了外部表。如果我应用 describe 命令,我可以找到如下表路径。但是当我浏览 namenode 网页时,表名没有显示在路径中。

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

【问题讨论】:

我猜它可能在 /user/hive/warehouse/ 中。请在 HDFS 中检查此路径。 satha.ilangovan,如果我在默认路径(/user/hive/warehouse)中创建外部表,我可以在路径中看到表。该表不在默认配置单元路径 (/user/hive/warehouse/) 中,而是在路径hdfs://localhost.localdomain:8020/user/hive/training 中创建,如果滚动到右端,您可以看到表的完整路径。 【参考方案1】:

对此我深表歉意。我猜在创建内部配置单元表的情况下,我们可以在 /user/hive/warehouse 的各个数据库中看到表名。

在创建外部表的情况下,需要将文件放在指定的 HDFS 位置,我们无法看到表名。

请在下面找到 Hive wiki 中的一些定义

"用户可以创建一个指向HDFS内指定位置的外部表。在这种特殊用法中,用户可以使用HDFS put或copy命令将文件复制到指定位置,并创建一个指向该位置的表包含所有相关的行格式信息。”

我相信以下链接可能包含您正在寻找的确切信息。

Difference between Hive internal tables and external tables?

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

【讨论】:

以上是关于Hive 外部表未显示在 Namenode (Cloudera-QuickstartVm) 中的主要内容,如果未能解决你的问题,请参考以下文章

Hive 外部表未从 CSV 源读取整个字符串

镶木地板上的配置单元外部表未获取数据

分布式环境下hive的外部表是如何存储的

hive 创建数据表失败

Sql Server 数据透视表未对结果集进行分组

修改NameNode端口后,hive表查询报错