Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-15653

Some ALTER TABLE commands drop table stats

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 1.1.0
    • 2.3.0
    • Metastore, Statistics
    • None

    Description

      Some ALTER TABLE commands drop the table stats. That may make sense for some ALTER TABLE operations, but certainly not for others. Personally, I I think ALTER TABLE should only change what was requested by the user without any side effects that may be unclear to users. In particular, collecting stats can be an expensive operation so it's rather inconvenient for users if they get wiped accidentally.

      Repro:

      create table t (i int);
      insert into t values(1);
      analyze table t compute statistics;
      alter table t set tblproperties('test'='test');
      hive> describe formatted t;
      OK
      # col_name            	data_type           	comment             
      	 	 
      i                   	int                 	                    
      	 	 
      # Detailed Table Information	 	 
      Database:           	default             	 
      Owner:              	abehm               	 
      CreateTime:         	Tue Jan 17 18:13:34 PST 2017	 
      LastAccessTime:     	UNKNOWN             	 
      Protect Mode:       	None                	 
      Retention:          	0                   	 
      Location:           	hdfs://localhost:20500/test-warehouse/t	 
      Table Type:         	MANAGED_TABLE       	 
      Table Parameters:	 	 
      	COLUMN_STATS_ACCURATE	false               
      	last_modified_by    	abehm               
      	last_modified_time  	1484705748          
      	numFiles            	1                   
      	numRows             	-1                  
      	rawDataSize         	-1                  
      	test                	test                
      	totalSize           	2                   
      	transient_lastDdlTime	1484705748          
      	 	 
      # Storage Information	 	 
      SerDe Library:      	org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe	 
      InputFormat:        	org.apache.hadoop.mapred.TextInputFormat	 
      OutputFormat:       	org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat	 
      Compressed:         	No                  	 
      Num Buckets:        	-1                  	 
      Bucket Columns:     	[]                  	 
      Sort Columns:       	[]                  	 
      Storage Desc Params:	 	 
      	serialization.format	1                   
      Time taken: 0.169 seconds, Fetched: 34 row(s)
      

      The same behavior can be observed with several other ALTER TABLE commands.

      Attachments

        1. HIVE-15653.1.patch
          35 kB
          Chaoyu Tang
        2. HIVE-15653.2.patch
          36 kB
          Chaoyu Tang
        3. HIVE-15653.3.patch
          94 kB
          Chaoyu Tang
        4. HIVE-15653.4.patch
          98 kB
          Chaoyu Tang
        5. HIVE-15653.5.patch
          99 kB
          Chaoyu Tang
        6. HIVE-15653.6.patch
          99 kB
          Chaoyu Tang
        7. HIVE-15653.patch
          18 kB
          Chaoyu Tang

        Issue Links

          Activity

            People

              ctang Chaoyu Tang
              alex.behm Alexander Behm
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: