FAQ
I couldn't find anything on the wiki so thought I would try here.

Does Hive have an IN() operator similar to in MySQL?

If not then is there an alternative way of testing for inclusion?

Thanks,
Andy.

Search Discussions

  • Vladimir Klimontovich at Feb 19, 2010 at 5:01 pm
    No, but it's relatively easy to implement custom UDF (http://wiki.apache.org/hadoop/Hive/LanguageManual/UDF)
    that will implement the same functionality
    On Feb 19, 2010, at 7:58 PM, Andy Kent wrote:

    I couldn't find anything on the wiki so thought I would try here.

    Does Hive have an IN() operator similar to in MySQL?

    If not then is there an alternative way of testing for inclusion?

    Thanks,
    Andy.
    ---
    Vladimir Klimontovich,
    skype: klimontovich
    GoogleTalk/Jabber: klimontovich@gmail.com
    Cell phone: +7926 890 2349
  • Amr Awadallah at Feb 20, 2010 at 4:27 am
    Andy,

    Are you trying to do something like:

    SELECT
    FROM mytable A
    WHERE ....
    AND mycol IN (
    SELECT ....

    )

    If so, you can't do sub-queries inside the WHERE clause in Hive, you can
    only do sub-queries within the FROM/JOIN clause.

    But, almost any query similar to above can be written using sub-queries
    in the FROM using join instead.

    For example:

    SELECT ....
    FROM mytable A
    JOIN ( SELECT .... ) B
    ON A.mycol = B.mycol
    WHERE ...

    hope that helps.

    -- amr
    On 2/19/2010 8:58 AM, Andy Kent wrote:
    I couldn't find anything on the wiki so thought I would try here.

    Does Hive have an IN() operator similar to in MySQL?

    If not then is there an alternative way of testing for inclusion?

    Thanks,
    Andy.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categorieshive, hadoop
postedFeb 19, '10 at 4:59p
activeFeb 20, '10 at 4:27a
posts3
users3
websitehive.apache.org

People

Translate

site design / logo © 2021 Grokbase