You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Naveen Gangam (JIRA)" <ji...@apache.org> on 2017/12/04 16:31:00 UTC

[jira] [Commented] (HIVE-17333) Schema changes in HIVE-12274 for Oracle may not work for upgrade

    [ https://issues.apache.org/jira/browse/HIVE-17333?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16277046#comment-16277046 ] 

Naveen Gangam commented on HIVE-17333:
--------------------------------------

[~aihuaxu] Could you please review this change? Thanks
Here is the output from running it against oracle. I used temp tables instead of the actual ones in this test.
{code}
SQL> create table COLUMNS_V2_1 as select * from COLUMNS_V2;
create table TABLE_PARAMS_1 as select * from TABLE_PARAMS;
create table SERDE_PARAMS_1 as select * from SERDE_PARAMS;
create table SD_PARAMS_1 as select * from SD_PARAMS;


ALTER TABLE COLUMNS_V2_1 ADD (TEMP CLOB);
UPDATE COLUMNS_V2_1 SET TEMP=TYPE_NAME;
ALTER TABLE COLUMNS_V2_1 DROP COLUMN TYPE_NAME;
ALTER TABLE COLUMNS_V2_1 RENAME COLUMN TEMP TO TYPE_NAME;

ALTER TABLE TABLE_PARAMS_1 ADD (TEMP CLOB);
UPDATE TABLE_PARAMS_1 SET TEMP=PARAM_VALUE, PARAM_VALUE=NULL;
ALTER TABLE TABLE_PARAMS_1 DROP COLUMN PARAM_VALUE;
ALTER TABLE TABLE_PARAMS_1 RENAME COLUMN TEMP TO PARAM_VALUE;

ALTER TABLE SERDE_PARAMS_1 ADD (TEMP CLOB);
UPDATE SERDE_PARAMS_1 SET TEMP=PARAM_VALUE, PARAM_VALUE=NULL;
ALTER TABLE SERDE_PARAMS_1 DROP COLUMN PARAM_VALUE;
ALTER TABLE SERDE_PARAMS_1 RENAME COLUMN TEMP TO PARAM_VALUE;

ALTER TABLE SD_PARAMS_1 ADD (TEMP CLOB);
UPDATE SD_PARAMS_1 SET TEMP=PARAM_VALUE, PARAM_VALUE=NULL;
ALTER TABLE SD_PARAMS_1 DROP COLUMN PARAM_VALUE;
ALTER TABLE SD
Table created.

SQL> 
Table created.

SQL> 
Table created.

SQL> _PARAMS_1 RENAME COLUMN TEMP TO PARAM_VALUE;
Table created.

SQL> SQL> SQL> 
Table altered.

SQL> 
211 rows updated.

SQL> 
Table altered.

SQL> 
Table altered.
SQL> SQL> 
Table altered.

SQL> 
12 rows updated.

SQL> 
Table altered.

SQL> 
Table altered.

SQL> SQL> 
Table altered.

SQL> 
2 rows updated.

SQL> 
Table altered.

SQL> 
Table altered.

SQL> SQL> 
Table altered.
{code}


> Schema changes in HIVE-12274 for Oracle may not work for upgrade
> ----------------------------------------------------------------
>
>                 Key: HIVE-17333
>                 URL: https://issues.apache.org/jira/browse/HIVE-17333
>             Project: Hive
>          Issue Type: Bug
>          Components: Metastore
>    Affects Versions: 3.0.0
>            Reporter: Naveen Gangam
>            Assignee: Naveen Gangam
>         Attachments: HIVE-17333.patch
>
>
> According to https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1770086700346491686 (reported in HIVE-12274)
> The alter table command to change the column datatype from {{VARCHAR}} to {{CLOB}} may not work. So the correct way to accomplish this is to add a new temp column, copy the value from the current column, drop the current column and rename the new column to old column.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)