@Test public void testFindMustEqualColsAndValues() { TableDesc tbl = TableDesc.mockup("mockup_table"); TblColRef colA = TblColRef.mockup(tbl, 0, "A", "bigint"); TblColRef colB = TblColRef.mockup(tbl, 1, "B", "char(256)"); Set<TblColRef> cols = Sets.newHashSet(colA, colB); { TupleFilter f = compare(colA, FilterOperatorEnum.EQ, "1234"); Assert.assertEquals(map(colA, "1234"), f.findMustEqualColsAndValues(cols)); } { TupleFilter f = compare(colA, FilterOperatorEnum.ISNULL); Assert.assertEquals(map(colA, null), f.findMustEqualColsAndValues(cols)); } { TupleFilter f = and(compare(colA, FilterOperatorEnum.ISNULL), compare(colB, FilterOperatorEnum.EQ, "1234")); Assert.assertEquals(map(colA, null, colB, "1234"), f.findMustEqualColsAndValues(cols)); Assert.assertTrue(not(f).findMustEqualColsAndValues(cols).isEmpty()); } { TupleFilter f = compare(colA, FilterOperatorEnum.LT, "1234"); Assert.assertTrue(f.findMustEqualColsAndValues(cols).isEmpty()); } }
public HashMap<TblColRef, Object> findMustEqualColsAndValues(Collection<TblColRef> lookingForCols) { HashMap<TblColRef, Object> result = new HashMap<>(); findMustEqualColsAndValues(this, lookingForCols, result); return result; }
TupleFilter { public HashMap<TblColRef, Object> findMustEqualColsAndValues(Collection<TblColRef> lookingForCols) { HashMap<TblColRef, Object> result = new HashMap<>(); findMustEqualColsAndValues(this, lookingForCols, result); return result; } }
TupleFilter { public HashMap<TblColRef, Object> findMustEqualColsAndValues(Collection<TblColRef> lookingForCols) { HashMap<TblColRef, Object> result = new HashMap<>(); findMustEqualColsAndValues(this, lookingForCols, result); return result; } protected  TupleFilter(List<TupleFilter> filters, FilterOperatorEnum op); }
TupleFilter { public HashMap<TblColRef, Object> findMustEqualColsAndValues(Collection<TblColRef> lookingForCols) { HashMap<TblColRef, Object> result = new HashMap<>(); findMustEqualColsAndValues(this, lookingForCols, result); return result; } protected  TupleFilter(List<TupleFilter> filters, FilterOperatorEnum op); static CompareTupleFilter compare(TblColRef col, FilterOperatorEnum op); static CompareTupleFilter compare(TblColRef col, FilterOperatorEnum op, Object val); static LogicalTupleFilter and(TupleFilter... children); static LogicalTupleFilter or(TupleFilter... children); static LogicalTupleFilter not(TupleFilter child); void addChild(TupleFilter child); final void addChildren(List<? extends TupleFilter> children); final void addChildren(TupleFilter... children); List<? extends TupleFilter> getChildren(); boolean hasChildren(); FilterOperatorEnum getOperator(); TupleFilter copy(); TupleFilter reverse(); TupleFilter removeNot(); TupleFilter flatFilter(); TupleFilter flatFilter(int maxFlatChildrenSize); HashMap<TblColRef, Object> findMustEqualColsAndValues(Collection<TblColRef> lookingForCols); Set<CompareTupleFilter> findMustTrueCompareFilters(); abstract boolean isEvaluable(); abstract boolean evaluate(IEvaluatableTuple tuple, IFilterCodeSystem<?> cs); abstract Collection<?> getValues(); abstract void serialize(IFilterCodeSystem<?> cs, ByteBuffer buffer); abstract void deserialize(IFilterCodeSystem<?> cs, ByteBuffer buffer); static boolean isEvaluableRecursively(TupleFilter filter); static void collectColumns(TupleFilter filter, Set<TblColRef> collector); }
TupleFilter { public HashMap<TblColRef, Object> findMustEqualColsAndValues(Collection<TblColRef> lookingForCols) { HashMap<TblColRef, Object> result = new HashMap<>(); findMustEqualColsAndValues(this, lookingForCols, result); return result; } protected  TupleFilter(List<TupleFilter> filters, FilterOperatorEnum op); static CompareTupleFilter compare(TblColRef col, FilterOperatorEnum op); static CompareTupleFilter compare(TblColRef col, FilterOperatorEnum op, Object val); static LogicalTupleFilter and(TupleFilter... children); static LogicalTupleFilter or(TupleFilter... children); static LogicalTupleFilter not(TupleFilter child); void addChild(TupleFilter child); final void addChildren(List<? extends TupleFilter> children); final void addChildren(TupleFilter... children); List<? extends TupleFilter> getChildren(); boolean hasChildren(); FilterOperatorEnum getOperator(); TupleFilter copy(); TupleFilter reverse(); TupleFilter removeNot(); TupleFilter flatFilter(); TupleFilter flatFilter(int maxFlatChildrenSize); HashMap<TblColRef, Object> findMustEqualColsAndValues(Collection<TblColRef> lookingForCols); Set<CompareTupleFilter> findMustTrueCompareFilters(); abstract boolean isEvaluable(); abstract boolean evaluate(IEvaluatableTuple tuple, IFilterCodeSystem<?> cs); abstract Collection<?> getValues(); abstract void serialize(IFilterCodeSystem<?> cs, ByteBuffer buffer); abstract void deserialize(IFilterCodeSystem<?> cs, ByteBuffer buffer); static boolean isEvaluableRecursively(TupleFilter filter); static void collectColumns(TupleFilter filter, Set<TblColRef> collector); static final int BUFFER_SIZE; }