hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brad Ruderman <bruder...@radiumone.com>
Subject Re: Multiple Insert with Where Clauses
Date Wed, 31 Jul 2013 04:06:22 GMT
Hive doesn't support inserting a few records into a table. You will need to
write a query to union your select and then insert. IF you can partition,
then you can insert a whole partition at a time instead of the table.

Thanks,
Brad


On Tue, Jul 30, 2013 at 9:04 PM, Sha Liu <liusand@hotmail.com> wrote:

> Yes for the example you gave, it works. It even works when there is a
> single insert under the from clause, but there there are multiple inserts,
> the where clauses seem no longer effective.
>
> ------------------------------
> Date: Tue, 30 Jul 2013 20:29:19 -0700
> Subject: Re: Multiple Insert with Where Clauses
> From: bruderman@radiumone.com
> To: user@hive.apache.org
>
>
> Have you simply tried
>
> INSERT OVERWRITE TABLE destination
> SELECT col1, col2, col3
> FROM source
> WHERE col4 = 'abc'
>
> Thanks!
>
>
>
> On Tue, Jul 30, 2013 at 8:25 PM, Sha Liu <liusand@hotmail.com> wrote:
>
> Hi Hive Gurus,
>
> When using the Hive extension of multiple inserts, can we add Where
> clauses for each Select statement, like the following?
>
> FROM ...
> INSERT OVERWRITE TABLE ...
>     SELECT col1, col2, col3
>     *WHERE col4='abc'*
> INSERT OVERWRITE TABLE ...
>     SELECT col1, col4, col2
>     *WHERE col3='xyz'*
> *
> *
> The underlined parts didn't cause any errors, but they didn't seem to be
> effective either (I'm using Hive 0.9). Note that the columns used in the
> Where clauses are not among the selected ones, but I'm not sure if that is
> important. Is this kind of operations supported?
>
> Thanks,
> Sha Liu
>
>
>

Mime
View raw message