Search in sources :

Example 1 with RexPatternFieldRef

use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rex.RexPatternFieldRef in project beam by apache.

the class CEPCall method of.

public static CEPCall of(RexCall operation) {
    SqlOperator call = operation.getOperator();
    CEPOperator myOp = CEPOperator.of(call);
    ArrayList<CEPOperation> operandsList = new ArrayList<>();
    for (RexNode i : operation.getOperands()) {
        if (i.getClass() == RexCall.class) {
            CEPCall callToAdd = CEPCall.of((RexCall) i);
            operandsList.add(callToAdd);
        } else if (i.getClass() == RexLiteral.class) {
            RexLiteral lit = (RexLiteral) i;
            CEPLiteral litToAdd = CEPLiteral.of(lit);
            operandsList.add(litToAdd);
        } else if (i.getClass() == RexPatternFieldRef.class) {
            RexPatternFieldRef fieldRef = (RexPatternFieldRef) i;
            CEPFieldRef fieldRefToAdd = CEPFieldRef.of(fieldRef);
            operandsList.add(fieldRefToAdd);
        } else {
            throw new UnsupportedOperationException("RexNode not supported: " + i.getClass().getName());
        }
    }
    return new CEPCall(myOp, operandsList);
}
Also used : RexLiteral(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rex.RexLiteral) SqlOperator(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.SqlOperator) ArrayList(java.util.ArrayList) RexPatternFieldRef(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rex.RexPatternFieldRef) RexNode(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rex.RexNode)

Aggregations

ArrayList (java.util.ArrayList)1 RexLiteral (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rex.RexLiteral)1 RexNode (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rex.RexNode)1 RexPatternFieldRef (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rex.RexPatternFieldRef)1 SqlOperator (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.SqlOperator)1