You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by John Omernik <jo...@omernik.com> on 2012/12/09 17:55:34 UTC

Running commands at hive cli or hive thirft startup

I am looking for ways to streamline some of my analytics. One thing I
notice is that when I use hive cli, or connect to my hive thrift server,
there are a some commands I always end up running for my session.  If I
have multiple CLIs or connections to Thrift, then I have to run it each
time. If I lose a connection to hive thrift, I have to run them.  Etc etc.

My thought was, is there a way that upon opening a hive cli or connection
to a hive thrift server, could I have certain commands be executed?

These commands include a use command to get me to a specific database
(perhaps there is a default database config variable?) or loading up all
the temporary functions I use (UDFs) .

For example, I have a UDF to do URL decoding:

CREATE TEMPORARY FUNCTION uridecode AS 'org.domain.analytics.URIDECODE;

Can I get this to run auto magically at hive cli start or thrift server
connection?

If not, could we build it in that we can add UDFs to hive without doing a
recompile that stay in permanently?

I would welcome discussion on this!

Re: Running commands at hive cli or hive thirft startup

Posted by Navis류승우 <na...@nexr.com>.
I've booked it on https://issues.apache.org/jira/browse/HIVE-3797

2012/12/14 Dean Wampler <de...@thinkbiganalytics.com>:
> What about using "hive -i ~/.hiverc -f script"? I haven't tried it, but I
> assume it reads the specified "rc" file in the batch mode case. True?
>
>
> On Fri, Dec 14, 2012 at 3:41 AM, Mark Grover <gr...@gmail.com>
> wrote:
>>
>> No, .hiverc only works for CLI.
>>
>> UDFs are tricky. The only way I can think of is to add them to the
>> function registry
>>
>> (https://github.com/apache/hive/blob/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java)
>> and recompile Hive.
>>
>> On Mon, Dec 10, 2012 at 8:01 AM, John Omernik <jo...@omernik.com> wrote:
>> > Will that work for my thrift server connections?
>> >
>> >
>> > On Sun, Dec 9, 2012 at 7:56 PM, विनोद सिंह <vi...@vinodsingh.com> wrote:
>> >>
>> >> Put a .hiverc file in your home directory containing commands, Hive CLI
>> >> will execute all of them at startup.
>> >>
>> >> Thanks,
>> >> Vinod
>> >>
>> >> On Sun, Dec 9, 2012 at 10:25 PM, John Omernik <jo...@omernik.com> wrote:
>> >>>
>> >>> I am looking for ways to streamline some of my analytics. One thing I
>> >>> notice is that when I use hive cli, or connect to my hive thrift
>> >>> server,
>> >>> there are a some commands I always end up running for my session.  If
>> >>> I have
>> >>> multiple CLIs or connections to Thrift, then I have to run it each
>> >>> time. If
>> >>> I lose a connection to hive thrift, I have to run them.  Etc etc.
>> >>>
>> >>> My thought was, is there a way that upon opening a hive cli or
>> >>> connection
>> >>> to a hive thrift server, could I have certain commands be executed?
>> >>>
>> >>> These commands include a use command to get me to a specific database
>> >>> (perhaps there is a default database config variable?) or loading up
>> >>> all the
>> >>> temporary functions I use (UDFs) .
>> >>>
>> >>> For example, I have a UDF to do URL decoding:
>> >>>
>> >>> CREATE TEMPORARY FUNCTION uridecode AS
>> >>> 'org.domain.analytics.URIDECODE;
>> >>>
>> >>> Can I get this to run auto magically at hive cli start or thrift
>> >>> server
>> >>> connection?
>> >>>
>> >>> If not, could we build it in that we can add UDFs to hive without
>> >>> doing a
>> >>> recompile that stay in permanently?
>> >>>
>> >>> I would welcome discussion on this!
>> >>>
>> >>>
>> >>
>> >
>
>
>
>
> --
> Dean Wampler, Ph.D.
> thinkbiganalytics.com
> +1-312-339-1330
>
>

Re: Running commands at hive cli or hive thirft startup

Posted by Dean Wampler <de...@thinkbiganalytics.com>.
What about using "hive -i ~/.hiverc -f script"? I haven't tried it, but I
assume it reads the specified "rc" file in the batch mode case. True?

On Fri, Dec 14, 2012 at 3:41 AM, Mark Grover <gr...@gmail.com>wrote:

> No, .hiverc only works for CLI.
>
> UDFs are tricky. The only way I can think of is to add them to the
> function registry
> (
> https://github.com/apache/hive/blob/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
> )
> and recompile Hive.
>
> On Mon, Dec 10, 2012 at 8:01 AM, John Omernik <jo...@omernik.com> wrote:
> > Will that work for my thrift server connections?
> >
> >
> > On Sun, Dec 9, 2012 at 7:56 PM, विनोद सिंह <vi...@vinodsingh.com> wrote:
> >>
> >> Put a .hiverc file in your home directory containing commands, Hive CLI
> >> will execute all of them at startup.
> >>
> >> Thanks,
> >> Vinod
> >>
> >> On Sun, Dec 9, 2012 at 10:25 PM, John Omernik <jo...@omernik.com> wrote:
> >>>
> >>> I am looking for ways to streamline some of my analytics. One thing I
> >>> notice is that when I use hive cli, or connect to my hive thrift
> server,
> >>> there are a some commands I always end up running for my session.  If
> I have
> >>> multiple CLIs or connections to Thrift, then I have to run it each
> time. If
> >>> I lose a connection to hive thrift, I have to run them.  Etc etc.
> >>>
> >>> My thought was, is there a way that upon opening a hive cli or
> connection
> >>> to a hive thrift server, could I have certain commands be executed?
> >>>
> >>> These commands include a use command to get me to a specific database
> >>> (perhaps there is a default database config variable?) or loading up
> all the
> >>> temporary functions I use (UDFs) .
> >>>
> >>> For example, I have a UDF to do URL decoding:
> >>>
> >>> CREATE TEMPORARY FUNCTION uridecode AS 'org.domain.analytics.URIDECODE;
> >>>
> >>> Can I get this to run auto magically at hive cli start or thrift server
> >>> connection?
> >>>
> >>> If not, could we build it in that we can add UDFs to hive without
> doing a
> >>> recompile that stay in permanently?
> >>>
> >>> I would welcome discussion on this!
> >>>
> >>>
> >>
> >
>



-- 
*Dean Wampler, Ph.D.*
thinkbiganalytics.com
+1-312-339-1330

RE: Running commands at hive cli or hive thirft startup

Posted by Vivek Mishra <vi...@impetus.co.in>.
UDFs are tricky. The only way I can think of is to add them to the
function registry
(https://github.com/apache/hive/blob/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java)
and recompile Hive.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
What about  https://cwiki.apache.org/Hive/plugindeveloperkit.html  ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
________________________________________
From: Mark Grover [grover.markgrover@gmail.com]
Sent: 14 December 2012 15:11
To: user@hive.apache.org
Subject: Re: Running commands at hive cli or hive thirft startup

No, .hiverc only works for CLI.

UDFs are tricky. The only way I can think of is to add them to the
function registry
(https://github.com/apache/hive/blob/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java)
and recompile Hive.

On Mon, Dec 10, 2012 at 8:01 AM, John Omernik <jo...@omernik.com> wrote:
> Will that work for my thrift server connections?
>
>
> On Sun, Dec 9, 2012 at 7:56 PM, विनोद सिंह <vi...@vinodsingh.com> wrote:
>>
>> Put a .hiverc file in your home directory containing commands, Hive CLI
>> will execute all of them at startup.
>>
>> Thanks,
>> Vinod
>>
>> On Sun, Dec 9, 2012 at 10:25 PM, John Omernik <jo...@omernik.com> wrote:
>>>
>>> I am looking for ways to streamline some of my analytics. One thing I
>>> notice is that when I use hive cli, or connect to my hive thrift server,
>>> there are a some commands I always end up running for my session.  If I have
>>> multiple CLIs or connections to Thrift, then I have to run it each time. If
>>> I lose a connection to hive thrift, I have to run them.  Etc etc.
>>>
>>> My thought was, is there a way that upon opening a hive cli or connection
>>> to a hive thrift server, could I have certain commands be executed?
>>>
>>> These commands include a use command to get me to a specific database
>>> (perhaps there is a default database config variable?) or loading up all the
>>> temporary functions I use (UDFs) .
>>>
>>> For example, I have a UDF to do URL decoding:
>>>
>>> CREATE TEMPORARY FUNCTION uridecode AS 'org.domain.analytics.URIDECODE;
>>>
>>> Can I get this to run auto magically at hive cli start or thrift server
>>> connection?
>>>
>>> If not, could we build it in that we can add UDFs to hive without doing a
>>> recompile that stay in permanently?
>>>
>>> I would welcome discussion on this!
>>>
>>>
>>
>

________________________________






NOTE: This message may contain information that is confidential, proprietary, privileged or otherwise protected by law. The message is intended solely for the named addressee. If received in error, please destroy and notify the sender. Any use of this email is prohibited when received in error. Impetus does not represent, warrant and/or guarantee, that the integrity of this communication has been maintained nor that the communication is free of errors, virus, interception or interference.

Re: Running commands at hive cli or hive thirft startup

Posted by Mark Grover <gr...@gmail.com>.
No, .hiverc only works for CLI.

UDFs are tricky. The only way I can think of is to add them to the
function registry
(https://github.com/apache/hive/blob/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java)
and recompile Hive.

On Mon, Dec 10, 2012 at 8:01 AM, John Omernik <jo...@omernik.com> wrote:
> Will that work for my thrift server connections?
>
>
> On Sun, Dec 9, 2012 at 7:56 PM, विनोद सिंह <vi...@vinodsingh.com> wrote:
>>
>> Put a .hiverc file in your home directory containing commands, Hive CLI
>> will execute all of them at startup.
>>
>> Thanks,
>> Vinod
>>
>> On Sun, Dec 9, 2012 at 10:25 PM, John Omernik <jo...@omernik.com> wrote:
>>>
>>> I am looking for ways to streamline some of my analytics. One thing I
>>> notice is that when I use hive cli, or connect to my hive thrift server,
>>> there are a some commands I always end up running for my session.  If I have
>>> multiple CLIs or connections to Thrift, then I have to run it each time. If
>>> I lose a connection to hive thrift, I have to run them.  Etc etc.
>>>
>>> My thought was, is there a way that upon opening a hive cli or connection
>>> to a hive thrift server, could I have certain commands be executed?
>>>
>>> These commands include a use command to get me to a specific database
>>> (perhaps there is a default database config variable?) or loading up all the
>>> temporary functions I use (UDFs) .
>>>
>>> For example, I have a UDF to do URL decoding:
>>>
>>> CREATE TEMPORARY FUNCTION uridecode AS 'org.domain.analytics.URIDECODE;
>>>
>>> Can I get this to run auto magically at hive cli start or thrift server
>>> connection?
>>>
>>> If not, could we build it in that we can add UDFs to hive without doing a
>>> recompile that stay in permanently?
>>>
>>> I would welcome discussion on this!
>>>
>>>
>>
>

Re: Running commands at hive cli or hive thirft startup

Posted by विनोद सिंह <vi...@vinodsingh.com>.
I did not tried thrift, so not sure whether this will work or not.

Thanks,
Vinod

On Mon, Dec 10, 2012 at 9:31 PM, John Omernik <jo...@omernik.com> wrote:

> Will that work for my thrift server connections?
>
>
> On Sun, Dec 9, 2012 at 7:56 PM, विनोद सिंह <vi...@vinodsingh.com> wrote:
>
>> Put a .hiverc file in your home directory containing commands, Hive CLI
>> will execute all of them at startup.
>>
>> Thanks,
>> Vinod
>>
>> On Sun, Dec 9, 2012 at 10:25 PM, John Omernik <jo...@omernik.com> wrote:
>>
>>> I am looking for ways to streamline some of my analytics. One thing I
>>> notice is that when I use hive cli, or connect to my hive thrift server,
>>> there are a some commands I always end up running for my session.  If I
>>> have multiple CLIs or connections to Thrift, then I have to run it each
>>> time. If I lose a connection to hive thrift, I have to run them.  Etc etc.
>>>
>>> My thought was, is there a way that upon opening a hive cli or
>>> connection to a hive thrift server, could I have certain commands be
>>> executed?
>>>
>>> These commands include a use command to get me to a specific database
>>> (perhaps there is a default database config variable?) or loading up all
>>> the temporary functions I use (UDFs) .
>>>
>>> For example, I have a UDF to do URL decoding:
>>>
>>> CREATE TEMPORARY FUNCTION uridecode AS 'org.domain.analytics.URIDECODE;
>>>
>>> Can I get this to run auto magically at hive cli start or thrift server
>>> connection?
>>>
>>> If not, could we build it in that we can add UDFs to hive without doing
>>> a recompile that stay in permanently?
>>>
>>> I would welcome discussion on this!
>>>
>>>
>>>
>>
>

Re: Running commands at hive cli or hive thirft startup

Posted by John Omernik <jo...@omernik.com>.
Will that work for my thrift server connections?

On Sun, Dec 9, 2012 at 7:56 PM, विनोद सिंह <vi...@vinodsingh.com> wrote:

> Put a .hiverc file in your home directory containing commands, Hive CLI
> will execute all of them at startup.
>
> Thanks,
> Vinod
>
> On Sun, Dec 9, 2012 at 10:25 PM, John Omernik <jo...@omernik.com> wrote:
>
>> I am looking for ways to streamline some of my analytics. One thing I
>> notice is that when I use hive cli, or connect to my hive thrift server,
>> there are a some commands I always end up running for my session.  If I
>> have multiple CLIs or connections to Thrift, then I have to run it each
>> time. If I lose a connection to hive thrift, I have to run them.  Etc etc.
>>
>> My thought was, is there a way that upon opening a hive cli or connection
>> to a hive thrift server, could I have certain commands be executed?
>>
>> These commands include a use command to get me to a specific database
>> (perhaps there is a default database config variable?) or loading up all
>> the temporary functions I use (UDFs) .
>>
>> For example, I have a UDF to do URL decoding:
>>
>> CREATE TEMPORARY FUNCTION uridecode AS 'org.domain.analytics.URIDECODE;
>>
>> Can I get this to run auto magically at hive cli start or thrift server
>> connection?
>>
>> If not, could we build it in that we can add UDFs to hive without doing a
>> recompile that stay in permanently?
>>
>> I would welcome discussion on this!
>>
>>
>>
>

Re: Running commands at hive cli or hive thirft startup

Posted by विनोद सिंह <vi...@vinodsingh.com>.
Put a .hiverc file in your home directory containing commands, Hive CLI
will execute all of them at startup.

Thanks,
Vinod

On Sun, Dec 9, 2012 at 10:25 PM, John Omernik <jo...@omernik.com> wrote:

> I am looking for ways to streamline some of my analytics. One thing I
> notice is that when I use hive cli, or connect to my hive thrift server,
> there are a some commands I always end up running for my session.  If I
> have multiple CLIs or connections to Thrift, then I have to run it each
> time. If I lose a connection to hive thrift, I have to run them.  Etc etc.
>
> My thought was, is there a way that upon opening a hive cli or connection
> to a hive thrift server, could I have certain commands be executed?
>
> These commands include a use command to get me to a specific database
> (perhaps there is a default database config variable?) or loading up all
> the temporary functions I use (UDFs) .
>
> For example, I have a UDF to do URL decoding:
>
> CREATE TEMPORARY FUNCTION uridecode AS 'org.domain.analytics.URIDECODE;
>
> Can I get this to run auto magically at hive cli start or thrift server
> connection?
>
> If not, could we build it in that we can add UDFs to hive without doing a
> recompile that stay in permanently?
>
> I would welcome discussion on this!
>
>
>