anchor.diff:          compile(DDL, Q)
       ).
   
  +greater_than_or_equal_to_that_is_less_than_previous_greater_than_clause_removes_greater_than_clause_test() ->
  +    DDL = get_ddl(
  +        "CREATE TABLE table1("
  +        "a TIMESTAMP NOT NULL, "
  +        "b SINT64 NOT NULL, "
  +        "PRIMARY KEY ((a),a,b))"),
  +    {ok, Q} = get_query(
  +        "SELECT * FROM table1 "
  +        "WHERE a = 5 AND b > 10 AND b >= 10"),
  +    {ok, [S|_]} = compile(DDL, Q),
  +    ?assertPropsEqual(
  +        [{startkey,[{<<"a">>,timestamp,5}]},
  +         {endkey,  [{<<"a">>,timestamp,5}]},
  +         {filter, {'>=',{field,<<"b">>,sint64},{const, 10}}},
  +         {end_inclusive,true}],
  +        S?SQL_SELECT.'WHERE'
  +    ).
  +
  +greater_than_or_equal_to_that_is_less_than_previous_greater_than_clause_removes_greater_than_clause_swap_lhs_rhs_test() ->
  +    DDL = get_ddl(
  +        "CREATE TABLE table1("
  +        "a TIMESTAMP NOT NULL, "
  +        "b SINT64 NOT NULL, "
  +        "PRIMARY KEY ((a),a,b))"),
  +    {ok, Q} = get_query(
  +        "SELECT * FROM table1 "
  +        "WHERE a = 5 AND b >= 10 AND b > 10"),
  +    {ok, [S|_]} = compile(DDL, Q),
  +    ?assertPropsEqual(
  +        [{startkey,[{<<"a">>,timestamp,5}]},
  +         {endkey,  [{<<"a">>,timestamp,5}]},
  +         {filter, {'>=',{field,<<"b">>,sint64},{const, 10}}},
  +         {end_inclusive,true}],
  +        S?SQL_SELECT.'WHERE'
  +    ).
  +
   -endif.
  
positive.code: append_to_eliminate_later(Filter, Acc) ->
      ElimLater = proplists:get_value(eliminate_later, Acc),
      lists:keystore(eliminate_later, 1, Acc, {eliminate_later, [Filter|ElimLater]}).
  
  %% TODO put this in the table helper module
  is_field_nullable(FieldName, ?DDL{fields = Fields}) when is_binary(FieldName)->
  
negative.code:             %% query like `a = 10 AND a > 8` we can eliminate the greater than
              %% clause because if a to be 10 it must also be greater than 8
              {eliminate, Acc};
          #filtercheck{'>=' = {_,_,{const,GteVal}}} when GtVal =< GteVal ->
              %% query like `a >= 10 AND a > 8` we can eliminate the greater than
              %% clause because if a to be greater than or equal to 10 it must
              %% also be greater than 8
              {eliminate, Acc};
          #filtercheck{'>' = undefined} = Check1 ->
              %% this is the first equality check so just record it
              Check2 = Check1#filtercheck{'>' = F},
  