3

I have a hive table where the column names are longer than the usual. I referred to the hive metastore for the table definition. This is how it looks:

DESCRIBE hive.columns_v2;

Output:

Name        ||  Null      ||   Type           
-----------    -------- -------------- 
CD_ID       ||  NOT NULL  || NUMBER         
COMMENT     ||            || VARCHAR2(256)  
COLUMN_NAME || NOT NULL   || VARCHAR2(128)  
TYPE_NAME   || NOT NULL   || VARCHAR2(4000) 
INTEGER_IDX || NOT NULL   || NUMBER(10)   

I can see the column_name defined as varchar2 of 128 bytes. Is there a hive metastore setting where I can alter this value?

Update: Please refer to this ticket where the problem has been explained clearly. https://issues.apache.org/jira/browse/HIVE-9815

The idea is to change MAX_STRING_SIZE is set to EXTENDED on the database itself. But this will mess up a lot of other things on the database.

Any workarounds to this?

trips
  • 111
  • 1
  • 9

1 Answers1

0

This might work :

ALTER TABLE table_name CHANGE [COLUMN] col_old_name col_new_name column_type [COMMENT col_comment] [FIRST|AFTER column_name]

Example:

CREATE TABLE table_name (a int, b int, c int);

// will change column a's name to a1 ALTER TABLE table_name CHANGE a a1 INT;

Sohil Shivani
  • 336
  • 4
  • 19