anchor.diff:                   Sel).
   
   basic_select_arith_1_test() ->
  -    DDL = get_sel_ddl(),
       SQL = "SELECT 1 + 2 - 3 /4 * 5 from mytab WHERE myfamily = 'familyX' and myseries = 'seriesX' and time > 1 and time < 2",
       {ok, Rec} = get_query(SQL),
  -    {ok, Sel} = compile_select_clause(DDL, Rec),
  -    ?assertMatch(#riak_sel_clause_v1{calc_type        = rows,
  -                                     col_return_types = [
  -                                                         sint64
  -                                                        ],
  -                                     col_names        = [
  -                                                         <<"1+2-3/4*5">>
  -                                                        ]
  -                                    },
  -                 Sel).
  +    {ok, Sel} = compile_select_clause(get_sel_ddl(), Rec),
  +    ?assertMatch(
  +        #riak_sel_clause_v1{
  +            calc_type        = rows,
  +            col_return_types = [sint64],
  +            col_names        = [<<"((1+2)-((3/4)*5))">>] },
  +        Sel
  +    ).
   
   basic_select_arith_2_test() ->
  -    DDL = get_sel_ddl(),
       SQL = "SELECT 1 + 2.0 - 3 /4 * 5 from mytab WHERE myfamily = 'familyX' and myseries = 'seriesX' and time > 1 and time < 2",
       {ok, Rec} = get_query(SQL),
  -    {ok, Sel} = compile_select_clause(DDL, Rec),
  -    ?assertMatch(#riak_sel_clause_v1{calc_type        = rows,
  -                                     col_return_types = [
  -                                                         double
  -                                                        ],
  -                                     col_names        = [
  -                                                         <<"1+2.0-3/4*5">>
  -                                                        ]
  -                                    },
  -                 Sel).
  -
  -basic_select_window_agg_fn_arith_1_test() ->
  -    DDL = get_sel_ddl(),
  -    SQL = "SELECT count(location) + 1 from mytab WHERE myfamily = 'familyX' and myseries = 'seriesX' and time > 1 and time < 2",
  -    {ok, Rec} = get_query(SQL),
  -    {ok, Sel} = compile_select_clause(DDL, Rec),
  -    ?assertMatch(#riak_sel_clause_v1{calc_type        = aggregate,
  -                                     col_return_types = [
  -                                                         sint64
  -                                                        ],
  -                                     col_names        = [
  -                                                         <<"COUNT(location)+1">>
  -                                                        ]
  -                                    },
  -                 Sel).
  +    {ok, Sel} = compile_select_clause(get_sel_ddl(), Rec),
  +    ?assertMatch(
  +        #riak_sel_clause_v1{ 
  +            calc_type = rows,
  +            col_return_types = [double],
  +            col_names = [<<"((1+2.0)-((3/4)*5))">>] },
  +        Sel
  +    ).
  +
  +% FIXME
  +% basic_select_window_agg_fn_arith_1_test() ->
  +%     DDL = get_sel_ddl(),
  +%     SQL = "SELECT count(location) + 1 from mytab WHERE myfamily = 'familyX' and myseries = 'seriesX' and time > 1 and time < 2",
  +%     {ok, Rec} = get_query(SQL),
  +%     {ok, Sel} = compile_select_clause(DDL, Rec),
  +%     ?assertMatch(#riak_sel_clause_v1{calc_type        = aggregate,
  +%                                      col_return_types = [
  +%                                                          sint64
  +%                                                         ],
  +%                                      col_names        = [
  +%                                                          <<"COUNT(location)+1">>
  +%                                                         ]
  +%                                     },
  +%                  Sel).
   
   %% basic_select_window_agg_fn_arith_2_test() ->
   %%     DDL = get_sel_ddl(),
  
positive.code: 
  
  basic_select_window_agg_fn_test() ->
      DDL = get_sel_ddl(),
      SQL = "SELECT count(location), avg(mydouble), avg(mysint) from mytab WHERE myfamily = 'familyX' and myseries = 'seriesX' and time > 1 and time < 2",
      {ok, Rec} = get_query(SQL),
      {ok, Sel} = compile_select_clause(DDL, Rec),
      ?assertMatch(#riak_sel_clause_v1{calc_type        = aggregate,
                                       col_return_types = [
                                                           sint64,
  
negative.code: %% Select Clause Compilation
  %%
  
  get_sel_ddl() ->
      get_ddl(
        "CREATE TABLE GeoCheckin "
  