Change column datatypes in Hive database

Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I am new to Hive database. Can someone please help me to change the datatype in Hive database? Below is a complete information about the same.
I have a database named "test". It has a table "name". Below is a query I used while creating a column in name table.
create table name(custID String,nameValuePairs array<struct< key:String, value:String>>) row format delimited fields terminated by '/' collection items terminated by '|' map keys terminated by '=' lines terminated by 'n';
Now, I want to change the datatype entry of column name "nameValuePairs".
Currently the column nameValuePairs has datatype array<struct< key:String, value:String>>.
Now I want to change the datatype to array<struct< something:somedatatype, value:String>>.
database sql hadoop apache-hive
add a comment |Â
up vote
1
down vote
favorite
I am new to Hive database. Can someone please help me to change the datatype in Hive database? Below is a complete information about the same.
I have a database named "test". It has a table "name". Below is a query I used while creating a column in name table.
create table name(custID String,nameValuePairs array<struct< key:String, value:String>>) row format delimited fields terminated by '/' collection items terminated by '|' map keys terminated by '=' lines terminated by 'n';
Now, I want to change the datatype entry of column name "nameValuePairs".
Currently the column nameValuePairs has datatype array<struct< key:String, value:String>>.
Now I want to change the datatype to array<struct< something:somedatatype, value:String>>.
database sql hadoop apache-hive
Since this seems to be a sql question, see also dba.stackexchange.com
â Jeff Schaller
Sep 9 '16 at 11:37
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am new to Hive database. Can someone please help me to change the datatype in Hive database? Below is a complete information about the same.
I have a database named "test". It has a table "name". Below is a query I used while creating a column in name table.
create table name(custID String,nameValuePairs array<struct< key:String, value:String>>) row format delimited fields terminated by '/' collection items terminated by '|' map keys terminated by '=' lines terminated by 'n';
Now, I want to change the datatype entry of column name "nameValuePairs".
Currently the column nameValuePairs has datatype array<struct< key:String, value:String>>.
Now I want to change the datatype to array<struct< something:somedatatype, value:String>>.
database sql hadoop apache-hive
I am new to Hive database. Can someone please help me to change the datatype in Hive database? Below is a complete information about the same.
I have a database named "test". It has a table "name". Below is a query I used while creating a column in name table.
create table name(custID String,nameValuePairs array<struct< key:String, value:String>>) row format delimited fields terminated by '/' collection items terminated by '|' map keys terminated by '=' lines terminated by 'n';
Now, I want to change the datatype entry of column name "nameValuePairs".
Currently the column nameValuePairs has datatype array<struct< key:String, value:String>>.
Now I want to change the datatype to array<struct< something:somedatatype, value:String>>.
database sql hadoop apache-hive
database sql hadoop apache-hive
edited Sep 28 '16 at 21:05
Tomasz
8,11752560
8,11752560
asked Sep 9 '16 at 8:43
Nitesh B.
3711417
3711417
Since this seems to be a sql question, see also dba.stackexchange.com
â Jeff Schaller
Sep 9 '16 at 11:37
add a comment |Â
Since this seems to be a sql question, see also dba.stackexchange.com
â Jeff Schaller
Sep 9 '16 at 11:37
Since this seems to be a sql question, see also dba.stackexchange.com
â Jeff Schaller
Sep 9 '16 at 11:37
Since this seems to be a sql question, see also dba.stackexchange.com
â Jeff Schaller
Sep 9 '16 at 11:37
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
You need to use the following ALTER TABLE syntax:
ALTER TABLE table_name CHANGE column_name column_name newType
To break it down, you are:
- Making a change to the table:
ALTER TABLE - Defining what table you are changing:
table_name - Defining what column you will change:
CHANGE column_name - Defining the change (you can also change column_name hence the double mention):
column_name newType
Hope this helps.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You need to use the following ALTER TABLE syntax:
ALTER TABLE table_name CHANGE column_name column_name newType
To break it down, you are:
- Making a change to the table:
ALTER TABLE - Defining what table you are changing:
table_name - Defining what column you will change:
CHANGE column_name - Defining the change (you can also change column_name hence the double mention):
column_name newType
Hope this helps.
add a comment |Â
up vote
0
down vote
You need to use the following ALTER TABLE syntax:
ALTER TABLE table_name CHANGE column_name column_name newType
To break it down, you are:
- Making a change to the table:
ALTER TABLE - Defining what table you are changing:
table_name - Defining what column you will change:
CHANGE column_name - Defining the change (you can also change column_name hence the double mention):
column_name newType
Hope this helps.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
You need to use the following ALTER TABLE syntax:
ALTER TABLE table_name CHANGE column_name column_name newType
To break it down, you are:
- Making a change to the table:
ALTER TABLE - Defining what table you are changing:
table_name - Defining what column you will change:
CHANGE column_name - Defining the change (you can also change column_name hence the double mention):
column_name newType
Hope this helps.
You need to use the following ALTER TABLE syntax:
ALTER TABLE table_name CHANGE column_name column_name newType
To break it down, you are:
- Making a change to the table:
ALTER TABLE - Defining what table you are changing:
table_name - Defining what column you will change:
CHANGE column_name - Defining the change (you can also change column_name hence the double mention):
column_name newType
Hope this helps.
answered Sep 9 '16 at 8:51
I_GNU_it_all_along
1,099418
1,099418
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f308822%2fchange-column-datatypes-in-hive-database%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Since this seems to be a sql question, see also dba.stackexchange.com
â Jeff Schaller
Sep 9 '16 at 11:37