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; }
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); } };
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 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; }
functions[i] = aggFunc; aggregators[i] = aggFunc.getAggregator(); expressions[i] = aggFunc.getAggregatorExpression();
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); } };
@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); } };