anchor.diff:  modify_where_key(TupleList, Field, NewVal) ->
       {Field, FieldType, _OldVal} = lists:keyfind(Field, 1, TupleList),
       lists:keyreplace(Field, 1, TupleList, {Field, FieldType, NewVal}).
  +
  +%% pull out equality filters on the parititon key, these need to be made into multiple
  +%% sub queries rather than a filter
  +hoist_partition_key_equality_filters(PartitionKeyNames, WhereAST) ->
  +    riak_ql_ddl:mapfold_where_tree(
  +        fun (_, Op, Acc_x) when Op == and_; Op == or_ ->
  +                {ok, Acc_x};
  +            (or_ = Root, {'=',A,_} = Filter, Acc_x) ->
  +                ?debugFmt("ZZZ ROOT ~w FILTER ~w",[Root,Filter]),
  +                case lists:member(A, PartitionKeyNames) of
  +                    true  ->
  +                        KeyFilters = proplists:get_value(A,Acc_x,[]),
  +                        Acc_x2 = lists:keystore(A,1,Acc_x,{A,[Filter|KeyFilters]}),
  +                        {eliminate,Acc_x2};
  +                    false -> {Filter, Acc_x}
  +                end;
  +            (Root, Filter, Acc_x) ->
  +                ?debugFmt("ROOT ~w FILTER ~w",[Root,Filter]),
  +                {Filter, Acc_x}
  +        end, [], WhereAST).
   
   resolve_expressions(Mod, Options, WhereAST) ->
       Acc = acc, %% not used
  
positive.code: non_unique_identifiers(FF) ->
      Occurrences = [{F, occurs(F, FF)} || {F, _, _} <- FF],
      [F || {F, N} <- Occurrences, N > 1].
  occurs(F, FF) ->
      lists:foldl(
        fun({A, _, _}, N) when A == F -> N + 1;
  
negative.code:         is_query_valid(DDL, Q)
      ).
  
  select_multi_values_in_partition_key_test() ->
      DDL = get_ddl(
          "CREATE table table1 ("
          "a SINT64 NOT NULL,"
          "PRIMARY KEY ((a), a));"
      ),
      {ok, Q} = get_query(
          "SELECT * FROM table1 "
          "WHERE (a = 1 OR a = 2);"),
      {ok, SubQueries} = compile(DDL, Q),
      ?assertEqual(
          [[{startkey,[{<<"a">>,sint64,1}]},
            {endkey,  [{<<"a">>,sint64,1}]},
            {filter, []},
            {end_inclusive, true}],
           [{startkey,[{<<"a">>,sint64,2}]},
            {endkey,  [{<<"a">>,sint64,2}]},
            {filter, []},
            {end_inclusive, true}]],
          lists:sort([W || ?SQL_SELECT{'WHERE' = W} <- SubQueries])
      ).
  
  hoist_partition_key_equality_filters_test() ->
      {ok, ?SQL_SELECT{'WHERE' = Where}} = get_query(
          "SELECT * FROM table1 "
          "WHERE b = 20 AND (a = 1 OR a = 2);"),
      ?assertEqual(
          {{'=',<<"b">>,{integer,20}}, [{<<"a">>,[{'=',<<"a">>,{integer,2}},{'=',<<"a">>,{integer,1}}]}]},
          hoist_partition_key_equality_filters([<<"a">>,<<"b">>], Where)
      ).
  
  -endif.
  