for (int i = dataFieldsCount; i < totalFieldsCount; ++i) {
hCatPartitionSchemaFields.add(hCatFullTableSchema.get(i));
}
}
hCatPartitionSchema = new HCatSchema(hCatPartitionSchemaFields);
for (HCatFieldSchema hfs : hCatPartitionSchemaFields) {
if (hfs.getType() != HCatFieldSchema.Type.STRING) {
throw new IOException("The table provided "
+ getQualifiedHCatTableName()
+ " uses unsupported partitioning key type for column "
+ hfs.getName() + " : " + hfs.getTypeString() + ". Only string "
+ "fields are allowed in partition columns in HCatalog");
}
}
LOG.info("HCatalog table partitioning key fields = "
+ Arrays.toString(hCatPartitionSchema.getFieldNames().toArray()));
List<HCatFieldSchema> outputFieldList = new ArrayList<HCatFieldSchema>();
for (String col : dbColumnNames) {
HCatFieldSchema hfs = hCatFullTableSchema.get(col);
if (hfs == null) {
throw new IOException("Database column " + col + " not found in "
+ " hcatalog table.");
}
boolean skip=false;
if (hCatStaticPartitionKeys != null) {
for (String key : hCatStaticPartitionKeys) {
if (col.equals(key)) {
skip=true;
break;
}
}
}
if (skip) {
continue;
}
outputFieldList.add(hCatFullTableSchema.get(col));
}
projectedSchema = new HCatSchema(outputFieldList);
LOG.info("HCatalog projected schema fields = "
+ Arrays.toString(projectedSchema.getFieldNames().toArray()));
validateStaticPartitionKey();