JingsongLi commented on code in PR #4204: URL: https://github.com/apache/paimon/pull/4204#discussion_r1770723374
########## paimon-core/src/main/java/org/apache/paimon/table/system/FilesTable.java: ########## @@ -170,23 +179,56 @@ public InnerTableScan withFilter(Predicate pushdown) { @Override public Plan innerPlan() { + List<BinaryRow> partitions = new ArrayList<>(); + if (partitionPredicate != null + && !fileStoreTable.partitionKeys().isEmpty() + && partitionPredicate.function() instanceof Equal) { + GenericRow partitionRow = new GenericRow(fileStoreTable.partitionKeys().size()); + RowType partitionRowType = fileStoreTable.schema().logicalPartitionType(); + String partitionStr = partitionPredicate.literals().get(0).toString(); + if (partitionStr.startsWith("[")) { + partitionStr = partitionStr.substring(1); + } + if (partitionStr.endsWith("]")) { + partitionStr = partitionStr.substring(0, partitionStr.length() - 1); + } + String[] partFields = partitionStr.split(", "); + List<String> partitionKeys = fileStoreTable.partitionKeys(); + if (partitionKeys.size() != partFields.length) { + return Collections::emptyList; + } + for (int i = 0; i < partitionKeys.size(); i++) { + partitionRow.setField( + i, + TypeUtils.castFromString(partFields[i], partitionRowType.getTypeAt(i))); + } + + partitions.add( + new SimpleProjection(partitionRowType, fileStoreTable.partitionKeys()) + .apply(partitionRow)); + // TODO support range? + } else { + partitions.addAll(fileStoreTable.newScan().listPartitions()); + } + return () -> - Collections.singletonList( - new FilesSplit(partitionPredicate, bucketPredicate, levelPredicate)); + partitions.stream() + .map(p -> new FilesSplit(p, bucketPredicate, levelPredicate)) + .collect(Collectors.toList()); } } private static class FilesSplit extends SingletonSplit { - @Nullable private final LeafPredicate partitionPredicate; + @Nullable private final BinaryRow partition; @Nullable private final LeafPredicate bucketPredicate; @Nullable private final LeafPredicate levelPredicate; private FilesSplit( - @Nullable LeafPredicate partitionPredicate, + @Nullable BinaryRow partition, Review Comment: Use `@Nullable Map<String, String> partSpec`. You can get this from `InternalRowPartitionComputer`? -- 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-unsubscr...@paimon.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org