anchor.diff:              {Position, Type}
       end.
   
  -expand_where(Where, #key_v1{ast = PAST}, MaxSubQueries) ->
  +%%
  +-spec expand_where(filter(), #key_v1{}, integer()) ->
  +        [where_props()] | {error, any()}.
  +expand_where(Where, PartitionKey, MaxSubQueries) ->
  +    case find_quanta_function_in_key(PartitionKey) of
  +        [{[QField], QSize, QUnit}] ->
  +            hash_timestamp_to_quanta(QField, QSize, QUnit, MaxSubQueries, Where);
  +        [] ->
  +            [Where]
  +    end.
  +
  +%%
  +find_quanta_function_in_key(#key_v1{ ast = PKAST }) ->
  +    [{X, Y, Z} || #hash_fn_v1{mod = riak_ql_quanta, fn = quantum,
  +                              args = [#param_v1{name = X}, Y, Z]} <- PKAST].
  +
  +%%
  +hash_timestamp_to_quanta(QField, QSize, QUnit, MaxSubQueries, Where) ->
       GetMaxMinFun = fun({startkey, List}, {_S, E}) ->
                              {element(3, lists:last(List)), E};
                         ({endkey,   List}, {S, _E}) ->
  
positive.code:     end.
  
  %% find the upper and lower bound for the time
  find_timestamp_bounds(QuantumField, LocalFields) when is_binary(QuantumField) ->
      find_timestamp_bounds2(QuantumField, LocalFields, [], {undefined, undefined}).
  
  %%
  
negative.code:         #key_v1{ast = PartitionKeyAST} = PK,
          PartitionFields = [X || #param_v1{name = X} <- PartitionKeyAST],
      	LK = LK0#key_v1{ast = lists:sublist(LK0#key_v1.ast, length(PartitionKeyAST))},
          QuantumFieldName = quantum_field_name(DDL),
          StrippedW = strip(W, []),
          {StartW, EndW, Filter} = 
              break_out_timeseries(StrippedW, PartitionFields, QuantumFieldName),
          Mod = riak_ql_ddl:make_module_name(T),
          StartKey = rewrite(LK, StartW, Mod),
          EndKey = rewrite(LK, EndW, Mod),
  