You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Neha Tomar (JIRA)" <ji...@apache.org> on 2014/03/04 09:11:20 UTC

[jira] [Commented] (HIVE-5211) ALTER TABLE does not change the type of column for a table with AVRO data

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

Neha Tomar commented on HIVE-5211:
----------------------------------

To add to given description, I noticed that "describe extended" shows updated column type in FieldSchema.

hive> CREATE EXTERNAL TABLE sample_avro 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'
    > LOCATION '/home/neha/test_data/avrodata'
    > TBLPROPERTIES ('avro.schema.literal'='{"type": "record","name": "TUPLE_3","fields": [
    > { "name": "sample_id","type": [ "null", "int" ],"doc": "autogenerated from Pig Field Schema"}
    > ]}'
    > );
OK
Time taken: 0.027 seconds
hive> describe sample_avro;
OK
sample_id               int                     from deserializer
Time taken: 0.07 seconds, Fetched: 1 row(s)
hive> alter table sample_avro change sample_id sample_id bigint;
OK
Time taken: 0.149 seconds
hive> describe sample_avro;
OK
sample_id               int                     from deserializer
Time taken: 0.063 seconds, Fetched: 1 row(s)
hive> describe extended sample_avro;
OK
sample_id               int                     from deserializer

Detailed Table Information      Table(tableName:sample_avro, dbName:avro, owner:biadmin, createTime:1393912627, lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:sample_id, type:bigint, comment:from deserializer)], location:hdfs://localhost:9000/home/neha/test_data/avrodata, inputFormat:org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat, outputFormat:org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat, compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, serializationLib:org.apache.hadoop.hive.serde2.avro.AvroSerDe, parameters:{serialization.format=1}), bucketCols:[], sortCols:[], parameters:{}, skewedInfo:SkewedInfo(skewedColNames:[], skewedColValues:[], skewedColValueLocationMaps:{}), storedAsSubDirectories:false), partitionKeys:[], parameters:{last_modified_by=biadmin, last_modified_time=1393912636, EXTERNAL=TRUE, transient_lastDdlTime=1393912636, avro.schema.literal={"type": "record","name": "TUPLE_3","fields": [
{ "name": "sample_id","type": [ "null", "int" ],"doc": "autogenerated from Pig Field Schema"}
]}}, viewOriginalText:null, viewExpandedText:null, tableType:EXTERNAL_TABLE)
Time taken: 0.076 seconds, Fetched: 5 row(s)


> ALTER TABLE does not change the type of column for a table with AVRO data
> -------------------------------------------------------------------------
>
>                 Key: HIVE-5211
>                 URL: https://issues.apache.org/jira/browse/HIVE-5211
>             Project: Hive
>          Issue Type: Bug
>          Components: Metastore
>    Affects Versions: 0.11.0
>            Reporter: Neha Tomar
>              Labels: avro
>
> 1 >> Created a table in Hive with AVRO data.
> hive> CREATE EXTERNAL TABLE sample 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'
>     > LOCATION '/home/neha/test_data/avrodata'
>     > TBLPROPERTIES ('avro.schema.literal'='{"type": "record","name": "TUPLE_3","fields": [ { "name": "sample_id","type": [ "null", "int" ],"doc": "autogenerated from Pig Field Schema"} ]}'
>     > );
> OK
> Time taken: 0.16 seconds
> hive> describe sample;
> OK
> sample_id           	int                 	from deserializer   
> Time taken: 0.516 seconds, Fetched: 1 row(s)
> >> Alter the type of column from int to bigint. It displays "OK" as the result of DDL execution. However, describing the table still shows previous data type.
> hive> alter table sample change sample_id int bigint;
> OK
> Time taken: 0.614 seconds
> hive> describe sample;                               
> OK
> sample_id           	int                 	from deserializer   
> Time taken: 0.4 seconds, Fetched: 1 row(s)



--
This message was sent by Atlassian JIRA
(v6.2#6252)