Detect and merge duplicate predicates 'AND(x, y, x)' to 'AND(x, y)' in more circumstances

Make flattenAnd and flattenOr more efficient on empty lists.
[CALCITE-448] FilterIntoJoinRule creates filters containing invalid RexInputRef

Refactor FilterJoinRule so you can supply a predicate rather than sub-classing.