FAQ
I have the error above "clojure.lang.PersistentVector cannot be cast to
java.lang.String" . but when i use ByteArrayInputStream (as seen in some
other thread ) i have"clojure.lang.PersistentList cannot be cast to
java.lang.String" . don't know how to fix it .I want to retrieve data
between 2 timestamp values . i have some 800 rows in my data .My code
snipper below: Please let me know where am i wrong .I am really stuck
.someone help me out !!

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

    (def datefrom "12:05:2010 10:00:00")
    (def custom-formatter (f/formatter "dd:MM:yyyy HH:mm:ss"))
    (def start-value (ct/to-long (f/parse custom-formatter datefrom)))

    (def dateto "12:05:2010 11:00:00")
    (def end-value (ct/to-long (f/parse custom-formatter dateto)))

    (defmacro convert-to-long [a]
        (ct/to-long (f/parse custom-formatter a)) )

   (?<- (stdout)[?timestamp ?value](info-tap ?timestamp ?value)
      (> convert-to-long[?timestamp] start-value)
      (< convert-to-long[?timestamp] end-value))


I my code i am converting timestamp strings to long (numbers ) so that i
can compare them .But ?timestamp field have 800 or more entries (rows) of
timestamps . but custom-formatter is expecting a string. How do i deal with
it .I guess something is wrong with my cascalog query . My data looks like :
12:05:2010 00:00:00;GasTurbine2103/01;TC255;78.99
12:05:2010 00:01:00;GasTurbine2103/01;TC255;77.599
12:05:2010 00:02:00;GasTurbine2103/01;TC255;77.199
12:05:2010 00:03:00;GasTurbine2103/01;TC255;77.
                   ...so on (800 or more entries)

--
You received this message because you are subscribed to the Google Groups "cascalog-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cascalog-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Sam Ritchie at Apr 24, 2014 at 6:55 pm
    This line is wacky:

       (> convert-to-long[?timestamp] start-value)

    Why is convert-to-long a macro?

    If you make it a function, you can write

    (convert-to-long ?timestamp :> ?converted)
    (> ?converted start-value)
    (< ?converted end-value)

    sindhu hosamane April 24, 2014 9:26 AM
    I have the error above "clojure.lang.PersistentVector cannot be cast
    to java.lang.String" . but when i use ByteArrayInputStream (as seen in
    some other thread ) i have"clojure.lang.PersistentList cannot be cast
    to java.lang.String" .don't know how to fix it .I want to retrieve
    data between 2 timestamp values . i have some 800 rows in my data .My
    code snipper below: Please let me know where am i wrong .I am really
    stuck .someone help me out !!

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

    (def datefrom "12:05:2010 10:00:00")
    (def custom-formatter (f/formatter "dd:MM:yyyy HH:mm:ss"))
    (def start-value (ct/to-long (f/parse custom-formatter datefrom)))

    (def dateto "12:05:2010 11:00:00")
    (def end-value (ct/to-long (f/parse custom-formatter dateto)))

    (defmacro convert-to-long [a]
    (ct/to-long (f/parse custom-formatter a)) )

    (?<- (stdout)[?timestamp ?value](info-tap ?timestamp ?value)
    (> convert-to-long[?timestamp] start-value)
    (< convert-to-long[?timestamp] end-value))


    I my code i am converting timestamp strings to long (numbers ) so that
    i can compare them .But ?timestamp field have 800 or more entries
    (rows) of timestamps . but custom-formatter is expecting a string. How
    do i deal with it .I guess something is wrong with my cascalog query .
    My data looks like :
    12:05:2010 00:00:00;GasTurbine2103/01;TC255;78.99
    12:05:2010 00:01:00;GasTurbine2103/01;TC255;77.599
    12:05:2010 00:02:00;GasTurbine2103/01;TC255;77.199
    12:05:2010 00:03:00;GasTurbine2103/01;TC255;77.
    ...so on (800 or more entries)
    --
    You received this message because you are subscribed to the Google
    Groups "cascalog-user" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to cascalog-user+unsubscribe@googlegroups.com
    For more options, visit https://groups.google.com/d/optout.
    --
    Sam Ritchie (@sritchie)
    Paddleguru Co-Founder
    703.863.8561
    www.paddleguru.com <http://www.paddleguru.com/>
    Twitter <http://twitter.com/paddleguru>// Facebook
    <http://facebook.com/paddleguru>

    --
    You received this message because you are subscribed to the Google Groups "cascalog-user" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to cascalog-user+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Sindhu hosamane at Apr 26, 2014 at 9:39 pm
    Thanks Sam Ritchie . That worked like a charm. Thanks a lot.

    --
    You received this message because you are subscribed to the Google Groups "cascalog-user" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to cascalog-user+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcascalog-user @
categoriesclojure, hadoop
postedApr 24, '14 at 4:26p
activeApr 26, '14 at 9:39p
posts3
users2
websiteclojure.org
irc#clojure

2 users in discussion

Sindhu hosamane: 2 posts Sam Ritchie: 1 post

People

Translate

site design / logo © 2021 Grokbase