}
if (pigSchema == null) {
throw new FrontendException("Schema for data cannot be determined.",
PigHCatUtil.PIG_EXCEPTION_CODE);
}
HCatSchema hcatTblSchema = new HCatSchema(new ArrayList<HCatFieldSchema>());
try {
doSchemaValidations(pigSchema, hcatTblSchema);
} catch (HCatException he) {
throw new FrontendException(he.getMessage(), PigHCatUtil.PIG_EXCEPTION_CODE, he);
}
List<HCatFieldSchema> hcatFields = new ArrayList<HCatFieldSchema>();
List<String> partVals = new ArrayList<String>();
for (String key : partitions.keySet()) {
hcatFields.add(new HCatFieldSchema(key, HCatFieldSchema.Type.STRING, ""));
partVals.add(partitions.get(key));
}
HCatSchema outputSchema = convertPigSchemaToHCatSchema(pigSchema,
hcatTblSchema);
LOG.debug("Pig Schema '" + pigSchema.toString() + "' was converted to HCatSchema '"
+ outputSchema);
HCatEximOutputFormat.setOutput(job,
dbname, tablename,
outputLocation,
new HCatSchema(hcatFields),
partVals,
outputSchema);
p.setProperty(COMPUTED_OUTPUT_SCHEMA, ObjectSerializer.serialize(outputSchema));
p.setProperty(HCatConstants.HCAT_KEY_OUTPUT_INFO,
config.get(HCatConstants.HCAT_KEY_OUTPUT_INFO));