hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Kerzner <mark.kerz...@shmsoft.com>
Subject Re: Command works inside hive but not outside
Date Sun, 02 Oct 2011 21:33:58 GMT
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 <
chinnarao@huawei.com> 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
> >
>

Mime
View raw message