Skip to content

Commit

Permalink
Merge pull request #1047 from basho/fix-az-assorted_post_ttb_merge_fixes
Browse files Browse the repository at this point in the history
assorted post TTB merge fixes
  • Loading branch information
Brett Hazen committed Apr 19, 2016
2 parents 34f227d + 9615800 commit bb0994a
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 56 deletions.
10 changes: 5 additions & 5 deletions priv/riak_shell/riak_shell_regression1.log
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@
{{command, "insert into GeoCheckin (myfamily, myseries, time, weather, temperature) values ('family1','series1',10,28);\n"}, {result, "Error (1003): Invalid data found at row index(es) 1"}}.
{{command, "insert into GeoCheckin (myfamily, myseries, time, weather, temperature) values ('family1','series1',10,'hail',38.1);\n"}, {result, ""}}.
{{command, "select time, weather, temperature from GeoCheckin where myfamily='family1' and myseries='seriesX' and time > 10 and time < 1000;\n"}, {result, ""}}.
{{command, "select * from GeoCheckin;\n"}, {result, "Error (1001): no_where_clause: The query must have a where clause."}}.
{{command, "select * from GeoCheckin where myfamily = 'family1' and myseries = 'series1' and time >= 1420113600000 and time <= 1420119300000;\n"}, {result, "Error (1001): {too_many_subqueries,7}"}}.
{{command, "select * from GeoCheckin;\n"}, {result, "Error (1001): The query must have a where clause."}}.
{{command, "select * from GeoCheckin where myfamily = 'family1' and myseries = 'series1' and time >= 1420113600000 and time <= 1420119300000;\n"}, {result, "Error (1001): Too many subqueries (7)"}}.
{{command, "select * from GeoCheckin where myfamily = 'family1' and myseries = 'series1' and time >= 1 and time <= 2;\n"}, {result, "+--------+--------+----+-------+--------------------------+
|myfamily|myseries|time|weather| temperature |
+--------+--------+----+-------+--------------------------+
|family1 |series1 | 1 | snow |2.51999999999999992895e+01|
|family1 |series1 | 2 | rain |2.45000000000000000000e+01|
+--------+--------+----+-------+--------------------------+
"}}.
{{command, "select * from GeoCheckin where myfamily = 'family1' and myseries = 'series1' and time >= 10 and time <= 8;\n"}, {result, "Error (1001): lower_bound_must_be_less_than_upper_bound: The lower time bound is greater than the upper time bound."}}.
{{command, "select * from GeoCheckin where myfamily = 'family1' and myseries = 'series1' and time >= 10;\n"}, {result, "Error (1001): incomplete_where_clause: Where clause has no upper bound."}}.
{{command, "select * from GeoCheckin where myfamily = 'family1' and myseries = 'series1' and time <= 8;\n"}, {result, "Error (1001): incomplete_where_clause: Where clause has no lower bound."}}.
{{command, "select * from GeoCheckin where myfamily = 'family1' and myseries = 'series1' and time >= 10 and time <= 8;\n"}, {result, "Error (1001): The lower time bound is greater than the upper time bound."}}.
{{command, "select * from GeoCheckin where myfamily = 'family1' and myseries = 'series1' and time >= 10;\n"}, {result, "Error (1001): Where clause has no upper bound."}}.
{{command, "select * from GeoCheckin where myfamily = 'family1' and myseries = 'series1' and time <= 8;\n"}, {result, "Error (1001): Where clause has no lower bound."}}.
{{command, "select * from GeoCheckin where myfamily = 'family1' and myseries = 'series1' and time >= 2 and time <= 7;\n"}, {result, "+--------+--------+----+-------+--------------------------+
|myfamily|myseries|time|weather| temperature |
+--------+--------+----+-------+--------------------------+
Expand Down
2 changes: 1 addition & 1 deletion tests/ts_cluster_comprehensive.erl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ run_tests(PvalP1, PvalP2) ->
?PKEY_P1, ?PKEY_P2, ?PKEY_P3,
?PKEY_P1, ?PKEY_P2, ?PKEY_P3,
?PKEY_P1, ?PKEY_P2, ?PKEY_P3]),
ts_util:create_and_activate_bucket_type(Cluster, lists:flatten(TableDef), ?BUCKET),
?assertEqual({ok, {[], []}}, riakc_ts:query(rt:pbc(hd(Cluster)), TableDef)),

%% Make sure data is written to each node
lists:foreach(fun(Node) -> confirm_all_from_node(Node, Data, PvalP1, PvalP2) end, Cluster),
Expand Down
51 changes: 24 additions & 27 deletions tests/ts_cluster_coverage.erl
Original file line number Diff line number Diff line change
Expand Up @@ -54,31 +54,31 @@ test_quanta_range(Table, ExpectedData, Nodes, NumQuanta, QuantumMS) ->
{ok, CoverageEntries} = riakc_ts:get_coverage(AdminPid, Table, Qry),

Results =
lists:foldl(fun(#tscoverageentry{ip=IP, port=Port, cover_context=C,
range=TsRange}, Acc) ->
{ok, Pid} = riakc_pb_socket:start_link(binary_to_list(IP),
Port),
{ok, {_, ThisQuantum}} = riakc_ts:query(Pid, Qry, [], C),
riakc_pb_socket:stop(Pid),
lists:foldl(
fun({{IP, Port}, Context, TsRange, _Description}, Acc) ->
{ok, Pid} = riakc_pb_socket:start_link(
binary_to_list(IP), Port),
{ok, {_, ThisQuantum}} = riakc_ts:query(Pid, Qry, [], Context),
riakc_pb_socket:stop(Pid),

%% Open a connection to another node and
%% make certain we get no results using
%% this cover context
{ok, WrongPid} = riakc_pb_socket:start_link(binary_to_list(IP),
alternate_port(Port)),
?assertEqual({ok, {[], []}},
riakc_ts:query(WrongPid, Qry, [], C)),
riakc_pb_socket:stop(WrongPid),
%% Open a connection to another node and
%% make certain we get no results using
%% this cover context
{ok, WrongPid} = riakc_pb_socket:start_link(
binary_to_list(IP), alternate_port(Port)),
?assertEqual({ok, {[], []}},
riakc_ts:query(WrongPid, Qry, [], Context)),
riakc_pb_socket:stop(WrongPid),

%% Let's compare the range data with the
%% query results to make sure the latter
%% fall within the former
check_data_against_range(ThisQuantum, TsRange),
%% Now add to the pile and continue
ThisQuantum ++ Acc
end,
[],
CoverageEntries),
%% Let's compare the range data with the
%% query results to make sure the latter
%% fall within the former
check_data_against_range(ThisQuantum, TsRange),
%% Now add to the pile and continue
ThisQuantum ++ Acc
end,
[],
CoverageEntries),
?assertEqual(lists:sort(ExpectedData), lists:sort(Results)),

%% Expect {error,{1001,<<"{too_many_subqueries,13}">>}} if NumQuanta > 5
Expand All @@ -104,10 +104,7 @@ time_within_range(Time, Lower, LowerIncl, Upper, UpperIncl) ->
UpperIncl
end.

check_data_against_range(Data, #tsrange{lower_bound=Lower,
lower_bound_inclusive=LowerIncl,
upper_bound=Upper,
upper_bound_inclusive=UpperIncl}) ->
check_data_against_range(Data, {_FieldName, {{Lower, LowerIncl}, {Upper, UpperIncl}}}) ->
?assertEqual([], lists:filter(fun({_, _, Time, _, _}) ->
not time_within_range(Time, Lower, LowerIncl,
Upper, UpperIncl)
Expand Down
6 changes: 3 additions & 3 deletions tests/ts_simple_aggregation_math.erl
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ confirm() ->
div_by_zero_test(Conn, Bucket, Where) ->
Query = "SELECT 5 / 0 FROM " ++ Bucket ++ Where,
?assertEqual(
{error,{1001,<<"divide_by_zero">>}},
{error,{1001,<<"Divide by zero">>}},
ts_util:single_query(Conn, Query)
).

%%
div_aggregate_function_by_zero_test(Conn, Bucket, Where) ->
Query = "SELECT COUNT(*) / 0 FROM " ++ Bucket ++ Where,
?assertEqual(
{error,{1001,<<"divide_by_zero">>}},
{error,{1001,<<"Divide by zero">>}},
ts_util:single_query(Conn, Query)
).

Expand All @@ -92,4 +92,4 @@ negate_an_aggregation_test(Conn, Bucket, Where) ->
?assertEqual(
{ok, {[<<"-COUNT(*)">>, <<"COUNT(*)">>],[{-10, 10}]}},
ts_util:single_query(Conn, Query)
).
).
2 changes: 1 addition & 1 deletion tests/ts_simple_div_by_zero.erl
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ where() ->
"AND time >= 1 AND time <= 10 ".

error_divide_by_zero() ->
{error,{1001,<<"divide_by_zero">>}}.
{error,{1001,<<"Divide by zero">>}}.
4 changes: 2 additions & 2 deletions tests/ts_simple_put_bad_date.erl
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ confirm() ->
TestType = normal,
DDL = ts_util:get_ddl(),
Obj =
[[ts_util:get_varchar(),
[{ts_util:get_varchar(),
ts_util:get_varchar(),
<<"abc">>,
ts_util:get_varchar(),
ts_util:get_float()]],
ts_util:get_float()}],
Expected = {error, {1003, <<"Invalid data found at row index(es) 1">>}},
Got = ts_util:ts_put(
ts_util:cluster_and_connect(single), TestType, DDL, Obj),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ confirm() ->
Expected =
{error,
{1001,
<<"invalid_query: \n",
"incompatible_type: field myseries with type varchar cannot be compared to type float in where clause.">>}},
<<".*incompatible_type: field myseries with type varchar cannot be compared to type float in where clause.">>}},
Got = ts_util:ts_query(
ts_util:cluster_and_connect(single), normal, DDL, Data, Qry),
?assertEqual(Expected, Got),
pass.
ts_util:assert_error_regex("Incompatible types", Expected, Got).
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ confirm() ->
Expected =
{error,
{1001,
<<"invalid_query: \n",
"incompatible_type: field myseries with type varchar cannot be compared to type integer in where clause.">>}},
<<".*incompatible_type: field myseries with type varchar cannot be compared to type integer in where clause.">>}},
Got = ts_util:ts_query(
ts_util:cluster_and_connect(single), normal, DDL, Data, Qry),
?assertEqual(Expected, Got),
pass.
ts_util:assert_error_regex("Incompatible type", Expected, Got).
5 changes: 2 additions & 3 deletions tests/ts_simple_select_missing_field_in_pk_not_allowed.erl
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ confirm() ->
Expected =
{error,
{1001,
<<"missing_key_clause: The 'myfamily' parameter is part the primary key but not specified in the where clause.">>}},
<<"The 'myfamily' parameter is part the primary key but not specified in the where clause.">>}},
Got = ts_util:ts_query(
ts_util:cluster_and_connect(single), normal, DDL, Data, Query),
?assertEqual(Expected, Got),
pass.
ts_util:assert_error_regex("Missing key", Expected, Got).
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ confirm() ->
Expected =
{error,
{1001,
<<"incomplete_where_clause: Where clause has no lower bound.">>}},
<<"Where clause has no lower bound.">>}},
Got = ts_util:ts_query(
ts_util:cluster_and_connect(single), TestType, DDL, Data, Qry),
?assertEqual(Expected, Got),
pass.
ts_util:assert_error_regex("No lower bound", Expected, Got).

Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ confirm() ->
"and myfamily = 'family1' "
"and myseries ='seriesX' ",
Expected =
{error, {1001, <<"incomplete_where_clause: Where clause has no upper bound.">>}},
{error, {1001, <<"Where clause has no upper bound.">>}},
Got = ts_util:ts_query(
ts_util:cluster_and_connect(single), TestType, DDL, Data, Qry),
?assertEqual(Expected, Got),
pass.
ts_util:assert_error_regex("No upper bound", Expected, Got).

0 comments on commit bb0994a

Please sign in to comment.