/** * Keeps records if their value is not equal to the provided value. * Nulls are treated the same way the java programming language does. * <p> * For example: * notEq(column, null) will keep all records whose value is not null. * notEq(column, 7) will keep all records whose value is not 7, including records whose value is null. * * NOTE: this is different from how some query languages handle null. For example, SQL and pig will drop * nulls when you filter by not equal to 7. To achieve similar behavior in this api, do: * and(notEq(column, 7), notEq(column, null)) * * NOTE: be sure to read the {@link #lt}, {@link #ltEq}, {@link #gt}, {@link #gtEq} operator's docs * for how they handle nulls * * @param column a column reference created by FilterApi * @param value a value that matches the column's type * @param <T> the Java type of values in the column * @param <C> the column type that corresponds to values of type T * @return a not-equals predicate for the given column and value */ public static <T extends Comparable<T>, C extends Column<T> & SupportsEqNotEq> NotEq<T> notEq(C column, T value) { return new NotEq<T>(column, value); }
/** * Keeps records if their value is not equal to the provided value. * Nulls are treated the same way the java programming language does. * <p> * For example: * notEq(column, null) will keep all records whose value is not null. * notEq(column, 7) will keep all records whose value is not 7, including records whose value is null. * * NOTE: this is different from how some query languages handle null. For example, SQL and pig will drop * nulls when you filter by not equal to 7. To achieve similar behavior in this api, do: * and(notEq(column, 7), notEq(column, null)) * * NOTE: be sure to read the {@link #lt}, {@link #ltEq}, {@link #gt}, {@link #gtEq} operator's docs * for how they handle nulls * * @param column a column reference created by FilterApi * @param value a value that matches the column's type * @param <T> the Java type of values in the column * @param <C> the column type that corresponds to values of type T * @return a not-equals predicate for the given column and value */ public static <T extends Comparable<T>, C extends Column<T> & SupportsEqNotEq> NotEq<T> notEq(C column, T value) { return new NotEq<T>(column, value); }
@Override public <T extends Comparable<T>> FilterPredicate visit(Eq<T> eq) { return new NotEq<T>(eq.getColumn(), eq.getValue()); }
@Override public <T extends Comparable<T>> FilterPredicate visit(Eq<T> eq) { return new NotEq<T>(eq.getColumn(), eq.getValue()); }