anchor.diff:          S?SQL_SELECT.'WHERE'
       ).
   
  +less_than_or_equal_to_filters_are_eliminated_when_equality_filter_value_is_equal_test() ->
  +    DDL = get_ddl(
  +        "CREATE TABLE table1("
  +        "a TIMESTAMP NOT NULL, "
  +        "b SINT64 NOT NULL, "
  +        "PRIMARY KEY ((a),a))"),
  +    {ok, Q} = get_query(
  +        "SELECT * FROM table1 "
  +        "WHERE a = 5 AND b = 8 AND b <= 8"),
  +    {ok, [S|_]} = compile(DDL, Q),
  +    ?assertPropsEqual(
  +        [{startkey,[{<<"a">>,timestamp,5}]},
  +         {endkey,  [{<<"a">>,timestamp,5}]},
  +         {filter, {'=',{field,<<"b">>,sint64},{const,8}}},
  +         {end_inclusive,true}],
  +        S?SQL_SELECT.'WHERE'
  +    ).
  +
  +less_than_or_equal_to_filters_are_eliminated_when_equality_filter_value_is_equal_swap_filter_order_test() ->
  +    DDL = get_ddl(
  +        "CREATE TABLE table1("
  +        "a TIMESTAMP NOT NULL, "
  +        "b SINT64 NOT NULL, "
  +        "PRIMARY KEY ((a),a))"),
  +    {ok, Q} = get_query(
  +        "SELECT * FROM table1 "
  +        "WHERE a = 5 AND b <= 8 AND b = 8"),
  +    {ok, [S|_]} = compile(DDL, Q),
  +    ?assertPropsEqual(
  +        [{startkey,[{<<"a">>,timestamp,5}]},
  +         {endkey,  [{<<"a">>,timestamp,5}]},
  +         {filter, {'=',{field,<<"b">>,sint64},{const,8}}},
  +         {end_inclusive,true}],
  +        S?SQL_SELECT.'WHERE'
  +    ).
  +
  +less_than_or_equal_to_filters_are_eliminated_when_equality_filter_value_is_greater_test() ->
  +    DDL = get_ddl(
  +        "CREATE TABLE table1("
  +        "a TIMESTAMP NOT NULL, "
  +        "b SINT64 NOT NULL, "
  +        "PRIMARY KEY ((a),a))"),
  +    {ok, Q} = get_query(
  +        "SELECT * FROM table1 "
  +        "WHERE a = 5 AND b = 8 AND b <= 9"),
  +    {ok, [S|_]} = compile(DDL, Q),
  +    ?assertPropsEqual(
  +        [{startkey,[{<<"a">>,timestamp,5}]},
  +         {endkey,  [{<<"a">>,timestamp,5}]},
  +         {filter, {'=',{field,<<"b">>,sint64},{const,8}}},
  +         {end_inclusive,true}],
  +        S?SQL_SELECT.'WHERE'
  +    ).
  +
   less_than_or_equal_to_on_column_in_local_key_is_added_to_endkey_test() ->
       DDL = get_ddl(
           "CREATE TABLE table1("
  
positive.code:         S?SQL_SELECT.'WHERE'
      ).
  
  -endif.
  
negative.code:             %% includes it so we can safely eliminate this one.
              {eliminate, Acc}
      end;
  check_where_clause_is_possible_fold(_, _, {'<=',{field,FieldName,_},{const,LteVal}} = F, Acc) ->
      case find_filter_check(FieldName, Acc) of
          #filtercheck{'<=' = F} ->
              {eliminate, Acc};
          #filtercheck{'=' = {_,_,{const,EqVal}}} when LteVal >= EqVal ->
              %% query like `a = 10 AND a <= 10` the less than or equals can be
              %% eliminated because it is already captured in the equality filter
              {eliminate, Acc};
          #filtercheck{'<=' = undefined} = Check1 ->
              %% this is the first less than check so just record it
  