if (stats.getEstimatedNumRows() == noConditionPTabStats.getEstimatedNumRows()) { isFullScan = true; if (stats.getTabletCount() > 2) { double accuracy = 1.0 - (2.0/stats.getTabletCount()); scalingFactor = Math.min(1.0, 1.0 / Math.sqrt(1.0 / accuracy)); } else { && metaTable.getScanStats().getTabletCount() < PluginConstants.JSON_TABLE_NUM_TABLETS_PER_INDEX_DEFAULT) { "scalingFactor {}", this, (index == null ? "null" : index.getIndexName()), (index == null ? "null" : index.getIndexInfo()), (condition == null ? "null" : condition.toString()), stats.getEstimatedNumRows(), (stats.getEstimatedNumRows() == 0 ? 0 : stats.getEstimatedSize()/stats.getEstimatedNumRows()), stats.getEstimatedSize(), stats.getTabletCount(), metaTable.getScanStats().getTabletCount(), scalingFactor); return new MapRDBStatisticsPayload(scalingFactor * stats.getEstimatedNumRows(), scalingFactor * stats.getEstimatedNumRows(), ((stats.getEstimatedNumRows() == 0 ? 0 : (double)stats.getEstimatedSize()/stats.getEstimatedNumRows()))); } else { logger.info("index_plan_info: getEstimatedRowCount: {} indexName: {}, indexInfo: {}, " +
QueryCondition condition = r.getCondition(); List<RowkeyRange> rowkeyRanges = ((ConditionImpl)condition).getRowkeyRanges(); byte[] start = rowkeyRanges.get(0).getStartRow();
private void init() { try { // Get the fullTableRowCount only once i.e. if not already obtained before. if (fullTableRowCount == 0) { final Table t = this.formatPlugin.getJsonTableCache().getTable( scanSpec.getTableName(), scanSpec.getIndexDesc(), getUserName()); final MetaTable metaTable = t.getMetaTable(); // For condition null, we get full table stats. com.mapr.db.scan.ScanStats stats = metaTable.getScanStats(); fullTableRowCount = stats.getEstimatedNumRows(); fullTableEstimatedSize = stats.getEstimatedSize(); // MapRDB client can return invalid rowCount i.e. 0, especially right after table // creation. It takes 15 minutes before table stats are obtained and cached in client. // If we get 0 rowCount, fallback to getting rowCount using old admin API. if (fullTableRowCount == 0) { PluginCost pluginCostModel = formatPlugin.getPluginCostModel(); final int avgColumnSize = pluginCostModel.getAverageColumnSize(this); final int numColumns = (columns == null || columns.isEmpty() || Utilities.isStarQuery(columns)) ? STAR_COLS : columns.size(); MapRDBTableStats tableStats = new MapRDBTableStats(formatPlugin.getFsConf(), scanSpec.getTableName()); fullTableRowCount = tableStats.getNumRows(); fullTableEstimatedSize = fullTableRowCount * numColumns * avgColumnSize; } } } catch (Exception e) { throw new DrillRuntimeException("Error getting region info for table: " + scanSpec.getTableName() + (scanSpec.getIndexDesc() == null ? "" : (", index: " + scanSpec.getIndexName())), e); } }
QueryCondition firstCondition = firstRange.getCondition(); byte[] firstStartRow = ((ConditionImpl) firstCondition).getRowkeyRanges().get(0).getStartRow(); scanSpec.setStartRow(firstStartRow); QueryCondition lastCondition = lastRange.getCondition(); List<RowkeyRange> rowkeyRanges = ((ConditionImpl) lastCondition).getRowkeyRanges(); byte[] lastStopRow = rowkeyRanges.get(rowkeyRanges.size() - 1).getStopRow(); regionsToScan.put(new TabletFragmentInfo(tabletInfoImpl), range.getLocations()[0]);
if (stats.getEstimatedNumRows() == noConditionPTabStats.getEstimatedNumRows()) { isFullScan = true; if (stats.getTabletCount() > 2) { double accuracy = 1.0 - (2.0/stats.getTabletCount()); scalingFactor = Math.min(1.0, 1.0 / Math.sqrt(1.0 / accuracy)); } else { && metaTable.getScanStats().getTabletCount() < PluginConstants.JSON_TABLE_NUM_TABLETS_PER_INDEX_DEFAULT) { "scalingFactor {}", this, (index == null ? "null" : index.getIndexName()), (index == null ? "null" : index.getIndexInfo()), (condition == null ? "null" : condition.toString()), stats.getEstimatedNumRows(), (stats.getEstimatedNumRows() == 0 ? 0 : stats.getEstimatedSize()/stats.getEstimatedNumRows()), stats.getEstimatedSize(), stats.getTabletCount(), metaTable.getScanStats().getTabletCount(), scalingFactor); return new MapRDBStatisticsPayload(scalingFactor * stats.getEstimatedNumRows(), scalingFactor * stats.getEstimatedNumRows(), ((stats.getEstimatedNumRows() == 0 ? 0 : (double)stats.getEstimatedSize()/stats.getEstimatedNumRows()))); } else { logger.info("index_plan_info: getEstimatedRowCount: {} indexName: {}, indexInfo: {}, " +
private void init() { try { // Get the fullTableRowCount only once i.e. if not already obtained before. if (fullTableRowCount == 0) { final Table t = this.formatPlugin.getJsonTableCache().getTable( scanSpec.getTableName(), scanSpec.getIndexDesc(), getUserName()); final MetaTable metaTable = t.getMetaTable(); // For condition null, we get full table stats. com.mapr.db.scan.ScanStats stats = metaTable.getScanStats(); fullTableRowCount = stats.getEstimatedNumRows(); fullTableEstimatedSize = stats.getEstimatedSize(); // MapRDB client can return invalid rowCount i.e. 0, especially right after table // creation. It takes 15 minutes before table stats are obtained and cached in client. // If we get 0 rowCount, fallback to getting rowCount using old admin API. if (fullTableRowCount == 0) { PluginCost pluginCostModel = formatPlugin.getPluginCostModel(); final int avgColumnSize = pluginCostModel.getAverageColumnSize(this); final int numColumns = (columns == null || columns.isEmpty() || Utilities.isStarQuery(columns)) ? STAR_COLS : columns.size(); MapRDBTableStats tableStats = new MapRDBTableStats(formatPlugin.getFsConf(), scanSpec.getTableName()); fullTableRowCount = tableStats.getNumRows(); fullTableEstimatedSize = fullTableRowCount * numColumns * avgColumnSize; } } } catch (Exception e) { throw new DrillRuntimeException("Error getting region info for table: " + scanSpec.getTableName() + (scanSpec.getIndexDesc() == null ? "" : (", index: " + scanSpec.getIndexName())), e); } }
QueryCondition firstCondition = firstRange.getCondition(); byte[] firstStartRow = ((ConditionImpl) firstCondition).getRowkeyRanges().get(0).getStartRow(); scanSpec.setStartRow(firstStartRow); QueryCondition lastCondition = lastRange.getCondition(); List<RowkeyRange> rowkeyRanges = ((ConditionImpl) lastCondition).getRowkeyRanges(); byte[] lastStopRow = rowkeyRanges.get(rowkeyRanges.size() - 1).getStopRow(); regionsToScan.put(new TabletFragmentInfo(tabletInfoImpl), range.getLocations()[0]);
QueryCondition condition = r.getCondition(); List<RowkeyRange> rowkeyRanges = ((ConditionImpl)condition).getRowkeyRanges(); byte[] start = rowkeyRanges.get(0).getStartRow();