org.apache.calcite.adapter.enumerable.EnumerableAggregate Java Examples

The following examples show how to use org.apache.calcite.adapter.enumerable.EnumerableAggregate. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OLAPAggregateRel.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Override
public EnumerableRel implementEnumerable(List<EnumerableRel> inputs) {
    try {
        return new EnumerableAggregate(getCluster(), getCluster().traitSetOf(EnumerableConvention.INSTANCE), //
                sole(inputs), indicator, this.groupSet, this.groupSets, rewriteAggCalls);
    } catch (InvalidRelException e) {
        throw new IllegalStateException("Can't create EnumerableAggregate!", e);
    }
}
 
Example #2
Source File: CalcitePlanner.java    From herddb with Apache License 2.0 5 votes vote down vote up
private PlannerOp planAggregate(EnumerableAggregate op, RelDataType rowType, boolean returnValues) {

        List<RelDataTypeField> fieldList = op.getRowType().getFieldList();

        List<AggregateCall> calls = op.getAggCallList();
        String[] fieldnames = new String[fieldList.size()];
        String[] aggtypes = new String[calls.size()];
        Column[] columns = new Column[fieldList.size()];
        List<Integer> groupedFiledsIndexes = op.getGroupSet().toList();
        List<List<Integer>> argLists = new ArrayList<>(calls.size());
        int i = 0;

        int idaggcall = 0;
        for (RelDataTypeField c : fieldList) {
            int type = convertToHerdType(c.getType());
            Column co = Column.column(c.getName(), type);
            columns[i] = co;
            fieldnames[i] = c.getName().toLowerCase();
            i++;
        }
        for (AggregateCall call : calls) {
            aggtypes[idaggcall++] = call.getAggregation().getName();
            argLists.add(call.getArgList());
        }
        PlannerOp input = convertRelNode(op.getInput(), null, returnValues, false);
        return new AggregateOp(input, fieldnames, columns, aggtypes, argLists, groupedFiledsIndexes);
    }
 
Example #3
Source File: OLAPAggregateRel.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Override
public EnumerableRel implementEnumerable(List<EnumerableRel> inputs) {
    try {
        return new EnumerableAggregate(getCluster(), getCluster().traitSetOf(EnumerableConvention.INSTANCE), //
                sole(inputs), indicator, this.groupSet, this.groupSets, rewriteAggCalls);
    } catch (InvalidRelException e) {
        throw new IllegalStateException("Can't create EnumerableAggregate!", e);
    }
}
 
Example #4
Source File: RelUtils.java    From sql-gremlin with Apache License 2.0 2 votes vote down vote up
/**
 * Is this a RelNode we can convert into Gremlin?
 * @param node the node to check
 * @return true if a convert operation is supported
 */
public static Boolean isConvertable(RelNode node) {
    return !(node instanceof EnumerableAggregate || node instanceof EnumerableCalc
            || node instanceof EnumerableLimit || node instanceof EnumerableSort);
}