use of org.apache.hyracks.algebricks.core.algebra.typing.NonPropagatingTypeEnvironment in project asterixdb by apache.
the class UnionAllOperator method computeOutputTypeEnvironment.
@Override
public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
IVariableTypeEnvironment env = new NonPropagatingTypeEnvironment(ctx.getExpressionTypeComputer(), ctx.getMetadataProvider());
IVariableTypeEnvironment envLeft = ctx.getOutputTypeEnvironment(inputs.get(0).getValue());
IVariableTypeEnvironment envRight = ctx.getOutputTypeEnvironment(inputs.get(1).getValue());
if (envLeft == null) {
throw new AlgebricksException("Left input types for union operator are not computed.");
}
for (Triple<LogicalVariable, LogicalVariable, LogicalVariable> t : varMap) {
Object typeFromLeft = getType(envLeft, t.first);
Object typeFromRight = getType(envRight, t.second);
if (typeFromLeft.equals(typeFromRight)) {
env.setVarType(t.third, typeFromLeft);
} else {
env.setVarType(t.third, ctx.getConflictingTypeResolver().resolve(typeFromLeft, typeFromRight));
}
}
return env;
}
use of org.apache.hyracks.algebricks.core.algebra.typing.NonPropagatingTypeEnvironment in project asterixdb by apache.
the class UnnestMapOperator method computeOutputTypeEnvironment.
// When propagateInput is true,
// this operator propagates all input variables.
@Override
public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
IVariableTypeEnvironment env = null;
if (propagateInput) {
env = createPropagatingAllInputsTypeEnvironment(ctx);
} else {
env = new NonPropagatingTypeEnvironment(ctx.getExpressionTypeComputer(), ctx.getMetadataProvider());
}
int n = variables.size();
for (int i = 0; i < n; i++) {
env.setVarType(variables.get(i), variableTypes.get(i));
}
return env;
}
use of org.apache.hyracks.algebricks.core.algebra.typing.NonPropagatingTypeEnvironment in project asterixdb by apache.
the class IntersectOperator method computeOutputTypeEnvironment.
@Override
public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
IVariableTypeEnvironment typeEnv = ctx.getOutputTypeEnvironment(inputs.get(0).getValue());
for (int i = 1; i < inputs.size(); i++) {
checkTypeConsistency(typeEnv, inputVars.get(0), ctx.getOutputTypeEnvironment(inputs.get(i).getValue()), inputVars.get(i));
}
IVariableTypeEnvironment env = new NonPropagatingTypeEnvironment(ctx.getExpressionTypeComputer(), ctx.getMetadataProvider());
for (int i = 0; i < outputVars.size(); i++) {
env.setVarType(outputVars.get(i), typeEnv.getVarType(inputVars.get(0).get(i)));
}
return typeEnv;
}
use of org.apache.hyracks.algebricks.core.algebra.typing.NonPropagatingTypeEnvironment in project asterixdb by apache.
the class AggregateOperator method computeOutputTypeEnvironment.
@Override
public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
IVariableTypeEnvironment env = new NonPropagatingTypeEnvironment(ctx.getExpressionTypeComputer(), ctx.getMetadataProvider());
IVariableTypeEnvironment env2 = ctx.getOutputTypeEnvironment(inputs.get(0).getValue());
int n = variables.size();
for (int i = 0; i < n; i++) {
Object t = ctx.getExpressionTypeComputer().getType(expressions.get(i).getValue(), ctx.getMetadataProvider(), env2);
env.setVarType(variables.get(i), t);
}
return env;
}
Aggregations