Problem in loop (for loop) with Cascalog results

92 views
Skip to first unread message

sindhu hosamane

unread,
Apr 23, 2014, 8:15:47 AM4/23/14
to clo...@googlegroups.com
Hello friends , 
i want to get results using cascalog queries .I need to get data between 2 timestamps datefrom and dateto  as shown below in code . I have a problem in loop , where i cannot update the timestamp value .
I am using clojure cli-time .

(ns Recallnack.core

 (:use [cascalog.api]

        [cascalog.more-taps :only (hfs-delimited)])

 (:require [clj-time.core :as t])

(:require [clj-time.format :as f])

 (:require [cascalog.ops :as c])

 (:gen-class))


 (def info

      (hfs-delimited  "/Volumes/SindhuHosamane/Master_thesis_docs/burner_changed.txt"

                       :delimiter ";"

                       :outfields ["?timestamp" "?assembly" "?sensor" "?value"]

                       :classes[String String String Float]

                       :skip-header? false))


(def info-tap

  (<- [?timestamp ?value]

      ((select-fields info ["?timestamp" "?value"]) ?timestamp ?value)))


(def datefrom "12:05:2010 00:00:00")

 (def dateto "12:05:2010 01:01:00")


(def custom-formatter (f/formatter "dd:MM:yyyy HH:mm:ss"))

(def hour-part (t/hour (f/parse custom-formatter datefrom)))

(def minute-part(t/minute (f/parse custom-formatter datefrom)))


(loop [hour-part 01]

  (when (>= minute-part 00)

    (?<- (stdout) [?timestamp-out ?value-out]

  (info-tap  ?timestamp ?value) (c/limit [1] ?timestamp ?value :> ?timestamp-out ?value-out)

 )

 (recur (+  minute-part 01))))


where am i wrong in the loop ? Any advice!!

Di Xu

unread,
Apr 23, 2014, 9:29:34 PM4/23/14
to clo...@googlegroups.com
Isn't your "loop [hour-part 01]" should be "loop [minute-part 01]"? because you recur with "(recur (+ minute-part 01))"?

I'm not very familiar with cascalog, maybe you should post this to https://groups.google.com/forum/#!forum/cascalog-user

Thanks,
Di Xu


--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

sindhu hosamane

unread,
Apr 26, 2014, 5:43:47 PM4/26/14
to clo...@googlegroups.com
Thanks a lot . i got it wrong in my cascalog query. Now it worked.
Reply all
Reply to author
Forward
0 new messages