You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "tkalkirill (via GitHub)" <gi...@apache.org> on 2023/11/14 14:24:47 UTC
[PR] IGNITE-20857 Returns a sorted list by index ID from a catalog [ignite-3]
tkalkirill opened a new pull request, #2837:
URL: https://github.com/apache/ignite-3/pull/2837
https://issues.apache.org/jira/browse/IGNITE-20857
Thank you for submitting the pull request.
To streamline the review process of the patch and ensure better code quality
we ask both an author and a reviewer to verify the following:
### The Review Checklist
- [ ] **Formal criteria:** TC status, codestyle, mandatory documentation. Also make sure to complete the following:
\- There is a single JIRA ticket related to the pull request.
\- The web-link to the pull request is attached to the JIRA ticket.
\- The JIRA ticket has the Patch Available state.
\- The description of the JIRA ticket explains WHAT was made, WHY and HOW.
\- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
- [ ] **Design:** new code conforms with the design principles of the components it is added to.
- [ ] **Patch quality:** patch cannot be split into smaller pieces, its size must be reasonable.
- [ ] **Code quality:** code is clean and readable, necessary developer documentation is added if needed.
- [ ] **Tests code quality:** test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.
### Notes
- [Apache Ignite Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide)
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-20857 Returns a sorted list by index ID from a catalog [ignite-3]
Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill commented on code in PR #2837:
URL: https://github.com/apache/ignite-3/pull/2837#discussion_r1395668252
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/Catalog.java:
##########
@@ -155,4 +172,23 @@ public Collection<CatalogZoneDescriptor> zones() {
public String toString() {
return S.toString(this);
}
+
+ private static Int2ObjectMap<List<CatalogIndexDescriptor>> toIndexesByTableId(Collection<CatalogSchemaDescriptor> schemas) {
+ Int2ObjectMap<List<CatalogIndexDescriptor>> indexesByTableId = new Int2ObjectOpenHashMap<>();
+
+ for (CatalogSchemaDescriptor schema : schemas) {
+ for (CatalogTableDescriptor table : schema.tables()) {
+ int tableId = table.id();
+
+ List<CatalogIndexDescriptor> tableIndexes = Arrays.stream(schema.indexes())
Review Comment:
fix 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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-20857 Returns a sorted list by index ID from a catalog [ignite-3]
Posted by "ibessonov (via GitHub)" <gi...@apache.org>.
ibessonov commented on code in PR #2837:
URL: https://github.com/apache/ignite-3/pull/2837#discussion_r1395342758
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/Catalog.java:
##########
@@ -155,4 +172,23 @@ public Collection<CatalogZoneDescriptor> zones() {
public String toString() {
return S.toString(this);
}
+
+ private static Int2ObjectMap<List<CatalogIndexDescriptor>> toIndexesByTableId(Collection<CatalogSchemaDescriptor> schemas) {
+ Int2ObjectMap<List<CatalogIndexDescriptor>> indexesByTableId = new Int2ObjectOpenHashMap<>();
+
+ for (CatalogSchemaDescriptor schema : schemas) {
+ for (CatalogTableDescriptor table : schema.tables()) {
+ int tableId = table.id();
+
+ List<CatalogIndexDescriptor> tableIndexes = Arrays.stream(schema.indexes())
Review Comment:
We may have a substantial number of tables and indexes. Currently, for `N` tables and `M` indexes, your code looks like `O(N*M*foo(M))`. I struggle to estimate `foo` in my head (sorting overhead), but it's definitely below `log(M)`. The main problem is in `N*M` multiplication.
What if we only iterated over the `schema.indexes()` once, creating a list in `indexesByTableId` lazily and sorting everything at the very end? Complexity would become about `O((N+M)*foo(M))`, I believe. We reduce it be removing extra loop and filtering.
In all calculations I assumed hash-table access to be `O(1)`, I mention this just in case
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-20857 Returns a sorted list by index ID from a catalog [ignite-3]
Posted by "ibessonov (via GitHub)" <gi...@apache.org>.
ibessonov commented on code in PR #2837:
URL: https://github.com/apache/ignite-3/pull/2837#discussion_r1395342758
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/Catalog.java:
##########
@@ -155,4 +172,23 @@ public Collection<CatalogZoneDescriptor> zones() {
public String toString() {
return S.toString(this);
}
+
+ private static Int2ObjectMap<List<CatalogIndexDescriptor>> toIndexesByTableId(Collection<CatalogSchemaDescriptor> schemas) {
+ Int2ObjectMap<List<CatalogIndexDescriptor>> indexesByTableId = new Int2ObjectOpenHashMap<>();
+
+ for (CatalogSchemaDescriptor schema : schemas) {
+ for (CatalogTableDescriptor table : schema.tables()) {
+ int tableId = table.id();
+
+ List<CatalogIndexDescriptor> tableIndexes = Arrays.stream(schema.indexes())
Review Comment:
We may have a substantial number of tables and indexes. Currently, for `N` tables and `M` indexes, your code looks like `O(N*M*foo(M))`. I struggle to estimate `foo` in my head (sorting overhead), but it's definitely below `log(M)`. The main problem is in `N*M` multiplication.
What if we only iterated over the `schema.indexes()` once, creating a list in `indexesByTableId` lazily and sorting everything at the very end? Complexity would become about `O((N+M)*log(M))`, I believe. We reduce it be removing extra loop and filtering.
In all calculations I assumed hash-table access to be `O(1)`, I mention this just in case
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-20857 Returns a sorted list by index ID from a catalog [ignite-3]
Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill merged PR #2837:
URL: https://github.com/apache/ignite-3/pull/2837
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org