Search in sources :

Example 1 with IntFunction

use of io.ordinate.engine.function.IntFunction in project Mycat2 by MyCATApache.

the class CalciteCompiler method convertLimit.

public PhysicalPlan convertLimit(PhysicalPlan input, RexNode offset, RexNode fetch) {
    IntFunction offsetFunction = Optional.ofNullable(offset).map(i -> {
        return (IntFunction) rexConverter.convertRex(offset, input.schema());
    }).orElse(IntConstant.newInstance(0));
    IntFunction fetchFunction = Optional.ofNullable(fetch).map((i) -> (IntFunction) rexConverter.convertRex(fetch, input.schema())).orElse(IntConstant.newInstance(Integer.MAX_VALUE));
    return LimitPlan.create(input, offsetFunction, fetchFunction);
}
Also used : MycatRelDataTypeUtil(io.mycat.calcite.MycatRelDataTypeUtil) Schema(org.apache.arrow.vector.types.pojo.Schema) java.util(java.util) AnyAccumulator(io.ordinate.engine.function.aggregate.any.AnyAccumulator) ColumnFunction(io.ordinate.engine.function.column.ColumnFunction) Getter(lombok.Getter) ImmutableList(com.google.common.collect.ImmutableList) RexNode(org.apache.calcite.rex.RexNode) IntFunction(io.ordinate.engine.function.IntFunction) MycatRelDataType(io.mycat.beans.mycat.MycatRelDataType) VariableParameterFunction(io.ordinate.engine.function.bind.VariableParameterFunction) ImmutableBitSet(org.apache.calcite.util.ImmutableBitSet) RelDataType(org.apache.calcite.rel.type.RelDataType) org.apache.calcite.rel.core(org.apache.calcite.rel.core) InnerType(io.ordinate.engine.schema.InnerType) SqlKind(org.apache.calcite.sql.SqlKind) SqlTypeName(org.apache.calcite.sql.type.SqlTypeName) VectorExpression(io.ordinate.engine.vector.VectorExpression) MycatView(io.mycat.calcite.logical.MycatView) RexLiteral(org.apache.calcite.rex.RexLiteral) Function(io.ordinate.engine.function.Function) Field(org.apache.arrow.vector.types.pojo.Field) FactoryUtil(io.ordinate.engine.factory.FactoryUtil) RelNode(org.apache.calcite.rel.RelNode) MycatTableScan(io.mycat.calcite.table.MycatTableScan) RelFieldCollation(org.apache.calcite.rel.RelFieldCollation) Collectors(java.util.stream.Collectors) JoinType(org.apache.calcite.linq4j.JoinType) RelCollation(org.apache.calcite.rel.RelCollation) RelDataTypeField(org.apache.calcite.rel.type.RelDataTypeField) AccumulatorFunction(io.ordinate.engine.function.aggregate.AccumulatorFunction) IntConstant(io.ordinate.engine.function.constant.IntConstant) io.ordinate.engine.physicalplan(io.ordinate.engine.physicalplan) RexCall(org.apache.calcite.rex.RexCall) IntFunction(io.ordinate.engine.function.IntFunction)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 MycatRelDataType (io.mycat.beans.mycat.MycatRelDataType)1 MycatRelDataTypeUtil (io.mycat.calcite.MycatRelDataTypeUtil)1 MycatView (io.mycat.calcite.logical.MycatView)1 MycatTableScan (io.mycat.calcite.table.MycatTableScan)1 FactoryUtil (io.ordinate.engine.factory.FactoryUtil)1 Function (io.ordinate.engine.function.Function)1 IntFunction (io.ordinate.engine.function.IntFunction)1 AccumulatorFunction (io.ordinate.engine.function.aggregate.AccumulatorFunction)1 AnyAccumulator (io.ordinate.engine.function.aggregate.any.AnyAccumulator)1 VariableParameterFunction (io.ordinate.engine.function.bind.VariableParameterFunction)1 ColumnFunction (io.ordinate.engine.function.column.ColumnFunction)1 IntConstant (io.ordinate.engine.function.constant.IntConstant)1 io.ordinate.engine.physicalplan (io.ordinate.engine.physicalplan)1 InnerType (io.ordinate.engine.schema.InnerType)1 VectorExpression (io.ordinate.engine.vector.VectorExpression)1 java.util (java.util)1 Collectors (java.util.stream.Collectors)1 Getter (lombok.Getter)1 Field (org.apache.arrow.vector.types.pojo.Field)1