diff --git a/rebar.config b/rebar.config index b6e197a..4b8ff42 100644 --- a/rebar.config +++ b/rebar.config @@ -12,7 +12,7 @@ {reset_after_eunit, true}. {deps, [ - {riakc, ".*", {git, "git://github.com/basho/riak-erlang-client", {tag, "2.3.2-timeseries"}}}, + {riakc, ".*", {git, "git://github.com/basho/riak-erlang-client", {tag, "2.4.1"}}}, {node_package, ".*", {git, "git://github.com/basho/node_package", {branch, "no-epmd"}}}, {webmachine, "1.10.*", {git, "git://github.com/basho/webmachine", {tag, "1.10.8"}}}, {ibrowse, "4.0.2", {git, "git://github.com/cmullaparthi/ibrowse.git", {tag, "v4.0.2"}}}, diff --git a/src/re_node.erl b/src/re_node.erl index 5b24ccc..2579ed1 100644 --- a/src/re_node.erl +++ b/src/re_node.erl @@ -152,12 +152,12 @@ get_ts(Node, Table, Key) -> -spec put_ts(re_node(), ts_table(), [term()]) -> {error, term()} | ok. put_ts(Node, Table, Rows) -> - lager:info("Putting Rows: ~p into table ~p", [Rows, Table]), C = client(Node), - Rows1 = [ [ case V of + Rows1 = [ list_to_tuple([ case V of null -> undefined; _ -> V - end || V <- Vs ] || Vs <- Rows ], + end || V <- Vs ]) || Vs <- Rows ], + lager:info("Putting Rows: ~p into table ~p", [Rows1, Table]), case riakc_ts:put(C, Table, Rows1) of ok -> ok; @@ -169,13 +169,17 @@ put_ts(Node, Table, Rows) -> {error, term()} | ts_result(). query_ts(Node, Query) -> C = client(Node), + QueryStr = binary_to_list(Query), + lager:info("Query: ~p", [QueryStr]), + R = riakc_ts:query(C, QueryStr), + lager:info("Results: ~p", [R]), {Fields, Rows} = - case riakc_ts:query(C, Query) of - {[],[]} -> + case R of + {ok, {[],[]}} -> {[],[]}; {error, Reason} -> {error, Reason}; - {Fields1, TupleRows} -> + {ok, {Fields1, TupleRows}} -> TupleToRowFun = fun(Tuple) -> [element(I,Tuple)