You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "lowka (via GitHub)" <gi...@apache.org> on 2025/02/24 13:36:45 UTC
[PR] IGNITE-24304 Sql. System views. Introduce a system view for index columns [ignite-3]
lowka opened a new pull request, #5281:
URL: https://github.com/apache/ignite-3/pull/5281
https://issues.apache.org/jira/browse/IGNITE-24304
---
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-24304 Sql. System views. Introduce a system view for index columns [ignite-3]
Posted by "AMashenkov (via GitHub)" <gi...@apache.org>.
AMashenkov commented on code in PR #5281:
URL: https://github.com/apache/ignite-3/pull/5281#discussion_r1969943648
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/systemviews/IndexColumnsSystemViewProvider.java:
##########
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.catalog.systemviews;
+
+import static org.apache.ignite.internal.type.NativeTypes.INT32;
+import static org.apache.ignite.internal.type.NativeTypes.STRING;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.Flow.Publisher;
+import java.util.function.Supplier;
+import java.util.stream.Stream;
+import org.apache.ignite.internal.catalog.Catalog;
+import org.apache.ignite.internal.catalog.CatalogSystemViewProvider;
+import org.apache.ignite.internal.catalog.descriptors.CatalogColumnCollation;
+import org.apache.ignite.internal.catalog.descriptors.CatalogHashIndexDescriptor;
+import org.apache.ignite.internal.catalog.descriptors.CatalogIndexDescriptor;
+import org.apache.ignite.internal.catalog.descriptors.CatalogSchemaDescriptor;
+import org.apache.ignite.internal.catalog.descriptors.CatalogSortedIndexDescriptor;
+import org.apache.ignite.internal.catalog.descriptors.CatalogTableDescriptor;
+import org.apache.ignite.internal.systemview.api.ClusterSystemView;
+import org.apache.ignite.internal.systemview.api.SystemView;
+import org.apache.ignite.internal.systemview.api.SystemViews;
+import org.apache.ignite.internal.util.SubscriptionUtils;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Exposes information on index columns.
+ *
+ * <ul>
+ * <li>INDEX_COLUMNS system view</li>
+ * </ul>
+ */
+public class IndexColumnsSystemViewProvider implements CatalogSystemViewProvider {
+ /** {@inheritDoc} */
+ @Override
+ public List<SystemView<?>> getView(Supplier<Catalog> catalogSupplier) {
+ Iterable<IndexColumn> indexColumns = () -> {
+ Catalog catalog = catalogSupplier.get();
+
+ return catalog.schemas().stream()
+ .flatMap(schema -> Arrays.stream(schema.indexes()).flatMap(index -> {
+ CatalogTableDescriptor table = catalog.table(index.tableId());
+ if (table == null) {
+ return Stream.empty();
+ } else {
+ return Stream.of(new IndexColumnContainer(schema, table, index));
+ }
+ }))
+ .flatMap(container -> {
+ switch (container.index.indexType()) {
+ case HASH:
+ return createHashIndexColumns(container, (CatalogHashIndexDescriptor) container.index);
+ case SORTED:
+ return createSortedIndexColumns(container, (CatalogSortedIndexDescriptor) container.index);
+ default:
+ return Stream.empty();
+ }
+ }).iterator();
+ };
+
+ Publisher<IndexColumn> viewDataPublisher = SubscriptionUtils.fromIterable(indexColumns);
+
+ ClusterSystemView<IndexColumn> systemView = SystemViews.<IndexColumn>clusterViewBuilder()
+ .name("INDEX_COLUMNS")
+ .addColumn("SCHEMA_ID", INT32, col -> col.container.schemaId)
+ .addColumn("SCHEMA_NAME", STRING, col -> col.container.schemaName)
+ .addColumn("TABLE_ID", INT32, col -> col.container.tableId)
+ .addColumn("TABLE_NAME", STRING, col -> col.container.tableName)
+ .addColumn("INDEX_ID", INT32, col -> col.container.indexId)
+ .addColumn("INDEX_NAME", STRING, col -> col.container.indexName)
+ .addColumn("COLUMN_NAME", STRING, col -> col.columnName)
+ .addColumn("COLUMN_ORDINAL", INT32, col -> col.columnOrdinal)
+ .addColumn("COLLATION", STRING, col -> col.columnCollation)
Review Comment:
```suggestion
.addColumn("COLUMN_COLLATION", STRING, col -> col.columnCollation)
```
--
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-24304 Sql. System views. Introduce a system view for index columns [ignite-3]
Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan merged PR #5281:
URL: https://github.com/apache/ignite-3/pull/5281
--
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-24304 Sql. System views. Introduce a system view for index columns [ignite-3]
Posted by "lowka (via GitHub)" <gi...@apache.org>.
lowka closed pull request #5281: IGNITE-24304 Sql. System views. Introduce a system view for index columns
URL: https://github.com/apache/ignite-3/pull/5281
--
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