use of org.apache.hyracks.algebricks.core.algebra.typing.OpRefTypeEnvPointer in project asterixdb by apache.
the class AbstractLogicalOperator method createPropagatingAllInputsTypeEnvironment.
protected PropagatingTypeEnvironment createPropagatingAllInputsTypeEnvironment(ITypingContext ctx) {
int n = inputs.size();
ITypeEnvPointer[] envPointers = new ITypeEnvPointer[n];
for (int i = 0; i < n; i++) {
envPointers[i] = new OpRefTypeEnvPointer(inputs.get(i), ctx);
}
return new PropagatingTypeEnvironment(ctx.getExpressionTypeComputer(), ctx.getMissableTypeComputer(), ctx.getMetadataProvider(), TypePropagationPolicy.ALL, envPointers);
}
use of org.apache.hyracks.algebricks.core.algebra.typing.OpRefTypeEnvPointer in project asterixdb by apache.
the class SinkOperator method computeOutputTypeEnvironment.
@Override
public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
ITypeEnvPointer[] envPointers = new ITypeEnvPointer[inputs.size()];
for (int i = 0; i < inputs.size(); i++) {
envPointers[i] = new OpRefTypeEnvPointer(inputs.get(i), ctx);
}
PropagatingTypeEnvironment env = new PropagatingTypeEnvironment(ctx.getExpressionTypeComputer(), ctx.getMissableTypeComputer(), ctx.getMetadataProvider(), TypePropagationPolicy.ALL, envPointers);
return env;
}
use of org.apache.hyracks.algebricks.core.algebra.typing.OpRefTypeEnvPointer in project asterixdb by apache.
the class SubplanOperator method computeOutputTypeEnvironment.
@Override
public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
int n = 0;
for (ILogicalPlan p : nestedPlans) {
n += p.getRoots().size();
}
ITypeEnvPointer[] envPointers = new ITypeEnvPointer[n + 1];
envPointers[0] = new OpRefTypeEnvPointer(inputs.get(0), ctx);
int i = 1;
for (ILogicalPlan p : nestedPlans) {
for (Mutable<ILogicalOperator> r : p.getRoots()) {
envPointers[i] = new OpRefTypeEnvPointer(r, ctx);
i++;
}
}
return new PropagatingTypeEnvironment(ctx.getExpressionTypeComputer(), ctx.getMissableTypeComputer(), ctx.getMetadataProvider(), TypePropagationPolicy.ALL, envPointers);
}
use of org.apache.hyracks.algebricks.core.algebra.typing.OpRefTypeEnvPointer in project asterixdb by apache.
the class LeftOuterJoinOperator method computeOutputTypeEnvironment.
@Override
public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
int n = inputs.size();
ITypeEnvPointer[] envPointers = new ITypeEnvPointer[n];
for (int i = 0; i < n; i++) {
envPointers[i] = new OpRefTypeEnvPointer(inputs.get(i), ctx);
}
PropagatingTypeEnvironment env = new PropagatingTypeEnvironment(ctx.getExpressionTypeComputer(), ctx.getMissableTypeComputer(), ctx.getMetadataProvider(), TypePropagationPolicy.LEFT_OUTER, envPointers);
List<LogicalVariable> liveVars = new ArrayList<LogicalVariable>();
// live variables from outer branch can be null together
VariableUtilities.getLiveVariables(inputs.get(1).getValue(), liveVars);
env.getCorrelatedMissableVariableLists().add(liveVars);
return env;
}
use of org.apache.hyracks.algebricks.core.algebra.typing.OpRefTypeEnvPointer in project asterixdb by apache.
the class GroupByOperator method computeOutputTypeEnvironment.
@Override
public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
int n = 0;
for (ILogicalPlan p : nestedPlans) {
n += p.getRoots().size();
}
ITypeEnvPointer[] envPointers = new ITypeEnvPointer[n];
int i = 0;
for (ILogicalPlan p : nestedPlans) {
for (Mutable<ILogicalOperator> r : p.getRoots()) {
envPointers[i] = new OpRefTypeEnvPointer(r, ctx);
i++;
}
}
IVariableTypeEnvironment env = new PropagatingTypeEnvironment(ctx.getExpressionTypeComputer(), ctx.getMissableTypeComputer(), ctx.getMetadataProvider(), TypePropagationPolicy.ALL, envPointers);
ILogicalOperator child = inputs.get(0).getValue();
IVariableTypeEnvironment env2 = ctx.getOutputTypeEnvironment(child);
for (Pair<LogicalVariable, Mutable<ILogicalExpression>> p : getGroupByList()) {
ILogicalExpression expr = p.second.getValue();
if (p.first != null) {
env.setVarType(p.first, env2.getType(expr));
if (expr.getExpressionTag() == LogicalExpressionTag.VARIABLE) {
LogicalVariable v1 = ((VariableReferenceExpression) expr).getVariableReference();
env.setVarType(v1, env2.getVarType(v1));
}
} else {
VariableReferenceExpression vre = (VariableReferenceExpression) p.second.getValue();
LogicalVariable v2 = vre.getVariableReference();
env.setVarType(v2, env2.getVarType(v2));
}
}
for (Pair<LogicalVariable, Mutable<ILogicalExpression>> p : getDecorList()) {
ILogicalExpression expr = p.second.getValue();
if (p.first != null) {
env.setVarType(p.first, env2.getType(expr));
} else {
VariableReferenceExpression vre = (VariableReferenceExpression) p.second.getValue();
LogicalVariable v2 = vre.getVariableReference();
env.setVarType(v2, env2.getVarType(v2));
}
}
return env;
}
Aggregations