Map/Reduce jobs that use HCatalog APIs to write to Hive tables using Dynamic partitioning are expected to call the following API methods:
- HCatOutputFormat.setOutput() to indicate which table/partitions to write to. This call populates the OutputJobInfo with details fetched from the Metastore.
- HCatOutputFormat.setSchema() to indicate the output-schema for the data being written.
It is a common mistake to invoke HCatOUtputFormat.setSchema() as follows:
Unfortunately, getTableSchema() returns only the record-schema, not the entire table's schema. We'll need a better API for use in M/R jobs to get the complete table-schema.