IGTStore store = new HBaseReadonlyStore(cellListIterator, scanRequest, rawScans.get(0).hbaseColumns, hbaseColumnsToGT, cubeSeg.getRowKeyPreambleSize(), false, storageContext.isExactAggregation()); IGTScanner rawScanner = store.scan(scanRequest);
builder.setIsExactAggregate(storageContext.isExactAggregation());
private static boolean isCoprocessorBeneficial(CubeInstance cube, Collection<TblColRef> groupBy, Collection<RowValueDecoder> rowValueDecoders, StorageContext context) { String forceFlag = System.getProperty(FORCE_COPROCESSOR); if (forceFlag != null) { return Boolean.parseBoolean(forceFlag); } Boolean cubeOverride = CUBE_OVERRIDES.get(cube.getName()); if (cubeOverride != null) { return cubeOverride.booleanValue(); } if (RowValueDecoder.hasMemHungryCountDistinct(rowValueDecoders)) { logger.info("Coprocessor is disabled because there is memory hungry count distinct"); return false; } if (context.isExactAggregation()) { logger.info("Coprocessor is disabled because exactAggregation is true"); return false; } Cuboid cuboid = context.getCuboid(); Set<TblColRef> toAggr = Sets.newHashSet(cuboid.getAggregationColumns()); toAggr.removeAll(groupBy); if (toAggr.isEmpty()) { logger.info("Coprocessor is disabled because no additional columns to aggregate"); return false; } logger.info("Coprocessor is enabled to aggregate " + toAggr + ", returning " + groupBy); return true; }
private List<RowValueDecoder> translateAggregation(HBaseMappingDesc hbaseMapping, Collection<FunctionDesc> metrics, // StorageContext context) { Map<HBaseColumnDesc, RowValueDecoder> codecMap = Maps.newHashMap(); for (FunctionDesc aggrFunc : metrics) { Collection<HBaseColumnDesc> hbCols = hbaseMapping.findHBaseColumnByFunction(aggrFunc); if (hbCols.isEmpty()) { throw new IllegalStateException("can't find HBaseColumnDesc for function " + aggrFunc.getFullExpression()); } HBaseColumnDesc bestHBCol = null; int bestIndex = -1; for (HBaseColumnDesc hbCol : hbCols) { bestHBCol = hbCol; bestIndex = hbCol.findMeasureIndex(aggrFunc); MeasureDesc measure = hbCol.getMeasures()[bestIndex]; // criteria for holistic measure: Exact Aggregation && Exact Cuboid if (measure.isHolisticCountDistinct() && context.isExactAggregation()) { logger.info("Holistic count distinct chosen for " + aggrFunc); break; } } RowValueDecoder codec = codecMap.get(bestHBCol); if (codec == null) { codec = new RowValueDecoder(bestHBCol); codecMap.put(bestHBCol, codec); } codec.setIndex(bestIndex); } return new ArrayList<RowValueDecoder>(codecMap.values()); }
private void setLimit(TupleFilter filter, StorageContext context) { boolean goodAggr = context.isExactAggregation(); boolean goodFilter = filter == null || (TupleFilter.isEvaluableRecursively(filter) && context.isCoprocessorEnabled()); boolean goodSort = context.hasSort() == false; if (goodAggr && goodFilter && goodSort) { logger.info("Enable limit " + context.getLimit()); context.enableLimit(); } }
IGTStore store = new HBaseReadonlyStore(cellListIterator, scanRequest, rawScans.get(0).hbaseColumns, hbaseColumnsToGT, cubeSeg.getRowKeyPreambleSize(), false, storageContext.isExactAggregation()); IGTScanner rawScanner = store.scan(scanRequest);
builder.setIsExactAggregate(storageContext.isExactAggregation());