List<ColumnStatisticsObj> colStat = Hive.get().getTableColumnStatistics( dbName, tabName, colStatsToRetrieve, false); stats = convertColStats(colStat, tabName); } catch (HiveException e) { LOG.error("Failed to retrieve table statistics: ", e);
/** * Get table level column statistics from metastore for needed columns * @param table * - table * @param schema * - output schema * @param neededColumns * - list of needed columns * @return column statistics */ public static List<ColStatistics> getTableColumnStats( Table table, List<ColumnInfo> schema, List<String> neededColumns) { if (table.isMaterializedTable()) { LOG.debug("Materialized table does not contain table statistics"); return null; } String dbName = table.getDbName(); String tabName = table.getTableName(); List<String> neededColsInTable = processNeededColumns(schema, neededColumns); List<ColStatistics> stats = null; try { List<ColumnStatisticsObj> colStat = Hive.get().getTableColumnStatistics( dbName, tabName, neededColsInTable); stats = convertColStats(colStat, tabName); } catch (HiveException e) { LOG.error("Failed to retrieve table statistics: ", e); stats = null; } return stats; }
} else { if (statsRetrieved) { columnStats.addAll(convertColStats(aggrStats.getColStats(), table.getTableName()));
List<ColStatistics> columnStats = convertColStats(colStats, table.getTableName());
/** * Get table level column statistics from metastore for needed columns * @param table * - table * @param schema * - output schema * @param neededColumns * - list of needed columns * @return column statistics */ public static List<ColStatistics> getTableColumnStats( Table table, List<ColumnInfo> schema, List<String> neededColumns) { String dbName = table.getDbName(); String tabName = table.getTableName(); List<String> neededColsInTable = processNeededColumns(schema, neededColumns); List<ColStatistics> stats = null; try { List<ColumnStatisticsObj> colStat = Hive.get().getTableColumnStatistics( dbName, tabName, neededColsInTable); stats = convertColStats(colStat, tabName); } catch (HiveException e) { LOG.error("Failed to retrieve table statistics: ", e); stats = null; } return stats; }
" retrieve for " + colStats.size() + " columns"); List<ColStatistics> columnStats = convertColStats(colStats, table.getTableName());