Skip to content

Commit

Permalink
Merge pull request #1045 from javajolt/bch-update-tsqueryresp-format
Browse files Browse the repository at this point in the history
Change standard tsqueryresp to be {ok, {_, _}}
  • Loading branch information
Brett Hazen committed Apr 15, 2016
2 parents 097f321 + 6a55cbe commit e8203e5
Show file tree
Hide file tree
Showing 21 changed files with 112 additions and 112 deletions.
4 changes: 2 additions & 2 deletions tests/ts_cluster_comprehensive.erl
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ confirm_select(C, PvalP1, PvalP2, Options) ->
?PKEY_P2, PvalP2,
?PKEY_P3, ?TIMEBASE + 10, ?PKEY_P3, ?TIMEBASE + 20])),
io:format("Running query: ~p\n", [Query]),
{_Columns, Rows} = riakc_ts:query(C, Query, Options),
{ok, {_Columns, Rows}} = riakc_ts:query(C, Query, Options),
io:format("Got ~b rows back\n~p\n", [length(Rows), Rows]),
?assertEqual(10 - 1 - 1, length(Rows)),
{_Columns, Rows} = riakc_ts:query(C, Query, Options),
{ok, {_Columns, Rows}} = riakc_ts:query(C, Query, Options),
io:format("Got ~b rows back again\n", [length(Rows)]),
?assertEqual(10 - 1 - 1, length(Rows)),
ok.
Expand Down
6 changes: 3 additions & 3 deletions tests/ts_cluster_coverage.erl
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ test_quanta_range(Table, ExpectedData, Nodes, NumQuanta, QuantumMS) ->
range=TsRange}, Acc) ->
{ok, Pid} = riakc_pb_socket:start_link(binary_to_list(IP),
Port),
{_, ThisQuantum} = riakc_ts:query(Pid, Qry, [], C),
{ok, {_, ThisQuantum}} = riakc_ts:query(Pid, Qry, [], C),
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({[], []},
?assertEqual({ok, {[], []}},
riakc_ts:query(WrongPid, Qry, [], C)),
riakc_pb_socket:stop(WrongPid),

Expand All @@ -86,7 +86,7 @@ test_quanta_range(Table, ExpectedData, Nodes, NumQuanta, QuantumMS) ->
true ->
?assertMatch({error, {1001, _}}, riakc_ts:query(OtherPid, Qry));
false ->
{_, StraightQueryResults} = riakc_ts:query(OtherPid, Qry),
{ok, {_, StraightQueryResults}} = riakc_ts:query(OtherPid, Qry),
?assertEqual(lists:sort(ExpectedData), lists:sort(StraightQueryResults))
end.

Expand Down
6 changes: 3 additions & 3 deletions tests/ts_cluster_create_table_via_sql_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ create_test(Ctx) ->
enquote_varchar(?PROP_NO_QUOTES),
enquote_varchar(?PROP_WITH_QUOTES)]),
Got1 = riakc_ts:query(C, GoodDDL),
?assertEqual({[],[]}, Got1),
?assertEqual({ok, {[],[]}}, Got1),
pass.

re_create_fail_test(Ctx) ->
Expand Down Expand Up @@ -127,12 +127,12 @@ ddl_common() ->
ts_util:get_ddl(small).

table_described() ->
{[<<"Column">>,<<"Type">>,<<"Is Null">>,<<"Primary Key">>, <<"Local Key">>],
{ok, {[<<"Column">>,<<"Type">>,<<"Is Null">>,<<"Primary Key">>, <<"Local Key">>],
[{<<"myfamily">>, <<"varchar">>, false, 1, 1},
{<<"myseries">>, <<"varchar">>, false, 2, 2},
{<<"time">>, <<"timestamp">>, false, 3, 3},
{<<"weather">>, <<"varchar">>, false, [], []},
{<<"temperature">>,<<"double">>, true, [], []}]}.
{<<"temperature">>,<<"double">>, true, [], []}]}}.

enquote_varchar(P) when is_binary(P) ->
re:replace(P, "'", "''", [global, {return, binary}]);
Expand Down
56 changes: 28 additions & 28 deletions tests/ts_cluster_keys_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ run_query(Ctx, Query) ->
%%%

create_data_def_1(Pid) ->
ts_util:assert_row_sets({[],[]},riakc_ts:query(Pid, table_def_1())),
ts_util:assert_row_sets({ok, {[],[]}},riakc_ts:query(Pid, table_def_1())),
ok = riakc_ts:put(Pid, <<"table1">>, [{1,1,N,1} || N <- lists:seq(1,6000)]).

column_names_def_1() ->
Expand All @@ -103,7 +103,7 @@ select_exclusive_def_1_test(Ctx) ->
Results =
[{1,1,N,1} || N <- lists:seq(1,10)],
ts_util:assert_row_sets(
{column_names_def_1(), Results},
{ok, {column_names_def_1(), Results}},
run_query(Ctx, Query)
).

Expand All @@ -113,7 +113,7 @@ select_exclusive_def_1_2_test(Ctx) ->
Results =
[{1,1,N,1} || N <- lists:seq(45,53)],
ts_util:assert_row_sets(
{column_names_def_1(), Results},
{ok, {column_names_def_1(), Results}},
run_query(Ctx, Query)
).

Expand All @@ -123,7 +123,7 @@ select_exclusive_def_1_across_quanta_1_test(Ctx) ->
Results =
[{1,1,N,1} || N <- lists:seq(501,1499)],
ts_util:assert_row_sets(
{column_names_def_1(), Results},
{ok, {column_names_def_1(), Results}},
run_query(Ctx, Query)
).

Expand All @@ -134,7 +134,7 @@ select_exclusive_def_1_across_quanta_2_test(Ctx) ->
Results =
[{1,1,N,1} || N <- lists:seq(501,4499)],
ts_util:assert_row_sets(
{column_names_def_1(), Results},
{ok, {column_names_def_1(), Results}},
run_query(Ctx, Query)
).

Expand All @@ -144,7 +144,7 @@ select_inclusive_def_1_test(Ctx) ->
Results =
[{1,1,N,1} || N <- lists:seq(11,20)],
ts_util:assert_row_sets(
{column_names_def_1(), Results},
{ok, {column_names_def_1(), Results}},
run_query(Ctx, Query)
).

Expand Down Expand Up @@ -180,7 +180,7 @@ where_clause_must_cover_the_partition_key_missing_c_test(Ctx) ->
%%%

create_data_def_2(Pid) ->
ts_util:assert_row_sets({[],[]}, riakc_ts:query(Pid, table_def_2())),
ts_util:assert_row_sets({ok, {[],[]}}, riakc_ts:query(Pid, table_def_2())),
ok = riakc_ts:put(Pid, <<"table2">>, [{N,1,1,1} || N <- lists:seq(1,200)]).

table_def_2() ->
Expand All @@ -197,7 +197,7 @@ select_exclusive_def_2_test(Ctx) ->
Results =
[{N,1,1,1} || N <- lists:seq(1,10)],
ts_util:assert_row_sets(
{column_names_def_1(), Results},
{ok, {column_names_def_1(), Results}},
run_query(Ctx, Query)
).

Expand All @@ -207,7 +207,7 @@ select_inclusive_def_2_test(Ctx) ->
Results =
[{N,1,1,1} || N <- lists:seq(11,20)],
ts_util:assert_row_sets(
{column_names_def_1(), Results},
{ok, {column_names_def_1(), Results}},
run_query(Ctx, Query)
).

Expand All @@ -216,7 +216,7 @@ select_inclusive_def_2_test(Ctx) ->
%%%

create_data_def_3(Pid) ->
ts_util:assert_row_sets({[],[]}, riakc_ts:query(Pid, table_def_3())),
ts_util:assert_row_sets({ok, {[],[]}}, riakc_ts:query(Pid, table_def_3())),
ok = riakc_ts:put(Pid, <<"table3">>, [{1,N} || N <- lists:seq(1,200)]).

column_names_def_3() ->
Expand All @@ -234,7 +234,7 @@ select_exclusive_def_3_test(Ctx) ->
Results =
[{1,N} || N <- lists:seq(1,10)],
ts_util:assert_row_sets(
{column_names_def_3(), Results},
{ok, {column_names_def_3(), Results}},
run_query(Ctx, Query)
).

Expand All @@ -244,7 +244,7 @@ select_inclusive_def_3_test(Ctx) ->
Results =
[{1,N} || N <- lists:seq(11,20)],
ts_util:assert_row_sets(
{column_names_def_3(), Results},
{ok, {column_names_def_3(), Results}},
run_query(Ctx, Query)
).

Expand All @@ -254,7 +254,7 @@ select_inclusive_def_3_test(Ctx) ->
%%%

create_data_def_4(Pid) ->
ts_util:assert_row_sets({[],[]}, riakc_ts:query(Pid, table_def_4())),
ts_util:assert_row_sets({ok, {[],[]}}, riakc_ts:query(Pid, table_def_4())),
ok = riakc_ts:put(Pid, <<"table4">>, [{1,1,N} || N <- lists:seq(1,200)]).

column_names_def_4() ->
Expand All @@ -273,7 +273,7 @@ select_exclusive_def_4_test(Ctx) ->
Results =
[{1,1,N} || N <- lists:seq(1,10)],
ts_util:assert_row_sets(
{column_names_def_4(), Results},
{ok, {column_names_def_4(), Results}},
run_query(Ctx, Query)
).

Expand All @@ -283,7 +283,7 @@ select_inclusive_def_4_test(Ctx) ->
Results =
[{1,1,N} || N <- lists:seq(11,20)],
ts_util:assert_row_sets(
{column_names_def_4(), Results},
{ok, {column_names_def_4(), Results}},
run_query(Ctx, Query)
).

Expand All @@ -302,14 +302,14 @@ table_def_5() ->
"PRIMARY KEY ((a,b,c),a,b,c))".

create_data_def_5(Pid) ->
ts_util:assert_row_sets({[],[]}, riakc_ts:query(Pid, table_def_5())),
ts_util:assert_row_sets({ok, {[],[]}}, riakc_ts:query(Pid, table_def_5())),
ok = riakc_ts:put(Pid, <<"table5">>, [{1,1,N} || N <- lists:seq(1,200)]).

select_def_5_test(Ctx) ->
Query =
"SELECT * FROM table5 WHERE a = 1 AND b = 1 AND c = 20",
ts_util:assert_row_sets(
{column_names_def_5(), [{1,1,20}]},
{ok, {column_names_def_5(), [{1,1,20}]}},
run_query(Ctx, Query)
).

Expand All @@ -326,7 +326,7 @@ table_def_6() ->
"PRIMARY KEY ((a,quantum(b,1,'s'),c),a,b,c,d))".

create_data_def_6(Pid) ->
ts_util:assert_row_sets({[],[]}, riakc_ts:query(Pid, table_def_6())),
ts_util:assert_row_sets({ok, {[],[]}}, riakc_ts:query(Pid, table_def_6())),
ok = riakc_ts:put(Pid, <<"table6">>, [{1,N,1,<<"table6">>} || N <- lists:seq(1,200)]).

select_def_6_test(Ctx) ->
Expand All @@ -335,7 +335,7 @@ select_def_6_test(Ctx) ->
Results =
[{1,N,1,<<"table6">>} || N <- lists:seq(8,13)],
ts_util:assert_row_sets(
{[<<"a">>, <<"b">>, <<"c">>,<<"d">>], Results},
{ok, {[<<"a">>, <<"b">>, <<"c">>,<<"d">>], Results}},
run_query(Ctx, Query)
).

Expand All @@ -352,7 +352,7 @@ table_def_7() ->
"PRIMARY KEY ((quantum(a,1,'s'),b,c),a,b,c,d))".

create_data_def_7(Pid) ->
ts_util:assert_row_sets({[],[]}, riakc_ts:query(Pid, table_def_7())),
ts_util:assert_row_sets({ok, {[],[]}}, riakc_ts:query(Pid, table_def_7())),
ok = riakc_ts:put(Pid, <<"table7">>, [{N,1,1,<<"table7">>} || N <- lists:seq(1,200)]).

select_exclusive_def_7_test(Ctx) ->
Expand All @@ -361,7 +361,7 @@ select_exclusive_def_7_test(Ctx) ->
Results =
[{N,1,1,<<"table7">>} || N <- lists:seq(45,54)],
ts_util:assert_row_sets(
{[<<"a">>, <<"b">>, <<"c">>, <<"d">>], Results},
{ok, {[<<"a">>, <<"b">>, <<"c">>, <<"d">>], Results}},
run_query(Ctx, Query)
).

Expand All @@ -371,7 +371,7 @@ select_inclusive_def_7_test(Ctx) ->
Results =
[{N,1,1,<<"table7">>} || N <- lists:seq(44,54)],
ts_util:assert_row_sets(
{[<<"a">>, <<"b">>, <<"c">>, <<"d">>], Results},
{ok, {[<<"a">>, <<"b">>, <<"c">>, <<"d">>], Results}},
run_query(Ctx, Query)
).

Expand All @@ -381,7 +381,7 @@ select_inclusive_def_7_test(Ctx) ->

create_data_def_8(Pid) ->
ts_util:assert_row_sets(
{[],[]},
{ok, {[],[]}},
riakc_ts:query(Pid,
"CREATE TABLE table8 ("
"a SINT64 NOT NULL, "
Expand Down Expand Up @@ -507,7 +507,7 @@ multiple_quantum_functions_in_partition_key_not_allowed(Ctx) ->

double_pk_double_boolean_lk_test(Ctx) ->
?assertEqual(
{[],[]},
{ok, {[],[]}},
riakc_ts:query(client_pid(Ctx),
"CREATE TABLE double_pk_double_boolean_lk_test ("
"a DOUBLE NOT NULL, "
Expand All @@ -527,7 +527,7 @@ double_pk_double_boolean_lk_test(Ctx) ->

boolean_pk_boolean_double_lk_test(Ctx) ->
?assertEqual(
{[],[]},
{ok, {[],[]}},
riakc_ts:query(client_pid(Ctx),
"CREATE TABLE boolean_pk_boolean_double_lk_test ("
"a BOOLEAN NOT NULL, "
Expand All @@ -547,7 +547,7 @@ boolean_pk_boolean_double_lk_test(Ctx) ->

all_types_create_data(Pid) ->
?assertEqual(
{[],[]},
{ok, {[],[]}},
riakc_ts:query(Pid,
"CREATE TABLE all_types ("
"a VARCHAR NOT NULL, "
Expand Down Expand Up @@ -627,7 +627,7 @@ all_types_or_filter_test(Ctx) ->

all_booleans_create_data(Pid) ->
?assertEqual(
{[],[]},
{ok, {[],[]}},
riakc_ts:query(Pid,
"CREATE TABLE all_booleans ("
"a BOOLEAN NOT NULL, "
Expand Down Expand Up @@ -689,7 +689,7 @@ all_booleans_filter_on_d_and_f_test(Ctx) ->

all_timestamps_create_data(Pid) ->
?assertEqual(
{[],[]},
{ok, {[],[]}},
riakc_ts:query(Pid,
"CREATE TABLE all_timestamps ("
"a TIMESTAMP NOT NULL, "
Expand Down
Loading

0 comments on commit e8203e5

Please sign in to comment.