List<Pair<Expression, Expression>> compiled = new ArrayList<Pair<Expression, Expression>>(onConditions.size());
context.setResolver(leftResolver);
ExpressionCompiler expressionCompiler = new ExpressionCompiler(context);
for (ParseNode condition : onConditions) {
assert (condition instanceof EqualParseNode);
EqualParseNode equalNode = (EqualParseNode) condition;
expressionCompiler.reset();
Expression left = equalNode.getLHS().accept(expressionCompiler);
compiled.add(new Pair<Expression, Expression>(left, null));
}
context.setResolver(rightResolver);
expressionCompiler = new ExpressionCompiler(context);
Iterator<Pair<Expression, Expression>> iter = compiled.iterator();
for (ParseNode condition : onConditions) {
Pair<Expression, Expression> p = iter.next();
EqualParseNode equalNode = (EqualParseNode) condition;
expressionCompiler.reset();
Expression right = equalNode.getRHS().accept(expressionCompiler);
Expression left = p.getFirst();
PDataType toType = getCommonType(left.getDataType(), right.getDataType());
if (left.getDataType() != toType) {
left = CoerceExpression.create(left, toType);
p.setFirst(left);