use of org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier in project asterixdb by apache.
the class FunctionManagerImpl method unregisterFunction.
@Override
public synchronized void unregisterFunction(IFunctionDescriptorFactory descriptorFactory) throws AlgebricksException {
FunctionIdentifier fid = descriptorFactory.createFunctionDescriptor().getIdentifier();
Pair<FunctionIdentifier, Integer> key = new Pair<>(fid, fid.getArity());
functions.remove(key);
}
use of org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier in project asterixdb by apache.
the class PullSelectOutOfEqJoin method rewritePost.
@Override
public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException {
AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
if (op.getOperatorTag() != LogicalOperatorTag.INNERJOIN) {
return false;
}
AbstractBinaryJoinOperator join = (AbstractBinaryJoinOperator) op;
ILogicalExpression expr = join.getCondition().getValue();
if (expr.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
return false;
}
AbstractFunctionCallExpression fexp = (AbstractFunctionCallExpression) expr;
FunctionIdentifier fi = fexp.getFunctionIdentifier();
if (!fi.equals(AlgebricksBuiltinFunctions.AND)) {
return false;
}
List<Mutable<ILogicalExpression>> eqVarVarComps = new ArrayList<Mutable<ILogicalExpression>>();
List<Mutable<ILogicalExpression>> otherPredicates = new ArrayList<Mutable<ILogicalExpression>>();
for (Mutable<ILogicalExpression> arg : fexp.getArguments()) {
if (isEqVarVar(arg.getValue())) {
eqVarVarComps.add(arg);
} else {
otherPredicates.add(arg);
}
}
if (eqVarVarComps.isEmpty() || otherPredicates.isEmpty()) {
return false;
}
// pull up
ILogicalExpression pulledCond = makeCondition(otherPredicates, context);
SelectOperator select = new SelectOperator(new MutableObject<ILogicalExpression>(pulledCond), false, null);
ILogicalExpression newJoinCond = makeCondition(eqVarVarComps, context);
join.getCondition().setValue(newJoinCond);
select.getInputs().add(new MutableObject<ILogicalOperator>(join));
opRef.setValue(select);
context.computeAndSetTypeEnvironmentForOperator(select);
return true;
}
use of org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier in project asterixdb by apache.
the class AddEquivalenceClassForRecordConstructorRule method addEquivalenceClassesForRecordConstructor.
private boolean addEquivalenceClassesForRecordConstructor(List<LogicalVariable> vars, List<Mutable<ILogicalExpression>> exprRefs, AssignOperator assignOp, IOptimizationContext context) {
boolean changed = false;
for (int exprIndex = 0; exprIndex < exprRefs.size(); ++exprIndex) {
ILogicalExpression expr = exprRefs.get(exprIndex).getValue();
if (expr.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
AbstractFunctionCallExpression funcExpr = (AbstractFunctionCallExpression) expr;
FunctionIdentifier fid = funcExpr.getFunctionIdentifier();
if (fid == BuiltinFunctions.CLOSED_RECORD_CONSTRUCTOR || fid == BuiltinFunctions.OPEN_RECORD_CONSTRUCTOR) {
changed |= propagateEquivalenceClassesForRecordConstructor(vars.get(exprIndex), funcExpr, assignOp, context);
}
}
}
return changed;
}
use of org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier in project asterixdb by apache.
the class AnalysisUtil method isAccessToFieldRecord.
public static boolean isAccessToFieldRecord(ILogicalExpression expr) {
if (expr.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
AbstractFunctionCallExpression fc = (AbstractFunctionCallExpression) expr;
FunctionIdentifier fid = fc.getFunctionIdentifier();
if (fid.equals(BuiltinFunctions.FIELD_ACCESS_BY_INDEX) || fid.equals(BuiltinFunctions.FIELD_ACCESS_BY_NAME) || fid.equals(BuiltinFunctions.FIELD_ACCESS_NESTED)) {
return true;
}
}
return false;
}
use of org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier in project asterixdb by apache.
the class AnalysisUtil method isRunnableAccessToFieldRecord.
public static boolean isRunnableAccessToFieldRecord(ILogicalExpression expr) {
if (expr.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
AbstractFunctionCallExpression fc = (AbstractFunctionCallExpression) expr;
FunctionIdentifier fid = fc.getFunctionIdentifier();
if (AnalysisUtil.isRunnableFieldAccessFunction(fid)) {
return true;
}
}
return false;
}
Aggregations