You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "leo65535 (via GitHub)" <gi...@apache.org> on 2023/03/24 01:43:18 UTC

[GitHub] [incubator-paimon] leo65535 commented on a diff in pull request #702: [core] Return sorted snapshot rows by default

leo65535 commented on code in PR #702:
URL: https://github.com/apache/incubator-paimon/pull/702#discussion_r1147036936


##########
paimon-core/src/main/java/org/apache/paimon/table/system/SnapshotsTable.java:
##########
@@ -194,11 +195,18 @@ public RecordReader<InternalRow> createReader(Split split) throws IOException {
             Path location = ((SnapshotsSplit) split).location;
             Iterator<Snapshot> snapshots = new SnapshotManager(fileIO, location).snapshots();
             Iterator<InternalRow> rows = Iterators.transform(snapshots, this::toRow);
-            if (projection != null) {
+
+            if (projection != null && projection.length != 0) {
                 rows =
                         Iterators.transform(
                                 rows, row -> ProjectedRow.from(projection).replaceRow(row));
             }
+
+            rows =
+                    Arrays.stream(Iterators.toArray(rows, InternalRow.class))
+                            .sorted(Comparator.comparingLong(row -> row.getLong(0)))
+                            .iterator();
+

Review Comment:
   hi, it will be more complex if we do that, so let's keep it.



-- 
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