0

My hive table is a managed table and i can see the files present in HDFS. While querying through hive it does not display any result.

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                              

While selecting data from table - select * from emp; it fetches no results. Why there is difference in HDFS and select output.

mazaneicha
  • 8,794
  • 4
  • 33
  • 52
rks
  • 19
  • 1
  • 9
  • How did you created and loaded that table? – leftjoin Feb 10 '21 at 09:03
  • Try to run recover partitions: https://stackoverflow.com/a/57033175/2700344 – leftjoin Feb 10 '21 at 10:21
  • or try analyze table compute statistics. – Koushik Roy Feb 10 '21 at 11:44
  • @leftjoin - Table is created by hive shell and loaded from another hive table. – rks Feb 11 '21 at 05:15
  • I can not execute ALTER TABLE TABLE_NAME RECOVER PARTITIONS command on table. It gives error "Error: Error while compiling statement: FAILED: ParseException line 1:34 cannot recognize input near 'RECOVER' 'PARTITIONS' '' in alter table statement (state=42000,code=40000" – rks Feb 11 '21 at 05:17
  • Thanks @leftjoin, koushik - ANALYZE TABLE table_name COMPUTE STATISTICS FOR COLUMNS; worked for me – rks Feb 11 '21 at 06:02

1 Answers1

0

Command worked for me -

ANALYZE TABLE table_name COMPUTE STATISTICS FOR COLUMNS;
rks
  • 19
  • 1
  • 9