FAQ
Hi,

I am a Cascalog enthusiast and very new to it. I am working on a project
and am struck with a query where I would like to use logical "and".
But when I use and as

(?<- (stdout) [?u ?s](data1 ?u ?s _)(data2 ?s ?s2)(and (not= ?s ?s2) (< ?u
4)))

I get the error

Can't take the value of a macro #'clojure.core/and

I then defined a function for "and"

(defn and_op [a b] (and a b))

and used that but then I got the error ?s is not defined

I would sincerely appreciate any help in this regard.

Thanks,
Kunal

Search Discussions

  • Mayank Agarwal at Jun 26, 2012 at 3:40 am
    Hi Kunal,

    Looks to me that you want to join data1 and data2 on "?s" and the filters
    are:
    (not= ?s ?s2) and (< ?u 4)

    Because a cascalog query can take multiple filter predicates, you can do:

    (?<- (stdout) [?u ?s] (data1 ?u ?s _) (data2 ?s ?s2) (not= ?s ?s2) (< ?u 4))

    let me know if this doesn't work.

    Mayank

    On Mon, Jun 25, 2012 at 8:05 PM, Kunal Mishra wrote:

    Hi,

    I am a Cascalog enthusiast and very new to it. I am working on a project
    and am struck with a query where I would like to use logical "and".
    But when I use and as

    (?<- (stdout) [?u ?s](data1 ?u ?s _)(data2 ?s ?s2)(and (not= ?s ?s2) (< ?u
    4)))

    I get the error

    Can't take the value of a macro #'clojure.core/and

    I then defined a function for "and"

    (defn and_op [a b] (and a b))

    and used that but then I got the error ?s is not defined

    I would sincerely appreciate any help in this regard.

    Thanks,
    Kunal
  • Alexey Larin at Sep 23, 2013 at 8:01 am
    Hi All,
    Sorry for up old topic.
    I am also newbie in Cascalog and I am cannot find example how to do logical
    OR filter.

    Something like SQL
    WHERE A=1 or A=2

    Thanks for help
    Alexey L.

    вторник, 26 июня 2012 г., 7:40:02 UTC+4 пользователь Mayank Agarwal написал:
    Hi Kunal,

    Looks to me that you want to join data1 and data2 on "?s" and the filters
    are:
    (not= ?s ?s2) and (< ?u 4)

    Because a cascalog query can take multiple filter predicates, you can do:

    (?<- (stdout) [?u ?s] (data1 ?u ?s _) (data2 ?s ?s2) (not= ?s ?s2) (< ?u
    4))

    let me know if this doesn't work.

    Mayank


    On Mon, Jun 25, 2012 at 8:05 PM, Kunal Mishra <[email protected]<javascript:>
    wrote:
    Hi,

    I am a Cascalog enthusiast and very new to it. I am working on a project
    and am struck with a query where I would like to use logical "and".
    But when I use and as

    (?<- (stdout) [?u ?s](data1 ?u ?s _)(data2 ?s ?s2)(and (not= ?s ?s2) (<
    ?u 4)))

    I get the error

    Can't take the value of a macro #'clojure.core/and

    I then defined a function for "and"

    (defn and_op [a b] (and a b))

    and used that but then I got the error ?s is not defined

    I would sincerely appreciate any help in this regard.

    Thanks,
    Kunal
    --
    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 [email protected].
    For more options, visit https://groups.google.com/groups/opt_out.
  • Philippe Guillebert at Sep 23, 2013 at 9:36 am
    Hi

    Have a look at
    http://nathanmarz.github.io/cascalog/cascalog.ops.html#var-any


    On Mon, Sep 23, 2013 at 10:01 AM, Alexey Larin wrote:

    Hi All,
    Sorry for up old topic.
    I am also newbie in Cascalog and I am cannot find example how to do
    logical OR filter.

    Something like SQL
    WHERE A=1 or A=2

    Thanks for help
    Alexey L.

    вторник, 26 июня 2012 г., 7:40:02 UTC+4 пользователь Mayank Agarwal
    написал:
    Hi Kunal,

    Looks to me that you want to join data1 and data2 on "?s" and the filters
    are:
    (not= ?s ?s2) and (< ?u 4)

    Because a cascalog query can take multiple filter predicates, you can do:

    (?<- (stdout) [?u ?s] (data1 ?u ?s _) (data2 ?s ?s2) (not= ?s ?s2) (< ?u
    4))

    let me know if this doesn't work.

    Mayank

    On Mon, Jun 25, 2012 at 8:05 PM, Kunal Mishra wrote:

    Hi,

    I am a Cascalog enthusiast and very new to it. I am working on a project
    and am struck with a query where I would like to use logical "and".
    But when I use and as

    (?<- (stdout) [?u ?s](data1 ?u ?s _)(data2 ?s ?s2)(and (not= ?s ?s2) (<
    ?u 4)))

    I get the error

    Can't take the value of a macro #'clojure.core/and

    I then defined a function for "and"

    (defn and_op [a b] (and a b))

    and used that but then I got the error ?s is not defined

    I would sincerely appreciate any help in this regard.

    Thanks,
    Kunal
    --
    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 [email protected].
    For more options, visit https://groups.google.com/groups/opt_out.


    --
    *
    Philippe*

    --
    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 [email protected].
    For more options, visit https://groups.google.com/groups/opt_out.
  • Igor Postelnik at Sep 23, 2013 at 8:13 pm
    (and) and (or) are macros, and can't be used in cascalog predicates. You
    should make a wrapper function (defn and* [x y] (and x y)) for use in your
    query. You can also use c/any and c/all if you want to compose multiple
    operations that return a boolean.

    -Igor
    On Monday, September 23, 2013 4:35:49 AM UTC-5, Philippe Guillebert wrote:

    Hi

    Have a look at
    http://nathanmarz.github.io/cascalog/cascalog.ops.html#var-any



    On Mon, Sep 23, 2013 at 10:01 AM, Alexey Larin <[email protected]<javascript:>
    wrote:
    Hi All,
    Sorry for up old topic.
    I am also newbie in Cascalog and I am cannot find example how to do
    logical OR filter.

    Something like SQL
    WHERE A=1 or A=2

    Thanks for help
    Alexey L.

    вторник, 26 июня 2012 г., 7:40:02 UTC+4 пользователь Mayank Agarwal
    написал:
    Hi Kunal,

    Looks to me that you want to join data1 and data2 on "?s" and the
    filters are:
    (not= ?s ?s2) and (< ?u 4)

    Because a cascalog query can take multiple filter predicates, you can do:

    (?<- (stdout) [?u ?s] (data1 ?u ?s _) (data2 ?s ?s2) (not= ?s ?s2) (< ?u
    4))

    let me know if this doesn't work.

    Mayank

    On Mon, Jun 25, 2012 at 8:05 PM, Kunal Mishra wrote:

    Hi,

    I am a Cascalog enthusiast and very new to it. I am working on a
    project and am struck with a query where I would like to use logical "and".
    But when I use and as

    (?<- (stdout) [?u ?s](data1 ?u ?s _)(data2 ?s ?s2)(and (not= ?s ?s2) (<
    ?u 4)))

    I get the error

    Can't take the value of a macro #'clojure.core/and

    I then defined a function for "and"

    (defn and_op [a b] (and a b))

    and used that but then I got the error ?s is not defined

    I would sincerely appreciate any help in this regard.

    Thanks,
    Kunal
    --
    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 [email protected] <javascript:>.
    For more options, visit https://groups.google.com/groups/opt_out.


    --
    *
    Philippe*
    --
    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 [email protected].
    For more options, visit https://groups.google.com/groups/opt_out.
  • Elango Cheran at Sep 23, 2013 at 8:42 pm
    For situations like "WHERE A = 1 OR A = 2", given that 1 and 2 are
    literals, I've also used a predicate like:

    (contains? #{1 2} ?a)

    -- Elango

    On Mon, Sep 23, 2013 at 2:35 AM, Philippe Guillebert wrote:

    Hi

    Have a look at
    http://nathanmarz.github.io/cascalog/cascalog.ops.html#var-any


    On Mon, Sep 23, 2013 at 10:01 AM, Alexey Larin wrote:

    Hi All,
    Sorry for up old topic.
    I am also newbie in Cascalog and I am cannot find example how to do
    logical OR filter.

    Something like SQL
    WHERE A=1 or A=2

    Thanks for help
    Alexey L.

    вторник, 26 июня 2012 г., 7:40:02 UTC+4 пользователь Mayank Agarwal
    написал:
    Hi Kunal,

    Looks to me that you want to join data1 and data2 on "?s" and the
    filters are:
    (not= ?s ?s2) and (< ?u 4)

    Because a cascalog query can take multiple filter predicates, you can do:

    (?<- (stdout) [?u ?s] (data1 ?u ?s _) (data2 ?s ?s2) (not= ?s ?s2) (< ?u
    4))

    let me know if this doesn't work.

    Mayank

    On Mon, Jun 25, 2012 at 8:05 PM, Kunal Mishra wrote:

    Hi,

    I am a Cascalog enthusiast and very new to it. I am working on a
    project and am struck with a query where I would like to use logical "and".
    But when I use and as

    (?<- (stdout) [?u ?s](data1 ?u ?s _)(data2 ?s ?s2)(and (not= ?s ?s2) (<
    ?u 4)))

    I get the error

    Can't take the value of a macro #'clojure.core/and

    I then defined a function for "and"

    (defn and_op [a b] (and a b))

    and used that but then I got the error ?s is not defined

    I would sincerely appreciate any help in this regard.

    Thanks,
    Kunal
    --
    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 [email protected].
    For more options, visit https://groups.google.com/groups/opt_out.


    --
    *
    Philippe*

    --
    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 [email protected].
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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 [email protected].
    For more options, visit https://groups.google.com/groups/opt_out.
  • Sam Ritchie at Sep 23, 2013 at 8:43 pm
    +1
    Elango Cheran September 23, 2013 4:42 PM
    For situations like "WHERE A = 1 OR A = 2", given that 1 and 2 are
    literals, I've also used a predicate like:

    (contains? #{1 2} ?a)

    -- Elango



    --
    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 [email protected].
    For more options, visit https://groups.google.com/groups/opt_out.
    Philippe Guillebert September 23, 2013 5:35 AM
    Hi

    Have a look at
    http://nathanmarz.github.io/cascalog/cascalog.ops.html#var-any






    --
    *
    Philippe*
    --
    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 [email protected].
    For more options, visit https://groups.google.com/groups/opt_out.
    Alexey Larin September 23, 2013 4:01 AM
    Hi All,
    Sorry for up old topic.
    I am also newbie in Cascalog and I am cannot find example how to do
    logical OR filter.

    Something like SQL
    WHERE A=1 or A=2

    Thanks for help
    Alexey L.

    вторник, 26 июня 2012 г., 7:40:02 UTC+4 пользователь Mayank Agarwal
    написал:
    --
    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 [email protected].
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    Sam Ritchie, Twitter Inc
    703.662.1337
    @sritchie

    --
    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 [email protected].
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcascalog-user @
categoriesclojure, hadoop
postedJun 26, '12 at 3:10a
activeSep 23, '13 at 8:43p
posts7
users7
websiteclojure.org
irc#clojure

People

Translate

site design / logo © 2023 Grokbase