use of org.apache.hyracks.algebricks.core.algebra.typing.PropagatingTypeEnvironment 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.PropagatingTypeEnvironment in project asterixdb by apache.
the class AssignOperator method computeOutputTypeEnvironment.
@Override
public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
PropagatingTypeEnvironment env = createPropagatingAllInputsTypeEnvironment(ctx);
int n = variables.size();
for (int i = 0; i < n; i++) {
env.setVarType(variables.get(i), ctx.getExpressionTypeComputer().getType(expressions.get(i).getValue(), ctx.getMetadataProvider(), env));
if (expressions.get(i).getValue().getExpressionTag() == LogicalExpressionTag.VARIABLE) {
LogicalVariable var = ((VariableReferenceExpression) expressions.get(i).getValue()).getVariableReference();
for (List<LogicalVariable> list : env.getCorrelatedMissableVariableLists()) {
if (list.contains(var)) {
list.add(variables.get(i));
}
}
}
}
return env;
}
use of org.apache.hyracks.algebricks.core.algebra.typing.PropagatingTypeEnvironment 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.PropagatingTypeEnvironment 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.PropagatingTypeEnvironment 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;
}
Aggregations