You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Ryan LeCompte <le...@gmail.com> on 2010/03/16 22:06:27 UTC

Removing columns?

Is there a way to remove columns from a Hive table via ALTER TABLE
statement?

Re: Removing columns?

Posted by John Sichi <js...@facebook.com>.
Sorry, pokes is the example table in the getting started guide:

http://wiki.apache.org/hadoop/Hive/GettingStarted#DDL_Operations

JVS

On Mar 16, 2010, at 2:22 PM, Ryan LeCompte wrote:

Can you elaborate a little bit? I guess I don't see foo+bar in the example?

Thanks!

Ryan


On Tue, Mar 16, 2010 at 5:18 PM, John Sichi <js...@facebook.com>> wrote:

On Mar 16, 2010, at 2:06 PM, Ryan LeCompte wrote:

> Is there a way to remove columns from a Hive table via ALTER TABLE statement?
>


We don't currently support a DROP COLUMN syntax on ALTER TABLE, but you can use REPLACE COLUMNS to achieve the same effect, e.g.

alter table pokes replace columns(foo int);

takes it down to just foo instead of foo+bar.

JVS




Re: Removing columns?

Posted by Ryan LeCompte <le...@gmail.com>.
Can you elaborate a little bit? I guess I don't see foo+bar in the example?

Thanks!

Ryan


On Tue, Mar 16, 2010 at 5:18 PM, John Sichi <js...@facebook.com> wrote:

>
> On Mar 16, 2010, at 2:06 PM, Ryan LeCompte wrote:
>
> > Is there a way to remove columns from a Hive table via ALTER TABLE
> statement?
> >
>
>
> We don't currently support a DROP COLUMN syntax on ALTER TABLE, but you can
> use REPLACE COLUMNS to achieve the same effect, e.g.
>
> alter table pokes replace columns(foo int);
>
> takes it down to just foo instead of foo+bar.
>
> JVS
>
>

Re: Removing columns?

Posted by John Sichi <js...@facebook.com>.
On Mar 16, 2010, at 2:06 PM, Ryan LeCompte wrote:

> Is there a way to remove columns from a Hive table via ALTER TABLE statement?
> 


We don't currently support a DROP COLUMN syntax on ALTER TABLE, but you can use REPLACE COLUMNS to achieve the same effect, e.g.

alter table pokes replace columns(foo int);

takes it down to just foo instead of foo+bar.

JVS


Re: Removing columns?

Posted by Edward Capriolo <ed...@gmail.com>.
On Tue, Mar 16, 2010 at 5:06 PM, Ryan LeCompte <le...@gmail.com> wrote:

> Is there a way to remove columns from a Hive table via ALTER TABLE
> statement?
>
> You can replace/change the schema definition

http://wiki.apache.org/hadoop/Hive/LanguageManual/DDL#Add.2BAC8-Replace_Columns

Be Warned! This does not alter the underlying data. It only changes the
schema.

Edward