Return-Path: X-Original-To: apmail-hive-user-archive@www.apache.org Delivered-To: apmail-hive-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7F3DEC1D8 for ; Wed, 2 May 2012 00:38:44 +0000 (UTC) Received: (qmail 94125 invoked by uid 500); 2 May 2012 00:38:43 -0000 Delivered-To: apmail-hive-user-archive@hive.apache.org Received: (qmail 94071 invoked by uid 500); 2 May 2012 00:38:43 -0000 Mailing-List: contact user-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hive.apache.org Delivered-To: mailing list user@hive.apache.org Received: (qmail 94060 invoked by uid 99); 2 May 2012 00:38:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 May 2012 00:38:43 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of Chalcy.Raja@careerbuilder.com designates 64.212.116.17 as permitted sender) Received: from [64.212.116.17] (HELO SVR-PR-EDGE2.cb.careerbuilder.com) (64.212.116.17) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 May 2012 00:38:37 +0000 Received: from SVR-PR-HUB1.cb.careerbuilder.com (10.64.5.20) by SVR-PR-EDGE2.cb.careerbuilder.com (10.64.6.62) with Microsoft SMTP Server (TLS) id 14.1.355.2; Tue, 1 May 2012 20:38:09 -0400 Received: from SVR-PR-MB1.cb.careerbuilder.com ([169.254.1.131]) by SVR-PR-HUB1.cb.careerbuilder.com ([10.64.5.20]) with mapi id 14.01.0355.002; Tue, 1 May 2012 20:38:15 -0400 From: Chalcy Raja To: "user@hive.apache.org" , "ashwanthkumar@googlemail.com" Subject: RE: add column to hive table Thread-Topic: add column to hive table Thread-Index: AQHNJyR+Sd65PIeZ+UalJimp0q513Za0HwnQgAGIcCA= Date: Wed, 2 May 2012 00:38:15 +0000 Message-ID: <15C962F3417BF94ABEAB2314AF92A16A1457C2F9@SVR-PR-MB1.cb.careerbuilder.com> References: <15C962F3417BF94ABEAB2314AF92A16A1457B1AB@SVR-PR-MB1.cb.careerbuilder.com> <15C962F3417BF94ABEAB2314AF92A16A1457B7DF@SVR-PR-MB1.cb.careerbuilder.com> In-Reply-To: <15C962F3417BF94ABEAB2314AF92A16A1457B7DF@SVR-PR-MB1.cb.careerbuilder.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.10.12.86] Content-Type: multipart/alternative; boundary="_000_15C962F3417BF94ABEAB2314AF92A16A1457C2F9SVRPRMB1cbcaree_" MIME-Version: 1.0 --_000_15C962F3417BF94ABEAB2314AF92A16A1457C2F9SVRPRMB1cbcaree_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable In my situation, the tables I was importing into hive are daily tables. Co= uple of columns were added in a month which are not added to the end of the= table. Also one field got dropped in between. Also I have data for a year. Anyway the way, I handled is, created an external table on top of the older= data and sqoop imported specifying columns in the query tag of the sqoop i= mport into the hive external table. Had to have three different sqoop impo= rts for the three periods. Anyway got them all together so nobody will not= ice the change :) --Chalcy From: Chalcy Raja [mailto:Chalcy.Raja@careerbuilder.com] Sent: Monday, April 30, 2012 9:08 PM To: user@hive.apache.org; ashwanthkumar@googlemail.com Subject: RE: add column to hive table Good idea! Ashwanth. See if this can work for me and let you know. Thanks, CHalcy From: ashwanth.kumar@gmail.com [mailto:ashwanth.kumar@gmail.com] On Behalf = Of Ashwanth Kumar Sent: Monday, April 30, 2012 6:55 PM To: user@hive.apache.org Subject: Re: add column to hive table You can only add columns at the end. If you are using the native SerDe try ALTER TABLE tbl_name REPLACE COLUMNS (column1 int, mynewcolumn string, colu= mn2 int); More information on Hive Wiki - https://cwiki.apache.org/Hive/languagemanua= l-ddl.html#LanguageManualDDL-Add%252FReplaceColumns On Tue, May 1, 2012 at 4:12 AM, Chalcy Raja > wrote: Hi all, Adding a column by alter table mytable add column (mynewcolumn string); wor= ks well for me. This adds a field to the end of the schema. Is there a way to add a column in between two columns? Thanks, Chalcy -- Ashwanth Kumar / ashwanthkumar.in --_000_15C962F3417BF94ABEAB2314AF92A16A1457C2F9SVRPRMB1cbcaree_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

In my situation, the tables I was importing = into hive are daily tables.  Couple of columns were added in a month w= hich are not added to the end of the table. Also one field got dropped in between. Also I have data for a year. 

 

Anyway the way, I handled is, created an ext= ernal table on top of the older data and sqoop imported specifying columns = in the query tag of the sqoop import into the hive external table.  Had to have three different sqoop imports for t= he three periods.  Anyway got them all together so nobody will notice = the change J

 

--Chalcy

 

From: Chalcy R= aja [mailto:Chalcy.Raja@careerbuilder.com]
Sent: Monday, April 30, 2012 9:08 PM
To: user@hive.apache.org; ashwanthkumar@googlemail.com
Subject: RE: add column to hive table

 

Good idea! Ashwanth.  See if this can w= ork for me and let you know.

 

Thanks,

CHalcy

 

From: ashwanth= .kumar@gmail.com [mailto:ashwanth.kumar@gmail.com] On Behalf Of Ashwanth Kumar
Sent: Monday, April 30, 2012 6:55 PM
To: user@hive.apache.org
Subject: Re: add column to hive table

 

You can only add colu= mns at the end. If you are using the native SerDe try

ALTER TABLE tbl_name REPLACE COLUMNS (column1 int, mynewcolumn string, colu= mn2 int);

More information on Hive Wiki - https://cwiki.apache.org/Hive/languagemanual-ddl.html#LanguageManualDDL-Add= %252FReplaceColumns

On Tue, May 1, 2012 at 4:12 AM, Chalcy Raja <Chalcy.Raja@= careerbuilder.com> wrote:

Hi all,

Adding a column by alter table mytable add column (mynewcolumn s= tring); works well for me.  This adds a field to the end of the schema. 

Is there a way to add a column in between two columns?

Thanks,

Chalcy

 

 




--

 

Ashwanth Kumar / ashwanthkumar.in

 

 

--_000_15C962F3417BF94ABEAB2314AF92A16A1457C2F9SVRPRMB1cbcaree_--