You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "Zouxxyy (via GitHub)" <gi...@apache.org> on 2024/10/09 01:51:24 UTC
Re: [PR] [spark] Support nested col pruning [paimon]
Zouxxyy commented on code in PR #4269:
URL: https://github.com/apache/paimon/pull/4269#discussion_r1792685304
##########
paimon-format/src/main/java/org/apache/paimon/format/parquet/ParquetReaderFactory.java:
##########
@@ -155,13 +156,37 @@ private MessageType clipParquetSchema(GroupType parquetSchema) {
ParquetSchemaConverter.convertToParquetType(fieldName, projectedTypes[i]);
unknownFieldsIndices.add(i);
} else {
- types[i] = parquetSchema.getType(fieldName);
+ Type type = parquetSchema.getType(fieldName);
+ if (type instanceof GroupType && projectedTypes[i] instanceof RowType) {
+ type = clipParquetGroup((GroupType) type, (RowType) projectedTypes[i]);
+ }
+ types[i] = type;
}
}
return Types.buildMessage().addFields(types).named("paimon-parquet");
}
+ /** Clips `parquetGroup` by `requestedRowType`. */
+ private GroupType clipParquetGroup(GroupType parquetGroup, RowType requestedRowType) {
+ Types.GroupBuilder<GroupType> builder = Types.buildGroup(parquetGroup.getRepetition());
+ List<DataField> fields = requestedRowType.getFields();
+ for (DataField field : fields) {
+ String fieldName = field.name();
+ if (parquetGroup.containsField(fieldName)) {
+ Type type = parquetGroup.getType(fieldName);
+ if (type instanceof GroupType && field.type() instanceof RowType) {
Review Comment:
It support, update
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org