diff --git a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/HCatBaseOutputFormat.java b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/HCatBaseOutputFormat.java index 3e2ed97..6c09e6f 100644 --- a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/HCatBaseOutputFormat.java +++ b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/mapreduce/HCatBaseOutputFormat.java @@ -43,8 +43,9 @@ /** * Gets the table schema for the table specified in the HCatOutputFormat.setOutput call * on the specified job context. + * Note: This is the record-schema for the table. It does not include the table's partition columns. * @param conf the Configuration object - * @return the table schema + * @return the table schema, excluding partition columns * @throws IOException if HCatOutputFormat.setOutput has not been called for the passed context */ public static HCatSchema getTableSchema(Configuration conf) throws IOException { @@ -53,6 +54,18 @@ public static HCatSchema getTableSchema(Configuration conf) throws IOException { } /** + * Gets the table schema for the table specified in the HCatOutputFormat.setOutput call + * on the specified job context. + * Note: This is the complete table-schema, including the record-schema *and* the partitioning schema. + * @param conf the Configuration object + * @return the table schema, including the record-schema and partitioning schema. + * @throws IOException if HCatOutputFormat.setOutput has not been called for the passed context + */ + public static HCatSchema getTableSchemaWithPartitionColumns(Configuration conf) throws IOException { + return getJobInfo(conf).getTableInfo().getAllColumns(); + } + + /** * Check for validity of the output-specification for the job. * @param context information about the job * @throws IOException when output should not be attempted