anchor.diff:          %% Now that the equality filters under OR for parition key fileds has been
           %% filtered out, we put a dummy value in there, so that the rest of the type
           %% checking passes
  -        %?debugFmt(">>> WHERE ~w ORFILTERS ~w",[Where2,OrFilters]),
  +        % ?debugFmt(">>> WHERE ~w ORFILTERS ~w",[Where2,OrFilters]),
           W4 = lists:foldl(
               fun({FieldName,_},Acc) ->
                   Value = temp_column_value(Mod:get_field_type([FieldName])),
  
positive.code:         throw:Error when element(1,Error) == error -> Error
      end.
  
  temp_column_value(boolean)  -> {boolean, false};
  temp_column_value(float)  -> {float, 0.30303030303};
  temp_column_value(sint64)  -> {sint64, 30303030303};
  temp_column_value(timestamp)  -> {timestamp, 30303030303};
  temp_column_value(varchar) -> {varchar, <<"X-TEMP">>}.
  
  %% now break out the query on quantum boundaries
  
negative.code:             {error, E};
          {ok, Where2} ->
              IsDescending = is_last_partition_column_descending(Mod:field_orders(), PK),
              Where3 = expand_sub_queries(OrFilters, Where2),
              SubQueries1 =
                  [Q1?SQL_SELECT{
                         is_executable = true,
                         type          = timeseries,
                         'WHERE'       = maybe_fix_start_order(IsDescending, X),
                         local_key     = LK,
                         partition_key = PK} || X <- Where3],
              SubQueries2 =
                  case IsDescending of
                      true ->
                          fix_subquery_order(SubQueries1);
                      false ->
                          SubQueries1
                  end,
              {ok, SubQueries2}
      end.
  
  expand_sub_queries([], SubQueries) ->
      SubQueries;
  expand_sub_queries(OrFilters1, SubQueries) ->
      Keys = key_permuations([F || {_,F} <- OrFilters1]),
      % ?debugFmt("OR FILTERS ~p",[OrFilters1]),
      [modify_sub_query_where_range_keys(K,Q) || K <- Keys, Q <- SubQueries].
  
  key_permuations([]) ->
      [];
  key_permuations([H|T]) ->
      [lists:reverse(Y) || Y <- key_permuations2([[X] || X <- H], T)].
  
  key_permuations2(Acc, []) ->
      Acc;
  key_permuations2(Acc1, [H|Tail]) ->
      Acc2 = [[B|A] || A <- Acc1, B <- H],
      key_permuations2(Acc2, Tail).
  
  
  modify_sub_query_where_range_keys(Keys,WhereX) ->
      lists:foldl(
          fun({'=',FieldName,{_,Value}},Where1) ->
              % ?debugFmt("EQ ~p = ~p",[FieldName,Value]),
              SKey1 = modify_where_key(proplists:get_value(startkey, Where1), FieldName, Value),
              EKey1 = modify_where_key(proplists:get_value(endkey, Where1), FieldName, Value),
              % ?debugFmt("SKey1 ~p",[SKey1]),
              Where2 = lists:keystore(startkey,1,Where1,{startkey,SKey1}),
              Where3 = lists:keystore(endkey, 1, Where2,  {endkey,EKey1}),
              % ?debugFmt("WHERE ~p",[Where3]),
              Where3
          end, WhereX, Keys).
  
  
  %% Only check the last column in the partition key, otherwise the start/end key
  %% does not need to be flipped. The data is not stored in a different order to
  