private static Aggregator[] getAggregators(List<SingleAggregateFunction> aggFuncs) { Aggregator[] aggregators = new Aggregator[aggFuncs.size()]; for (int i = 0; i < aggregators.length; i++) { aggregators[i] = aggFuncs.get(i).getAggregator(); } return aggregators; }
private static int getMinNullableIndex(List<SingleAggregateFunction> aggFuncs, boolean isUngroupedAggregation) { int minNullableIndex = aggFuncs.size(); for (int i = 0; i < aggFuncs.size(); i++) { SingleAggregateFunction aggFunc = aggFuncs.get(i); if (isUngroupedAggregation ? aggFunc.getAggregator().isNullable() : aggFunc.getAggregatorExpression().isNullable()) { minNullableIndex = i; break; } } return minNullableIndex; }
@Override public int compare(SingleAggregateFunction o1, SingleAggregateFunction o2) { boolean isNullable1 = o1.isNullable(); boolean isNullable2 = o2.isNullable(); if (isNullable1 != isNullable2) { return isNullable1 ? 1 : -1; } isNullable1 = o1.getAggregatorExpression().isNullable(); isNullable2 = o2.getAggregatorExpression().isNullable(); if (isNullable1 != isNullable2) { return isNullable1 ? 1 : -1; } // Ensures COUNT(1) sorts first TODO: unit test for this boolean isConstant1 = o1.isConstantExpression(); boolean isConstant2 = o2.isConstantExpression(); if (isConstant1 != isConstant2) { return isConstant1 ? 1 : -1; } PDataType r1 = o1.getAggregator().getDataType(); PDataType r2 = o2.getAggregator().getDataType(); if (r1.isFixedWidth() != r2.isFixedWidth()) { return r1.isFixedWidth() ? -1 : 1; } return r1.compareTo(r2); } };
@Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { return getAggregator().evaluate(tuple, ptr); }
aggFunc.readFields(input, conf); functions[i] = aggFunc; aggregators[i] = aggFunc.getAggregator(); expressions[i] = aggFunc.getAggregatorExpression();
private static Aggregator[] getAggregators(List<SingleAggregateFunction> aggFuncs) { Aggregator[] aggregators = new Aggregator[aggFuncs.size()]; for (int i = 0; i < aggregators.length; i++) { aggregators[i] = aggFuncs.get(i).getAggregator(); } return aggregators; }
private static int getMinNullableIndex(List<SingleAggregateFunction> aggFuncs, boolean isUngroupedAggregation) { int minNullableIndex = aggFuncs.size(); for (int i = 0; i < aggFuncs.size(); i++) { SingleAggregateFunction aggFunc = aggFuncs.get(i); if (isUngroupedAggregation ? aggFunc.getAggregator().isNullable() : aggFunc.getAggregatorExpression().isNullable()) { minNullableIndex = i; break; } } return minNullableIndex; }
private static Aggregator[] getAggregators(List<SingleAggregateFunction> aggFuncs) { Aggregator[] aggregators = new Aggregator[aggFuncs.size()]; for (int i = 0; i < aggregators.length; i++) { aggregators[i] = aggFuncs.get(i).getAggregator(); } return aggregators; }
private static int getMinNullableIndex(List<SingleAggregateFunction> aggFuncs, boolean isUngroupedAggregation) { int minNullableIndex = aggFuncs.size(); for (int i = 0; i < aggFuncs.size(); i++) { SingleAggregateFunction aggFunc = aggFuncs.get(i); if (isUngroupedAggregation ? aggFunc.getAggregator().isNullable() : aggFunc.getAggregatorExpression().isNullable()) { minNullableIndex = i; break; } } return minNullableIndex; }
@Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { return getAggregator().evaluate(tuple, ptr); }
@Override public int compare(SingleAggregateFunction o1, SingleAggregateFunction o2) { boolean isNullable1 = o1.isNullable(); boolean isNullable2 = o2.isNullable(); if (isNullable1 != isNullable2) { return isNullable1 ? 1 : -1; } isNullable1 = o1.getAggregatorExpression().isNullable(); isNullable2 = o2.getAggregatorExpression().isNullable(); if (isNullable1 != isNullable2) { return isNullable1 ? 1 : -1; } // Ensures COUNT(1) sorts first TODO: unit test for this boolean isConstant1 = o1.isConstantExpression(); boolean isConstant2 = o2.isConstantExpression(); if (isConstant1 != isConstant2) { return isConstant1 ? 1 : -1; } PDataType r1 = o1.getAggregator().getDataType(); PDataType r2 = o2.getAggregator().getDataType(); if (r1.isFixedWidth() != r2.isFixedWidth()) { return r1.isFixedWidth() ? -1 : 1; } return r1.compareTo(r2); } };
@Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { return getAggregator().evaluate(tuple, ptr); }
aggFunc.readFields(input, conf); functions[i] = aggFunc; aggregators[i] = aggFunc.getAggregator(); expressions[i] = aggFunc.getAggregatorExpression();
aggFunc.readFields(input, conf); functions[i] = aggFunc; aggregators[i] = aggFunc.getAggregator(); expressions[i] = aggFunc.getAggregatorExpression();
@Override public int compare(SingleAggregateFunction o1, SingleAggregateFunction o2) { boolean isNullable1 = o1.isNullable(); boolean isNullable2 = o2.isNullable(); if (isNullable1 != isNullable2) { return isNullable1 ? 1 : -1; } isNullable1 = o1.getAggregatorExpression().isNullable(); isNullable2 = o2.getAggregatorExpression().isNullable(); if (isNullable1 != isNullable2) { return isNullable1 ? 1 : -1; } // Ensures COUNT(1) sorts first TODO: unit test for this boolean isConstant1 = o1.isConstantExpression(); boolean isConstant2 = o2.isConstantExpression(); if (isConstant1 != isConstant2) { return isConstant1 ? 1 : -1; } PDataType r1 = o1.getAggregator().getDataType(); PDataType r2 = o2.getAggregator().getDataType(); if (r1.isFixedWidth() != r2.isFixedWidth()) { return r1.isFixedWidth() ? -1 : 1; } return r1.compareTo(r2); } };