"SELECT c1,c2 WHERE (NOT ((c1 < c2) OR (NOT (c3 < " +
"c4))) AND (NOT ((NOT (NOT (c5 < c6))) OR (c7 < c8))) AND " +
"((c9 < c10) AND ((c11 < c12) OR ((c13 < c14) AND (c15 < c16)))))");
QueryFilter filter = query.getFilter();
assertTrue(filter instanceof CompoundFilter);
CompoundFilter f = (CompoundFilter) filter;
assertEquals(CompoundFilter.LogicalOperator.AND, f.getOperator());
List<QueryFilter> subFilters = f.getSubFilters();
assertEquals(3, subFilters.size());
QueryFilter f1 = subFilters.get(0);
QueryFilter f2 = subFilters.get(1);
QueryFilter f3 = subFilters.get(2);
// f1: (!((c1 < c2) || (!(c3 < c4)))
assertTrue(f1 instanceof NegationFilter);
NegationFilter nf = (NegationFilter) f1;
QueryFilter subFilter = nf.getSubFilter();
assertTrue(subFilter instanceof CompoundFilter);
CompoundFilter cf = (CompoundFilter) subFilter;
assertEquals(CompoundFilter.LogicalOperator.OR, cf.getOperator());
subFilters = cf.getSubFilters();
assertEquals(2, subFilters.size());
assertTrue(subFilters.get(0) instanceof ColumnColumnFilter);
assertEquals(Sets.newHashSet("c1", "c2"),
subFilters.get(0).getAllColumnIds());
assertTrue(subFilters.get(1) instanceof NegationFilter);
nf = (NegationFilter) subFilters.get(1);
assertTrue(nf.getSubFilter() instanceof ColumnColumnFilter);
assertEquals(Sets.newHashSet("c3", "c4"),
nf.getSubFilter().getAllColumnIds());
//f2: (!((!(!(c5 < c6))) || (c7 < c8)))
assertTrue(f2 instanceof NegationFilter);
nf = (NegationFilter) f2;
assertTrue(nf.getSubFilter() instanceof CompoundFilter);
cf = (CompoundFilter) nf.getSubFilter();
assertEquals(CompoundFilter.LogicalOperator.OR, cf.getOperator());
subFilters = cf.getSubFilters();
assertEquals(2, subFilters.size());
assertTrue(subFilters.get(0) instanceof NegationFilter);
assertTrue(subFilters.get(1) instanceof ColumnColumnFilter);
assertEquals(Sets.newHashSet("c7", "c8"),
subFilters.get(1).getAllColumnIds());
nf = (NegationFilter) subFilters.get(0);
assertTrue(nf.getSubFilter() instanceof NegationFilter);
nf = (NegationFilter) nf.getSubFilter();
assertTrue(nf.getSubFilter() instanceof ColumnColumnFilter);
assertEquals(Sets.newHashSet("c5", "c6"),
nf.getSubFilter().getAllColumnIds());
//f3: ((c9 < c10) && ((c11 < c12)||((c13 < c14)&&(c15 < c16))))
assertTrue(f3 instanceof CompoundFilter);
cf = (CompoundFilter) f3;
assertEquals(CompoundFilter.LogicalOperator.AND, cf.getOperator());
subFilters = cf.getSubFilters();
assertEquals(2, subFilters.size());
assertTrue(subFilters.get(0) instanceof ColumnColumnFilter);
assertEquals(Sets.newHashSet("c9", "c10"),
subFilters.get(0).getAllColumnIds());
assertTrue(subFilters.get(1) instanceof CompoundFilter);
cf = (CompoundFilter) subFilters.get(1);
assertEquals(CompoundFilter.LogicalOperator.OR, cf.getOperator());
subFilters = cf.getSubFilters();
assertEquals(2, subFilters.size());
assertTrue(subFilters.get(0) instanceof ColumnColumnFilter);
assertEquals(Sets.newHashSet("c11", "c12"),
subFilters.get(0).getAllColumnIds());
assertTrue(subFilters.get(1) instanceof CompoundFilter);
cf = (CompoundFilter) subFilters.get(1);
subFilters = cf.getSubFilters();
assertEquals(2, subFilters.size());
assertTrue(subFilters.get(0) instanceof ColumnColumnFilter);
assertTrue(subFilters.get(1) instanceof ColumnColumnFilter);
assertEquals(Sets.newHashSet("c13", "c14"),
subFilters.get(0).getAllColumnIds());