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

The following examples show how to use org.apache.calcite.adapter.enumerable.EnumerableSort. 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: CalcitePlanner.java    From herddb with Apache License 2.0 6 votes vote down vote up
private PlannerOp planSort(EnumerableSort op, RelDataType rowType) {
    PlannerOp input = convertRelNode(op.getInput(), rowType, false, false);
    RelCollation collation = op.getCollation();
    List<RelFieldCollation> fieldCollations = collation.getFieldCollations();
    boolean[] directions = new boolean[fieldCollations.size()];
    int[] fields = new int[fieldCollations.size()];
    int i = 0;
    for (RelFieldCollation col : fieldCollations) {
        RelFieldCollation.Direction direction = col.getDirection();
        int index = col.getFieldIndex();
        directions[i] = direction == RelFieldCollation.Direction.ASCENDING
                || direction == RelFieldCollation.Direction.STRICTLY_ASCENDING;
        fields[i++] = index;
    }
    return new SortOp(input, directions, fields);

}
 
Example #2
Source File: OLAPSortRel.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public EnumerableRel implementEnumerable(List<EnumerableRel> inputs) {
    return new EnumerableSort(getCluster(),
            getCluster().traitSetOf(EnumerableConvention.INSTANCE).replace(collation), //
            sole(inputs), collation, offset, fetch);
}
 
Example #3
Source File: OLAPSortRel.java    From kylin with Apache License 2.0 4 votes vote down vote up
@Override
public EnumerableRel implementEnumerable(List<EnumerableRel> inputs) {
    return new EnumerableSort(getCluster(),
            getCluster().traitSetOf(EnumerableConvention.INSTANCE).replace(collation), //
            sole(inputs), collation, offset, fetch);
}
 
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);
}