Package org.apache.hadoop.hive.metastore.api

Examples of org.apache.hadoop.hive.metastore.api.AggrStats$AggrStatsTupleScheme


        for (Partition part : partList.getNotDeniedPartns()) {
          partNames.add(part.getName());
        }
        Map<String, String> colToTabAlias = new HashMap<String, String>();
        neededColumns = processNeededColumns(schema, neededColumns, colToTabAlias);
        AggrStats aggrStats = Hive.get().getAggrColStatsFor(table.getDbName(), table.getTableName(),
            neededColumns, partNames);
        if (null == aggrStats) {
          // There are some partitions with no state (or we didn't fetch any state).
          // Update the stats with empty list to reflect that in the
          // state/initialize structures.
          List<ColStatistics> emptyStats = Lists.newArrayList();

          // add partition column stats
          addParitionColumnStats(conf, neededColumns, referencedColumns, schema, table, partList,
              emptyStats);

          stats.addToColumnStats(emptyStats);
          stats.updateColumnStatsState(deriveStatType(emptyStats, referencedColumns));
        } else {
          List<ColumnStatisticsObj> colStats = aggrStats.getColStats();
          if (colStats.size() != neededColumns.size()) {
            LOG.debug("Column stats requested for : " + neededColumns.size() + " columns. Able to" +
                " retrieve for " + colStats.size() + " columns");
          }
          List<ColStatistics> columnStats = convertColStats(colStats, table.getTableName(),
              colToTabAlias);

          addParitionColumnStats(conf, neededColumns, referencedColumns, schema, table, partList,
              columnStats);

          // infer if any column can be primary key based on column statistics
          inferAndSetPrimaryKey(stats.getNumRows(), columnStats);

          stats.addToColumnStats(columnStats);
          State colState = deriveStatType(columnStats, referencedColumns);
          if (aggrStats.getPartsFound() != partNames.size() && colState != State.NONE) {
            LOG.debug("Column stats requested for : " + partNames.size() + " partitions. "
                + "Able to retrieve for " + aggrStats.getPartsFound() + " partitions");
            colState = State.PARTIAL;
          }
          stats.setColumnStatsState(colState);
        }
      }
View Full Code Here


    @Override
    public AggrStats get_aggr_stats_for(PartitionsStatsRequest request)
        throws NoSuchObjectException, MetaException, TException {
      startFunction("get_aggr_stats_for: db=" + request.getDbName() + " table=" + request.getTblName());
      AggrStats aggrStats = null;
      try {
        aggrStats = new AggrStats(getMS().get_aggr_stats_for(request.getDbName(),
          request.getTblName(), request.getPartNames(), request.getColNames()));
        return aggrStats;
      } finally {
          endFunction("get_partitions_statistics_req: ", aggrStats == null, null, request.getTblName());
      }
View Full Code Here

  public AggrStats aggrColStatsForPartitions(String dbName, String tableName,
      List<String> partNames, List<String> colNames) throws MetaException {
    long partsFound = partsFoundForPartitions(dbName, tableName, partNames, colNames);
    List<ColumnStatisticsObj> stats = columnStatisticsObjForPartitions(dbName,
        tableName, partNames, colNames, partsFound);
    return new AggrStats(stats, partsFound);
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.metastore.api.AggrStats$AggrStatsTupleScheme

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.