Search in sources :

Example 71 with ScalarFunctionCallExpression

use of org.apache.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression in project asterixdb by apache.

the class ByNameToByIndexFieldAccessRule method createFieldAccessByIndex.

@SuppressWarnings("unchecked")
private static ILogicalExpression createFieldAccessByIndex(ARecordType recType, AbstractFunctionCallExpression fce) {
    String s = ConstantExpressionUtil.getStringArgument(fce, 1);
    if (s == null) {
        return null;
    }
    int k = recType.getFieldIndex(s);
    if (k < 0) {
        return null;
    }
    return new ScalarFunctionCallExpression(FunctionUtil.getFunctionInfo(BuiltinFunctions.FIELD_ACCESS_BY_INDEX), fce.getArguments().get(0), new MutableObject<>(new ConstantExpression(new AsterixConstantValue(new AInt32(k)))));
}
Also used : AsterixConstantValue(org.apache.asterix.om.constants.AsterixConstantValue) ConstantExpression(org.apache.hyracks.algebricks.core.algebra.expressions.ConstantExpression) AInt32(org.apache.asterix.om.base.AInt32) ScalarFunctionCallExpression(org.apache.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression)

Aggregations

ScalarFunctionCallExpression (org.apache.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression)71 ILogicalExpression (org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression)57 Mutable (org.apache.commons.lang3.mutable.Mutable)48 ArrayList (java.util.ArrayList)38 LogicalVariable (org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable)38 VariableReferenceExpression (org.apache.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression)34 AbstractFunctionCallExpression (org.apache.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression)31 ILogicalOperator (org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator)26 ConstantExpression (org.apache.hyracks.algebricks.core.algebra.expressions.ConstantExpression)26 AssignOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.AssignOperator)26 MutableObject (org.apache.commons.lang3.mutable.MutableObject)25 AsterixConstantValue (org.apache.asterix.om.constants.AsterixConstantValue)22 AString (org.apache.asterix.om.base.AString)14 IAType (org.apache.asterix.om.types.IAType)14 IFunctionInfo (org.apache.hyracks.algebricks.core.algebra.functions.IFunctionInfo)14 Pair (org.apache.hyracks.algebricks.common.utils.Pair)13 GbyVariableExpressionPair (org.apache.asterix.lang.common.expression.GbyVariableExpressionPair)10 AInt32 (org.apache.asterix.om.base.AInt32)10 SelectOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.SelectOperator)10 QuantifiedPair (org.apache.asterix.lang.common.struct.QuantifiedPair)8