anchor.diff:                  "WHERE time > 6000 AND time < 5000"
                   "AND user = 'user_1' AND location = 'derby'"),
       ?assertEqual(
  -       {error, {lower_bound_must_be_less_than_upper_bound, ?E_TSMSG_LOWER_BOUND_MUST_BE_LESS_THAN_UPPER_BOUND}},
  +       {error, {lower_bound_must_be_less_than_upper_bound,
  +                ?E_TSMSG_LOWER_BOUND_MUST_BE_LESS_THAN_UPPER_BOUND}},
          compile(DDL, Q, 5)
         ).
   
  
positive.code:     %% if this is an or state ment, lookahead at what is being tested, the quanta
      %% cannot be tested with an OR operator
      error({time_bounds_must_use_and_op, ?E_TIME_BOUNDS_MUST_USE_AND});
  find_timestamp_bounds2(QuantumFieldName, [{Op, QuantumFieldName, _} = Filter | Tail], OtherFilters, BoundsAcc1) ->
      %% if there are already end bounds throw an error
      if
          Op == '>' orelse Op == '>=' ->
              find_timestamp_bounds2(QuantumFieldName, Tail, OtherFilters, acc_lower_bounds(Filter, BoundsAcc1));
          Op == '<' orelse Op == '<=' ->
              find_timestamp_bounds2(QuantumFieldName, Tail, OtherFilters, acc_upper_bounds(Filter, BoundsAcc1));
          Op == '=' orelse Op == '!=' ->
              find_timestamp_bounds2(QuantumFieldName, Tail, [Filter | OtherFilters], BoundsAcc1)
      end;
  find_timestamp_bounds2(QuantumFieldName, [Filter | Tail], OtherFilters, BoundsAcc1) ->
      %% this filter is not on the quantum
  
negative.code: 
  %%
  -spec extract_stateful_functions(riak_ql_ddl:selection(), integer()) ->
          {riak_ql_ddl:selection() |
           {return_state, integer()}, [riak_ql_ddl:selection_function()]}.
  extract_stateful_functions(Selection1, FinaliserLen) when is_integer(FinaliserLen) ->
      {Selection2, Fns} = extract_stateful_functions2(Selection1, FinaliserLen, []),
      {Selection2, lists:reverse(Fns)}.
  
  %% extract stateful functions from the selection
  -spec extract_stateful_functions2(riak_ql_ddl:selection(), integer(),
                                    [riak_ql_ddl:selection_function()]) ->
          {riak_ql_ddl:selection() | {finalise_aggregation, FnName::atom(), integer()},
           [riak_ql_ddl:selection_function()]}.
  extract_stateful_functions2({Op, ArgA1, ArgB1}, FinaliserLen, Fns1) ->
      {ArgA2, Fns2} = extract_stateful_functions2(ArgA1, FinaliserLen, Fns1),
      {ArgB2, Fns3} = extract_stateful_functions2(ArgB1, FinaliserLen, Fns2),
  