hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joy SN (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HIVE-11797) Alter table change columnname doesn't work on avro serde hive table
Date Fri, 11 Sep 2015 05:35:45 GMT
Joy SN created HIVE-11797:
-----------------------------

             Summary: Alter table change columnname doesn't work on avro serde hive table
                 Key: HIVE-11797
                 URL: https://issues.apache.org/jira/browse/HIVE-11797
             Project: Hive
          Issue Type: Bug
            Reporter: Joy SN


We create a table using Avro serde 
Hive table name hive_t1.
Then we try to change the column name.
The commands ends successfully but the name of the column is not modified.

create table if not exists hive_t1
partitioned by (p1 int)
row format SERDE 'org.apache.hadoop.hive.serde2.avro.AvroSerDe'
STORED AS
INPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat'
TBLPROPERTIES ('avro.schema.literal'='{
  "namespace": "testing.hive.avro.serde",
  "name": "avro_table",
  "type": "record",
  "fields": [
    {
      "name":"number1",
      "type":"int",
      "doc":"Order of playing the role"
    },
    {
      "name":"first_name",
      "type":"string",
      "doc":"first name of actor playing role"
    },
    {
      "name":"last_name",
      "type":"string",
      "doc":"last name of actor playing role"
    },
    {
      "name":"extra_field",
      "type":"string",
      "doc:":"an extra field not in the original file",
      "default":"fishfingers and custard"
    }
  ]
}');

hive> alter table hive_t1 change column number number1 int;
OK
Time taken: 0.12 seconds
hive> select * from hive_t1 limit 5;
OK
hive_t1.number       hive_t1.first_name   hive_t1.last_name    hive_t1.extra_field  hive_t1.p1
6       Colin   Baker   fishfingers and custard 100
3       Jon     Pertwee fishfingers and custard 100
4       Tom     Baker   fishfingers and custard 100
5       Peter   Davison fishfingers and custard 100
11      Matt    Smith   fishfingers and custard 100
Time taken: 0.05 seconds, Fetched: 5 row(s)
hive> describe hive_t1;
OK
col_name        data_type       comment
number                  int                     from deserializer   
first_name              string                  from deserializer   
last_name               string                  from deserializer   
extra_field             string                  from deserializer   
p1                      int                                         
                 
# Partition Information          
# col_name              data_type               comment             
                 
p1                      int                                         
Time taken: 0.051 seconds, Fetched: 10 row(s)

-- Using the below command also the column name is not changed from "number" to "number1"

hive> alter table hive_t1 change number number1 int;
OK
Time taken: 0.081 seconds
hive>  describe hive_t1;
OK
col_name        data_type       comment
number                  int                     from deserializer   
first_name              string                  from deserializer   
last_name               string                  from deserializer   
extra_field             string                  from deserializer   
p1                      int                                         
                 
# Partition Information          
# col_name              data_type               comment             
                 
p1                      int                                         
Time taken: 0.054 seconds, Fetched: 10 row(s)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message