Review Board 1.7.22


Store state of stats

Review Request #15184 - Created Nov. 1, 2013 and updated

Ashutosh Chauhan
HIVE-3777
Reviewers
hive
thejas
hive
Store state of stats.
Existing tests suffice.
trunk/common/src/java/org/apache/hadoop/hive/common/StatsSetupConst.java
Revision 1537954 New Change
[20] 14 lines
[+20]
15
 * See the License for the specific language governing permissions and
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
16
 * limitations under the License.
17
 */
17
 */
18
package org.apache.hadoop.hive.common;
18
package org.apache.hadoop.hive.common;
19

    
   
19

   
20
import java.util.ArrayList;
20
import java.util.Map;
21
import java.util.List;
21

   
22

    
   
22

   
23

    
   
23

   
24
/**
24
/**
25
 * A class that defines the constant strings used by the statistics implementation.
25
 * A class that defines the constant strings used by the statistics implementation.
26
 */
26
 */
[+20] [20] 37 lines
[+20] [+] public class StatsSetupConst {
64
  public static final String RAW_DATA_SIZE = "rawDataSize";
64
  public static final String RAW_DATA_SIZE = "rawDataSize";
65

    
   
65

   
66
  /**
66
  /**
67
   * @return List of all supported statistics
67
   * @return List of all supported statistics
68
   */
68
   */
69
  public static List<String> getSupportedStats() {
69
  public static final String[] supportedStats = new String[] 
70
    List<String> supportedStats = new ArrayList<String>();
70
	{NUM_FILES,ROW_COUNT,TOTAL_SIZE,RAW_DATA_SIZE};
71
    supportedStats.add(NUM_FILES);

   
72
    supportedStats.add(ROW_COUNT);

   
73
    supportedStats.add(TOTAL_SIZE);

   
74
    supportedStats.add(RAW_DATA_SIZE);

   
75
    return supportedStats;

   
76
  }

   
77

    
   
71

   
78
  /**
72
  /**
79
   * @return List of all statistics that need to be collected during query execution. These are
73
   * @return List of all statistics that need to be collected during query execution. These are
80
   * statistics that inherently require a scan of the data.
74
   * statistics that inherently require a scan of the data.
81
   */
75
   */
82
  public static List<String> getStatsToBeCollected() {
76
  public static final String[] statsRequireCompute = new String[] {ROW_COUNT,RAW_DATA_SIZE};
83
    List<String> collectableStats = new ArrayList<String>();

   
84
    collectableStats.add(ROW_COUNT);

   
85
    collectableStats.add(RAW_DATA_SIZE);

   
86
    return collectableStats;

   
87
  }

   
88

    
   
77

   
89
  /**
78
  /**
90
   * @return List of statistics that can be collected quickly without requiring a scan of the data.
79
   * @return List of statistics that can be collected quickly without requiring a scan of the data.
91
   */
80
   */
92
  public static List<String> getStatsFastCollection() {
81
  public static final String[] fastStats = new String[] {NUM_FILES,TOTAL_SIZE};
93
    List<String> fastStats = new ArrayList<String>();
82
  
94
    fastStats.add(NUM_FILES);
83
  public static final String STATS_GENERATED_VIA_STATS_TASK = "STATS_GENERATED_VIA_STATS_TASK";
95
    fastStats.add(TOTAL_SIZE);
84

   
96
    return fastStats;
85
  public static final String COLUMN_STATS_ACCURATE = "COLUMN_STATS_ACCURATE";

    
   
86
  

    
   
87
  public static final String TRUE = "true";

    
   
88
  

    
   
89
  public static final String FALSE = "false";

    
   
90
  

    
   
91
  public static boolean areStatsUptoDate(Map<String,String> params) {

    
   
92
	  if(!params.containsKey(COLUMN_STATS_ACCURATE)) {

    
   
93
		  return false;

    
   
94
	  } else return params.get(COLUMN_STATS_ACCURATE).equals(TRUE);
97
  }
95
  }
98
}
96
}
trunk/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java
Revision 1537954 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/StatsTask.java
Revision 1537954 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
Revision 1537954 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/StatsOptimizer.java
Revision 1537954 New Change
 
  1. trunk/common/src/java/org/apache/hadoop/hive/common/StatsSetupConst.java: Loading...
  2. trunk/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java: Loading...
  3. trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/StatsTask.java: Loading...
  4. trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java: Loading...
  5. trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/StatsOptimizer.java: Loading...