private static long getNumRows(HiveConf conf, List<ColumnInfo> schema, List<String> neededColumns, Table table, long ds) { long nr = getNumRows(table); // number of rows -1 means that statistics from metastore is not reliable // and 0 means statistics gathering is disabled if (nr <= 0) { int avgRowSize = estimateRowSizeFromSchema(conf, schema, neededColumns); if (avgRowSize > 0) { if (LOG.isDebugEnabled()) { LOG.debug("Estimated average row size: " + avgRowSize); } nr = ds / avgRowSize; } } return nr == 0 ? 1 : nr; }
@Override public double getRowCount() { if (rowCount == -1) { if (null == partitionList) { // we are here either unpartitioned table or partitioned table with no // predicates computePartitionList(hiveConf, null, new HashSet<Integer>()); } rowCount = StatsUtils.getNumRows(hiveConf, getNonPartColumns(), hiveTblMetadata, partitionList, noColsMissingStats); } return rowCount; }
@Override public double getRowCount() { if (rowCount == -1) { if (null == partitionList) { // we are here either unpartitioned table or partitioned table with no // predicates computePartitionList(hiveConf, null, new HashSet<Integer>()); } if (hiveTblMetadata.isPartitioned()) { List<Long> rowCounts = StatsUtils.getBasicStatForPartitions(hiveTblMetadata, partitionList.getNotDeniedPartns(), StatsSetupConst.ROW_COUNT); rowCount = StatsUtils.getSumIgnoreNegatives(rowCounts); } else { rowCount = StatsUtils.getNumRows(hiveTblMetadata); } } if (rowCount == -1) noColsMissingStats.getAndIncrement(); return rowCount; }
private Long extractRowCount(RexInputRef ref) { RelColumnOrigin columnOrigin = this.metadataProvider.getColumnOrigin(filterOp, ref.getIndex()); if (columnOrigin != null) { RelOptHiveTable table = (RelOptHiveTable) columnOrigin.getOriginTable(); if (table != null) { if (StatsUtils.areBasicStatsUptoDateForQueryAnswering(table.getHiveTableMD(), table.getHiveTableMD().getParameters())) { return StatsUtils.getNumRows(table.getHiveTableMD()); } } } return null; }
long nr = getNumRows(conf, schema, neededColumns, table, ds); stats.setNumRows(nr); List<ColStatistics> colStats = Lists.newArrayList();
@Override public double getRowCount() { if (rowCount == -1) { if (null == partitionList) { // we are here either unpartitioned table or partitioned table with no // predicates computePartitionList(hiveConf, null); } if (hiveTblMetadata.isPartitioned()) { List<Long> rowCounts = StatsUtils.getBasicStatForPartitions(hiveTblMetadata, partitionList.getNotDeniedPartns(), StatsSetupConst.ROW_COUNT); rowCount = StatsUtils.getSumIgnoreNegatives(rowCounts); } else { rowCount = StatsUtils.getNumRows(hiveTblMetadata); } } if (rowCount == -1) noColsMissingStats.getAndIncrement(); return rowCount; }
long nr = getNumRows(table); long ds = getRawDataSize(table); if (ds <= 0) {