Hive enables table schema evolution via properties. For avro e.g. we can alter the 'avro.schema.url' property to update table schema to the next version. Updating properties however doesn't affect column list stored in metastore DB so the table is not in the newest version when returned from metastore API. This is problem for tools working with metastore (e.g. Presto).
To solve this issue I suggest to introduce new DDL statement syncing metastore columns with those from serde:
Note that this is format independent solution.
To reproduce, follow the instructions below:
- Create table based on avro schema version 1 (cxv1.avsc)
- Update schema to version 2 (cx2.avsc)
- Print serde columns (top info) and metastore columns (Detailed Table Information):