FAQ
Hi, experts,

the same command words in hive shell

add jar WebLogAnalyzer-1.0-SNAPSHOT-jar-with-dependencies.jar; create
temporary function get_browser as "com.shmsoft.webloganalyzer.GetBrowser";
SELECT get_browser(user_agent), COUNT(get_browser(user_agent)) AS
NumOccurrences FROM apache_logs GROUP BY get_browser(user_agent);

but outside,

hive -e 'add jar WebLogAnalyzer-1.0-SNAPSHOT-jar-with-dependencies.jar;
create temporary function get_browser as
"com.shmsoft.webloganalyzer.GetBrowser"; SELECT get_browser(user_agent),
COUNT(get_browser(user_agent)) AS NumOccurrences FROM apache_logs GROUP BY
get_browser(user_agent);'

it gives me an error

FAILED: Error in semantic analysis: Unable to fetch table apache_logs

Thank you,
Mark

Search Discussions

  • Chinna Rao Lalam 72745 at Sep 29, 2011 at 5:40 am
    Hi Mark,

    I think 'apache_logs' table created from hive shell and select command is executed from 'hive -e'(outside) so the hive shell process is different and 'hive -e' process is different if derby started in embeded mode(hive by default provided embeded derby) it can't see the tables of other processes.

    Use derby in network server mode then it can work with the tables created from other processes.


    Hope it helps,
    Chinna

    ----- Original Message -----
    From: Mark Kerzner <mark.kerzner@shmsoft.com>
    Date: Thursday, September 29, 2011 4:26 am
    Subject: Command works inside hive but not outside
    To: Hive user <user@hive.apache.org>
    Hi, experts,

    the same command words in hive shell

    add jar WebLogAnalyzer-1.0-SNAPSHOT-jar-with-dependencies.jar; create
    temporary function get_browser as
    "com.shmsoft.webloganalyzer.GetBrowser";SELECT
    get_browser(user_agent), COUNT(get_browser(user_agent)) AS
    NumOccurrences FROM apache_logs GROUP BY get_browser(user_agent);

    but outside,

    hive -e 'add jar WebLogAnalyzer-1.0-SNAPSHOT-jar-with-
    dependencies.jar;create temporary function get_browser as
    "com.shmsoft.webloganalyzer.GetBrowser"; SELECT
    get_browser(user_agent),COUNT(get_browser(user_agent)) AS
    NumOccurrences FROM apache_logs GROUP BY
    get_browser(user_agent);'

    it gives me an error

    FAILED: Error in semantic analysis: Unable to fetch table apache_logs

    Thank you,
    Mark
  • Mark Kerzner at Oct 2, 2011 at 9:34 pm
    Chinna,

    I wish it were that simple. This short command works,

    hive -e 'select * from apache_logs';

    but a long command where I load a jar first, doesn't,

    hive -e 'add jar
    target/WebLogAnalyzer-1.0-SNAPSHOT-jar-with-dependencies.jar; create
    temporary function get_browser as "com.shmsoft.webloganalyzer.GetBrowser";
    SELECT get_browser(user_agent), COUNT(get_browser(user_agent)) AS
    NumOccurrences FROM apache_logs GROUP BY get_browser(user_agent);'

    I see the truth of your words - the table has to be created and used either
    all from inside the hive shell, or all from the outside. But I also think
    that there is a problem (or at least a problem in the way I use it) with the
    long outside command.

    Sincerely,
    Mark
    On Thu, Sep 29, 2011 at 12:40 AM, Chinna Rao Lalam 72745 wrote:

    Hi Mark,

    I think 'apache_logs' table created from hive shell and select command is
    executed from 'hive -e'(outside) so the hive shell process is different and
    'hive -e' process is different if derby started in embeded mode(hive by
    default provided embeded derby) it can't see the tables of other processes.

    Use derby in network server mode then it can work with the tables created
    from other processes.


    Hope it helps,
    Chinna

    ----- Original Message -----
    From: Mark Kerzner <mark.kerzner@shmsoft.com>
    Date: Thursday, September 29, 2011 4:26 am
    Subject: Command works inside hive but not outside
    To: Hive user <user@hive.apache.org>
    Hi, experts,

    the same command words in hive shell

    add jar WebLogAnalyzer-1.0-SNAPSHOT-jar-with-dependencies.jar; create
    temporary function get_browser as
    "com.shmsoft.webloganalyzer.GetBrowser";SELECT
    get_browser(user_agent), COUNT(get_browser(user_agent)) AS
    NumOccurrences FROM apache_logs GROUP BY get_browser(user_agent);

    but outside,

    hive -e 'add jar WebLogAnalyzer-1.0-SNAPSHOT-jar-with-
    dependencies.jar;create temporary function get_browser as
    "com.shmsoft.webloganalyzer.GetBrowser"; SELECT
    get_browser(user_agent),COUNT(get_browser(user_agent)) AS
    NumOccurrences FROM apache_logs GROUP BY
    get_browser(user_agent);'

    it gives me an error

    FAILED: Error in semantic analysis: Unable to fetch table apache_logs

    Thank you,
    Mark

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categorieshive, hadoop
postedSep 28, '11 at 10:56p
activeOct 2, '11 at 9:34p
posts3
users2
websitehive.apache.org

People

Translate

site design / logo © 2021 Grokbase