You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "askwang (via GitHub)" <gi...@apache.org> on 2024/10/10 09:36:23 UTC

[PR] [core] Sort some system table query result [paimon]

askwang opened a new pull request, #4306:
URL: https://github.com/apache/paimon/pull/4306

   <!-- Please specify the module before the PR name: [core] ... or [flink] ... -->
   
   ### Purpose
   
   Sort some system table query result, including tags/partitions/buckets tables.
   
   <!-- What is the purpose of the change -->
   
   ### Tests
   
   <!-- List UT and IT cases to verify this change -->
   
   ### API and Format
   
   <!-- Does this change affect API or storage format -->
   
   ### Documentation
   
   <!-- Does this change introduce a new feature -->
   


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


Re: [PR] [core] Sort some system table query result [paimon]

Posted by "wwj6591812 (via GitHub)" <gi...@apache.org>.
wwj6591812 commented on PR #4306:
URL: https://github.com/apache/paimon/pull/4306#issuecomment-2404642957

   Good, I think no problem, but ut failed.
   @askwang 


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


Re: [PR] [core] Sort some system table query result [paimon]

Posted by "jiangjin-f (via GitHub)" <gi...@apache.org>.
jiangjin-f commented on code in PR #4306:
URL: https://github.com/apache/paimon/pull/4306#discussion_r1797612400


##########
paimon-core/src/main/java/org/apache/paimon/table/system/BucketsTable.java:
##########
@@ -181,9 +184,24 @@ public RecordReader<InternalRow> createReader(Split split) {
                     new RowDataToObjectArrayConverter(
                             fileStoreTable.schema().logicalPartitionType());
 
+            // sorted by partition and bucket
+            List<Pair<String, BucketEntry>> bucketList =
+                    buckets.stream()
+                            .map(
+                                    entry ->
+                                            Pair.of(
+                                                    Arrays.toString(
+                                                            converter.convert(entry.partition())),
+                                                    entry))
+                            .sorted(
+                                    Comparator.comparing(
+                                                    (Pair<String, BucketEntry> p) -> p.getLeft())
+                                            .thenComparing(p -> p.getRight().bucket()))

Review Comment:
   .map(pair -> toRow(pair.getLeft(), pair.getRight()))



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


Re: [PR] [core] Sort some system table query result [paimon]

Posted by "askwang (via GitHub)" <gi...@apache.org>.
askwang commented on PR #4306:
URL: https://github.com/apache/paimon/pull/4306#issuecomment-2404821360

   > Good, I think no problem, but ut failed. @askwang
   
   fixed, thanks. personal  repository ut is success


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


Re: [PR] [core] Sort some system table query result [paimon]

Posted by "askwang (via GitHub)" <gi...@apache.org>.
askwang commented on code in PR #4306:
URL: https://github.com/apache/paimon/pull/4306#discussion_r1796511967


##########
paimon-core/src/main/java/org/apache/paimon/table/system/BucketsTable.java:
##########
@@ -181,9 +184,22 @@ public RecordReader<InternalRow> createReader(Split split) {
                     new RowDataToObjectArrayConverter(
                             fileStoreTable.schema().logicalPartitionType());
 
+            // sorted by partition and bucket
+            Map<Pair<String, Integer>, BucketEntry> pairBucketsMap =
+                    new TreeMap<>(
+                            Comparator.comparing((Pair<String, Integer> o) -> o.getLeft())
+                                    .thenComparing(Pair::getRight));
+            buckets.forEach(

Review Comment:
   A little difference, change `List<BucketEntry> buckets` to `List<Pair<String, BucketEntry>> bucketList`, to avoid `converter.convert(e.partition())` compute twice.



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


Re: [PR] [core] Sort some system table query result [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #4306:
URL: https://github.com/apache/paimon/pull/4306


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


Re: [PR] [core] Sort some system table query result [paimon]

Posted by "jiangjin-f (via GitHub)" <gi...@apache.org>.
jiangjin-f commented on code in PR #4306:
URL: https://github.com/apache/paimon/pull/4306#discussion_r1797612400


##########
paimon-core/src/main/java/org/apache/paimon/table/system/BucketsTable.java:
##########
@@ -181,9 +184,24 @@ public RecordReader<InternalRow> createReader(Split split) {
                     new RowDataToObjectArrayConverter(
                             fileStoreTable.schema().logicalPartitionType());
 
+            // sorted by partition and bucket
+            List<Pair<String, BucketEntry>> bucketList =
+                    buckets.stream()
+                            .map(
+                                    entry ->
+                                            Pair.of(
+                                                    Arrays.toString(
+                                                            converter.convert(entry.partition())),
+                                                    entry))
+                            .sorted(
+                                    Comparator.comparing(
+                                                    (Pair<String, BucketEntry> p) -> p.getLeft())
+                                            .thenComparing(p -> p.getRight().bucket()))

Review Comment:
   .map(pair -> toRow(pair.getLeft(), pair.getRight()))



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


Re: [PR] [core] Sort some system table query result [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #4306:
URL: https://github.com/apache/paimon/pull/4306#discussion_r1796454875


##########
paimon-core/src/main/java/org/apache/paimon/table/system/BucketsTable.java:
##########
@@ -181,9 +184,22 @@ public RecordReader<InternalRow> createReader(Split split) {
                     new RowDataToObjectArrayConverter(
                             fileStoreTable.schema().logicalPartitionType());
 
+            // sorted by partition and bucket
+            Map<Pair<String, Integer>, BucketEntry> pairBucketsMap =
+                    new TreeMap<>(
+                            Comparator.comparing((Pair<String, Integer> o) -> o.getLeft())
+                                    .thenComparing(Pair::getRight));
+            buckets.forEach(

Review Comment:
   ```
   Function<BucketEntry, String> toPartString = e -> Arrays.toString(converter.convert(e.partition()));
   buckets.sort(Comparator.comparing(toPartString).thenComparing(BucketEntry::bucket));
   ```



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