* In the column partitioned table, a path has an important role to
* indicate partition keys. In this time, it is right. Later, we have to fix it.
*/
private void rewriteColumnPartitionedTableSchema() throws IOException {
PartitionMethodDesc partitionDesc = plan.getTableDesc().getPartitionMethod();
Schema columnPartitionSchema = SchemaUtil.clone(partitionDesc.getExpressionSchema());
String qualifier = inSchema.getColumn(0).getQualifier();
columnPartitionSchema.setQualifier(qualifier);
// Remove partition key columns from an input schema.
this.inSchema = plan.getTableDesc().getSchema();
List<FileFragment> fileFragments = FragmentConvertor.convert(FileFragment.class, fragments);
// Get a partition key value from a given path
Tuple partitionRow =
TupleUtil.buildTupleFromPartitionPath(columnPartitionSchema, fileFragments.get(0).getPath(), false);
// Targets or search conditions may contain column references.
// However, actual values absent in tuples. So, Replace all column references by constant datum.
for (Column column : columnPartitionSchema.toArray()) {
FieldEval targetExpr = new FieldEval(column);
Datum datum = targetExpr.eval(columnPartitionSchema, partitionRow);
ConstEval constExpr = new ConstEval(datum);
for (Target target : plan.getTargets()) {