【问题标题】:hive table shows 0 results while querying蜂巢表在查询时显示 0 个结果
【发布时间】:2021-02-10 05:29:25
【问题描述】:

我的 hive 表是一个托管表,我可以看到 HDFS 中存在的文件。 通过 hive 查询时,它不会显示任何结果。

hive> describe formatted emp

Result - 
| Table Type:                     | MANAGED_TABLE                                      
| Table Parameters:               | NULL                                               
| 2                               | bucketing_version                                  
| 1376                            | numFiles                                           
| 43                              | numPartitions                                      
| 0                               | numRows                                            
| gzip                            | parquet.compression                                
| 0                               | rawDataSize                                        
| 4770821594                      | totalSize                                          
| true                            | transactional                                      
| insert_only                     | transactional_properties                           
| 1612857428                      | transient_lastDdlTime                              

从表中选择数据时 - 从emp中选择*; 它没有结果。 为什么 HDFS 和 select 输出有区别。

【问题讨论】:

  • 您是如何创建和加载该表的?
  • 尝试运行恢复分区:stackoverflow.com/a/57033175/2700344
  • 或尝试分析表计算统计信息。
  • @leftjoin - 表由 hive shell 创建并从另一个 hive 表加载。
  • 我无法对表执行 ALTER TABLE TABLE_NAME RECOVER PARTITIONS 命令。它给出了错误“错误:编译语句时出错:FAILED:ParseException line 1:34 cannot identify input near 'RECOVER' 'PARTITIONS' '' in alter table statement (state=42000,code=40000"

标签: hadoop hive


【解决方案1】:

命令对我有用 -

ANALYZE TABLE table_name COMPUTE STATISTICS FOR COLUMNS;

【讨论】:

  • 这很奇怪。全选应该在没有统计信息的情况下工作。 select count(*) 可以使用统计数据。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多