assertEquals("and equal project constant constant ", v.getVisitPlan());
}
@Test
public void testExpressionEquality() throws FrontendException {
LogicalExpressionPlan ep1 = new LogicalExpressionPlan();
ConstantExpression c1 = new ConstantExpression(ep1, new Integer(5), new LogicalFieldSchema(null, null, DataType.INTEGER));
ProjectExpression p1 = new ProjectExpression(ep1, 0, 0, null);
EqualExpression e1 = new EqualExpression(ep1, p1, c1);
ConstantExpression ca1 = new ConstantExpression(ep1, new Boolean("true"), new LogicalFieldSchema(null, null, DataType.BOOLEAN));
AndExpression a1 = new AndExpression(ep1, e1, ca1);
LogicalExpressionPlan ep2 = new LogicalExpressionPlan();
ConstantExpression c2 = new ConstantExpression(ep2, new Integer(5), new LogicalFieldSchema(null, null, DataType.INTEGER));
ProjectExpression p2 = new ProjectExpression(ep2, 0, 0, null);
EqualExpression e2 = new EqualExpression(ep2, p2, c2);
ConstantExpression ca2 = new ConstantExpression(ep2, new Boolean("true"), new LogicalFieldSchema(null, null, DataType.BOOLEAN));
AndExpression a2 = new AndExpression(ep2, e2, ca2);
assertTrue(ep1.isEqual(ep2));
assertTrue(c1.isEqual(c2));
assertTrue(p1.isEqual(p2));
assertTrue(e1.isEqual(e2));
assertTrue(ca1.isEqual(ca2));
assertTrue(a1.isEqual(a2));
LogicalExpressionPlan ep3 = new LogicalExpressionPlan();
ConstantExpression c3 = new ConstantExpression(ep3, new Integer(3), new LogicalFieldSchema(null, null, DataType.INTEGER));
ProjectExpression p3 = new ProjectExpression(ep3, 0, 1, null);
EqualExpression e3 = new EqualExpression(ep3, p3, c3);
ConstantExpression ca3 = new ConstantExpression(ep3, "true", new LogicalFieldSchema(null, null, DataType.CHARARRAY));
AndExpression a3 = new AndExpression(ep3, e3, ca3);
assertFalse(ep1.isEqual(ep3));
assertFalse(c1.isEqual(c3));
assertFalse(p1.isEqual(p3));
assertFalse(e1.isEqual(e3));
assertFalse(ca1.isEqual(ca3));
assertFalse(a1.isEqual(a3));
LogicalExpressionPlan ep4 = new LogicalExpressionPlan();
ProjectExpression p4 = new ProjectExpression(ep4, 1, 0, null);
assertFalse(ep1.isEqual(ep4));
assertFalse(p1.isEqual(p4));
}