riak querying error

Sangeetha.PattabiRaman2 at cognizant.com Sangeetha.PattabiRaman2 at cognizant.com
Fri Apr 27 00:59:24 EDT 2012


Dear team,


My doubt is I have loaded goog.csv on riak using load_data script such as

#!/usr/local/bin/escript
main([Filename]) ->
    {ok, Data} = file:read_file(Filename),
    Lines = tl(re:split(Data, "\r?\n", [{return, binary},trim])),
    lists:foreach(fun(L) -> LS = re:split(L, ","), format_and_insert(LS) end, Lines).

format_and_insert(Line) ->
    JSON = io_lib:format("{\"Date\":\"~s\",\"Open\":~s,\"High\":~s,\"Low\":~s,\"Close\":~s,\"Volume\":~s,\"Adj. Close\":~s}", Line),
    Command = io_lib:format("curl -X PUT http://127.0.0.1:8091/riak/goog/~s -d '~s' -H 'content-type: application/json'", [hd(Line),JSON]),
    io:format("Inserting: ~s~n", [hd(Line)]),
    os:cmd(Command).





                fYIP: goog.csv is this


Date,Open,High,Low,Close,Volume,Adj Close
2010-05-05,500.98,515.72,500.47,509.76,4566900,509.76
2010-05-04,526.52,526.74,504.21,506.37,6076300,506.37
2010-05-03,526.50,532.92,525.08,530.60,1857800,530.60
2010-04-30,531.13,537.68,525.44,525.70,2435400,525.70
2010-04-29,533.37,536.50,526.67,532.00,3058900,532.00
2010-04-28,532.10,534.83,521.03,529.19,3406100,529.19
2010-04-27,528.95,538.33,527.23,529.06,3844700,529.06
2010-04-26,544.97,544.99,529.21,531.64,4368800,531.64
2010-04-23,547.25,549.32,542.27,544.99,2089400,544.99
|Please clarify wit hteh same !!!!!!!!!!!!!!!!!!!!!!!!!!!|

My quest is :
When I query over date its returning the values but when I query on other than date column like volume etc... it shows the following error ...please do help me out with the same in resolving the following error :

[{"not_found":{"bucket":"goog","key":"1956200","keydata":"undefined"}}]


curl -X POST http://10.232.5.169:8098/mapred -H "Content-Type: application/json" -d @-
{"inputs":[["goog","2010-01-04"]],
"query":[{"map":{"language":"javascript","name":"Riak.mapValues","keep":true}}]
}
["{\"Date\":\"2010-01-04\",\"Open\":626.95,\"High\":629.51,\"Low\":624.24,\"Close\":626.75,\"Volume\":1956200,\"Adj. Close\":626.75}"]



curl -X POST http://10.232.5.169:8098/mapred -H "Content-Type: application/json" -d @-
{"inputs":[["goog","2010-01-04"]],
"query":[{"map":{"language":"javascript","name":"Riak.mapValues","keep":true}}]
}
["{\"Date\":\"2010-01-04\",\"Open\":626.95,\"High\":629.51,\"Low\":624.24,\"Close\":626.75,\"Volume\":1956200,\"Adj. Close\":626.75}"][ha^C
[hadoop at CTSINGMRGTO dev]$ curl -X POST http://10.232.5.169:8098/mapred -H "Content-Type: application/json" -d @-
{"inputs":[["goog","1956200"]],
"query":[{"map":{"language":"javascript","name":"Riak.mapValues","keep":true}}]
}
[{"not_found":{"bucket":"goog","key":"1956200","keydata":"undefined"}}]
Thanks & regards
sangeetha


This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20120427/bd8e9331/attachment.html>


More information about the riak-users mailing list