Match results of the selection, from ok to {Cols, Rows}.

This commit is contained in:
andytill 2015-10-01 11:02:07 +00:00
parent c21666c423
commit 650ab6a44e
3 changed files with 27 additions and 16 deletions

View File

@ -149,6 +149,21 @@ get_valid_select_data() ->
Times = lists:seq(1, 10),
[[Family, Series, X, get_varchar(), get_float()] || X <- Times].
get_cols(docs) ->
[<<"myfamily">>,
<<"myseries">>,
<<"time">>,
<<"weather">>,
<<"temperature">>].
%% Convert put data to result rows exclusive of the first and last records.
exclusive_result_from_data(Data) ->
[_|Tail] = remove_last([list_to_tuple(R) || R <- Data]),
Tail.
remove_last(Data) ->
lists:reverse(tl(lists:reverse(Data))).
%% a valid DDL - the one used in the documents
get_ddl(docs) ->
_SQL = "CREATE TABLE GeoCheckin (" ++

View File

@ -14,21 +14,13 @@
]).
confirm() ->
Cluster = single,
TestType = normal,
DDL = get_ddl(docs),
Data = get_valid_select_data(),
Qry = get_valid_qry(),
confirm_select(single, normal, DDL, Data, Qry, {get_cols(docs), to_result(Data)}).
Expected = {
timeseries_util:get_cols(docs),
timeseries_util:exclusive_result_from_data(Data)},
confirm_select(Cluster, TestType, DDL, Data, Qry, Expected).
get_cols(docs) ->
[<<"myfamily">>,
<<"myseries">>,
<<"time">>,
<<"weather">>,
<<"temperature">>].
to_result(Data) ->
[_|Tail] = remove_last([list_to_tuple(R) || R <- Data]),
Tail .
remove_last(Data) ->
lists:reverse(tl(lists:reverse(Data))).

View File

@ -14,8 +14,12 @@
]).
confirm() ->
Cluster = multiple,
TestType = normal,
DDL = get_ddl(docs),
Data = get_valid_select_data(),
Qry = get_valid_qry(),
Expected = ok,
confirm_select(multiple, normal, DDL, Data, Qry, Expected).
Expected = {
timeseries_util:get_cols(docs),
timeseries_util:exclusive_result_from_data(Data)},
confirm_select(Cluster, TestType, DDL, Data, Qry, Expected).