keyNum = this.plan.getPartitionMethod().getExpressionSchema().size();
keyIds = new int[keyNum];
keyNames = new String[keyNum];
for (int i = 0; i < keyNum; i++) {
Column column = this.plan.getPartitionMethod().getExpressionSchema().getColumn(i);
keyNames[i] = column.getSimpleName();
if (this.plan.getType() == NodeType.INSERT) {
InsertNode insertNode = ((InsertNode)plan);
int idx = insertNode.getTableSchema().getColumnId(column.getQualifiedName());
keyIds[i] = idx;
} else if (this.plan.getType() == NodeType.CREATE_TABLE) {
CreateTableNode createTable = (CreateTableNode) plan;
int idx = createTable.getLogicalSchema().getColumnId(column.getQualifiedName());
keyIds[i] = idx;
} else {
// We can get partition column from a logical schema.
// Don't use output schema because it is rewritten.
keyIds[i] = plan.getOutSchema().getColumnId(column.getQualifiedName());
}
}
}