This is an automated email from the ASF dual-hosted git repository.

tkalkirill pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new a834986d67 IGNITE-20417 Get rid of unused code in the index module 
(#2590)
a834986d67 is described below

commit a834986d676c67031d9283712360750f96de68e0
Author: Kirill Tkalenko <[email protected]>
AuthorDate: Fri Sep 15 07:51:40 2023 +0300

    IGNITE-20417 Get rid of unused code in the index module (#2590)
---
 .../ignite/internal/index/BuildIndexTaskId.java    |  83 -----------
 .../ignite/internal/index/ColumnCollation.java     |  71 ---------
 .../apache/ignite/internal/index/HashIndex.java    |  99 -------------
 .../org/apache/ignite/internal/index/Index.java    |  83 -----------
 .../ignite/internal/index/IndexDescriptor.java     |  57 --------
 .../apache/ignite/internal/index/IndexManager.java | 105 ++++----------
 .../apache/ignite/internal/index/SortedIndex.java  | 111 --------------
 .../internal/index/SortedIndexDescriptor.java      |  73 ----------
 .../ignite/internal/index/SortedIndexImpl.java     | 128 ----------------
 .../internal/index/event/IndexEventParameters.java |  54 ++-----
 .../ignite/internal/index/IndexManagerTest.java    |   5 +-
 .../ignite/internal/index/ItIndexManagerTest.java  |  15 +-
 .../ignite/internal/table/ItTableScanTest.java     |  10 +-
 .../sql/engine/exec/ScannableTableImpl.java        |  10 +-
 .../engine/exec/rel/ScannableTableSelfTest.java    |   7 +-
 .../sql/engine/planner/AbstractPlannerTest.java    | 161 ---------------------
 16 files changed, 66 insertions(+), 1006 deletions(-)

diff --git 
a/modules/index/src/main/java/org/apache/ignite/internal/index/BuildIndexTaskId.java
 
b/modules/index/src/main/java/org/apache/ignite/internal/index/BuildIndexTaskId.java
deleted file mode 100644
index e6c778370d..0000000000
--- 
a/modules/index/src/main/java/org/apache/ignite/internal/index/BuildIndexTaskId.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.index;
-
-import java.util.UUID;
-import org.apache.ignite.internal.tostring.S;
-
-/**
- * ID of the index build task.
- */
-class BuildIndexTaskId {
-    private final int tableId;
-
-    private final UUID indexId;
-
-    private final int partitionId;
-
-    BuildIndexTaskId(int tableId, UUID indexId, int partitionId) {
-        this.tableId = tableId;
-        this.indexId = indexId;
-        this.partitionId = partitionId;
-    }
-
-    int getTableId() {
-        return tableId;
-    }
-
-    UUID getIndexId() {
-        return indexId;
-    }
-
-    int getPartitionId() {
-        return partitionId;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-
-        BuildIndexTaskId that = (BuildIndexTaskId) o;
-
-        if (partitionId != that.partitionId) {
-            return false;
-        }
-        if (tableId != that.tableId) {
-            return false;
-        }
-        return indexId.equals(that.indexId);
-    }
-
-    @Override
-    public int hashCode() {
-        int result = tableId;
-        result = 31 * result + indexId.hashCode();
-        result = 31 * result + partitionId;
-        return result;
-    }
-
-    @Override
-    public String toString() {
-        return S.toString(BuildIndexTaskId.class, this);
-    }
-}
diff --git 
a/modules/index/src/main/java/org/apache/ignite/internal/index/ColumnCollation.java
 
b/modules/index/src/main/java/org/apache/ignite/internal/index/ColumnCollation.java
deleted file mode 100644
index 25dacc22c7..0000000000
--- 
a/modules/index/src/main/java/org/apache/ignite/internal/index/ColumnCollation.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.index;
-
-/**
- * Enumeration of all supported collations.
- */
-public enum ColumnCollation {
-    ASC_NULLS_FIRST(true, true),
-    ASC_NULLS_LAST(true, false),
-    DESC_NULLS_FIRST(false, true),
-    DESC_NULLS_LAST(false, false);
-
-    private final boolean asc;
-    private final boolean nullsFirst;
-
-    /**
-     * Returns collation object for given directions.
-     *
-     * @param asc Whether the values should be sorted in ascending order.
-     * @param nullsFirst Whether to put null values first.
-     * @return A collation object.
-     */
-    public static ColumnCollation get(boolean asc, boolean nullsFirst) {
-        if (asc && nullsFirst) {
-            return ASC_NULLS_FIRST;
-        } else if (asc) {
-            return ASC_NULLS_LAST;
-        } else if (nullsFirst) {
-            return DESC_NULLS_FIRST;
-        } else {
-            return DESC_NULLS_LAST;
-        }
-    }
-
-    /**
-     * Constructs the collation object.
-     *
-     * @param asc Direction of the sorting.
-     * @param nullsFirst Place of the null values in sorted range.
-     */
-    ColumnCollation(boolean asc, boolean nullsFirst) {
-        this.asc = asc;
-        this.nullsFirst = nullsFirst;
-    }
-
-    /** Returns whether the column sorted in ascending order. */
-    public boolean asc() {
-        return asc;
-    }
-
-    /** Returns whether null values should be in the very beginning of the 
range. */
-    public boolean nullsFirst() {
-        return nullsFirst;
-    }
-}
diff --git 
a/modules/index/src/main/java/org/apache/ignite/internal/index/HashIndex.java 
b/modules/index/src/main/java/org/apache/ignite/internal/index/HashIndex.java
deleted file mode 100644
index 88273448e5..0000000000
--- 
a/modules/index/src/main/java/org/apache/ignite/internal/index/HashIndex.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.index;
-
-import java.util.BitSet;
-import java.util.Objects;
-import java.util.UUID;
-import java.util.concurrent.Flow.Publisher;
-import org.apache.ignite.internal.hlc.HybridTimestamp;
-import org.apache.ignite.internal.schema.BinaryRow;
-import org.apache.ignite.internal.schema.BinaryTuple;
-import org.apache.ignite.internal.table.InternalTable;
-import org.apache.ignite.internal.utils.PrimaryReplica;
-import org.apache.ignite.network.ClusterNode;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * An object that represents a hash index.
- */
-public class HashIndex implements Index<IndexDescriptor> {
-    private final int id;
-    private final InternalTable table;
-    private final IndexDescriptor descriptor;
-
-    /**
-     * Constructs the index.
-     *
-     * @param id An identifier of the index.
-     * @param table A table this index relates to.
-     * @param descriptor A descriptor of the index.
-     */
-    public HashIndex(int id, InternalTable table, IndexDescriptor descriptor) {
-        this.id = id;
-        this.table = Objects.requireNonNull(table, "table");
-        this.descriptor = Objects.requireNonNull(descriptor, "descriptor");
-    }
-
-    @Override
-    public int id() {
-        return id;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int tableId() {
-        return table.tableId();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public String name() {
-        return descriptor.name();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public IndexDescriptor descriptor() {
-        return descriptor;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Publisher<BinaryRow> lookup(
-            int partId,
-            UUID txId,
-            PrimaryReplica recipient,
-            BinaryTuple key,
-            @Nullable BitSet columns
-    ) {
-        return table.lookup(partId, txId, recipient, id, key, columns);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Publisher<BinaryRow> lookup(
-            int partId,
-            HybridTimestamp timestamp,
-            ClusterNode recipientNode,
-            BinaryTuple key,
-            @Nullable BitSet columns
-    ) {
-        return table.lookup(partId, timestamp, recipientNode, id, key, 
columns);
-    }
-}
diff --git 
a/modules/index/src/main/java/org/apache/ignite/internal/index/Index.java 
b/modules/index/src/main/java/org/apache/ignite/internal/index/Index.java
deleted file mode 100644
index 70e606d1ba..0000000000
--- a/modules/index/src/main/java/org/apache/ignite/internal/index/Index.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.index;
-
-import java.util.BitSet;
-import java.util.UUID;
-import java.util.concurrent.Flow.Publisher;
-import org.apache.ignite.internal.hlc.HybridTimestamp;
-import org.apache.ignite.internal.schema.BinaryRow;
-import org.apache.ignite.internal.schema.BinaryTuple;
-import org.apache.ignite.internal.utils.PrimaryReplica;
-import org.apache.ignite.network.ClusterNode;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * An object describing an abstract index.
- *
- * <p>Provides access to the indexed data as well as all information about 
index itself.
- */
-public interface Index<DescriptorT extends IndexDescriptor> {
-    /** Returns identifier of the index. */
-    int id();
-
-    /** Returns name of the index. */
-    String name();
-
-    /** Returns table id index belong to. */
-    int tableId();
-
-    /** Returns index descriptor. */
-    DescriptorT descriptor();
-
-    /**
-     * Returns cursor for the values corresponding to the given key.
-     *
-     * @param partId Partition id.
-     * @param txId Transaction id.
-     * @param recipient Primary replica that will handle given get request.
-     * @param key Key to lookup.
-     * @param columns Columns to include.
-     * @return A cursor from resulting rows.
-     */
-    Publisher<BinaryRow> lookup(
-            int partId,
-            UUID txId,
-            PrimaryReplica recipient,
-            BinaryTuple key,
-            @Nullable BitSet columns
-    );
-
-    /**
-     * Returns cursor for the values corresponding to the given key.
-     *
-     * @param partId Partition id.
-     * @param readTimestamp Read timestamp.
-     * @param recipientNode Cluster node that will handle given get request.
-     * @param key Key to search.
-     * @param columns Columns to include.
-     * @return A cursor from resulting rows.
-     */
-    Publisher<BinaryRow> lookup(
-            int partId,
-            HybridTimestamp readTimestamp,
-            ClusterNode recipientNode,
-            BinaryTuple key,
-            @Nullable BitSet columns
-    );
-}
diff --git 
a/modules/index/src/main/java/org/apache/ignite/internal/index/IndexDescriptor.java
 
b/modules/index/src/main/java/org/apache/ignite/internal/index/IndexDescriptor.java
deleted file mode 100644
index 21f0f34678..0000000000
--- 
a/modules/index/src/main/java/org/apache/ignite/internal/index/IndexDescriptor.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.index;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * Description of the index.
- */
-public class IndexDescriptor {
-    private final String name;
-
-    private final List<String> columns;
-
-    /**
-     * Constructs a index description.
-     *
-     * @param name Name of the index.
-     * @param columns A list of indexed columns. Must not contains duplicates.
-     * @throws IllegalArgumentException If columns list contains duplicates.
-     */
-    public IndexDescriptor(String name, List<String> columns) {
-        if (new HashSet<>(columns).size() != columns.size()) {
-            throw new IllegalArgumentException("Indexed columns should be 
unique");
-        }
-
-        this.name = Objects.requireNonNull(name, "name");
-        this.columns = List.copyOf(Objects.requireNonNull(columns, "columns"));
-    }
-
-    /** Returns name of the described index. */
-    public String name() {
-        return name;
-    }
-
-    /** Returns indexed columns. */
-    public List<String> columns() {
-        return columns;
-    }
-}
diff --git 
a/modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java
 
b/modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java
index bd12e3d5c0..e0ecbb2a51 100644
--- 
a/modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java
+++ 
b/modules/index/src/main/java/org/apache/ignite/internal/index/IndexManager.java
@@ -29,11 +29,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.function.Consumer;
 import java.util.function.LongFunction;
 import org.apache.ignite.internal.catalog.CatalogManager;
-import org.apache.ignite.internal.catalog.descriptors.CatalogColumnCollation;
-import 
org.apache.ignite.internal.catalog.descriptors.CatalogHashIndexDescriptor;
-import 
org.apache.ignite.internal.catalog.descriptors.CatalogIndexColumnDescriptor;
 import org.apache.ignite.internal.catalog.descriptors.CatalogIndexDescriptor;
-import 
org.apache.ignite.internal.catalog.descriptors.CatalogSortedIndexDescriptor;
 import org.apache.ignite.internal.catalog.descriptors.CatalogTableDescriptor;
 import org.apache.ignite.internal.catalog.events.CreateIndexEventParameters;
 import org.apache.ignite.internal.catalog.events.DropIndexEventParameters;
@@ -155,10 +151,11 @@ public class IndexManager extends Producer<IndexEvent, 
IndexEventParameters> imp
         int tableId = parameters.tableId();
 
         long causalityToken = parameters.causalityToken();
+        int catalogVersion = parameters.catalogVersion();
 
         if (!busyLock.enterBusy()) {
             fireEvent(IndexEvent.DROP,
-                    new IndexEventParameters(causalityToken, tableId, indexId),
+                    new IndexEventParameters(causalityToken, catalogVersion, 
tableId, indexId),
                     new NodeStoppingException()
             );
 
@@ -175,7 +172,7 @@ public class IndexManager extends Producer<IndexEvent, 
IndexEventParameters> imp
 
                         return fireEvent(
                                 IndexEvent.DROP,
-                                new IndexEventParameters(causalityToken, 
tableId, indexId)
+                                new IndexEventParameters(causalityToken, 
catalogVersion, tableId, indexId)
                         );
                     })
                     .thenApply(unused -> false);
@@ -189,11 +186,16 @@ public class IndexManager extends Producer<IndexEvent, 
IndexEventParameters> imp
     private CompletableFuture<Boolean> 
onIndexCreate(CreateIndexEventParameters parameters) {
         CatalogIndexDescriptor index = parameters.indexDescriptor();
 
+        int indexId = index.id();
+        int tableId = index.tableId();
+
         long causalityToken = parameters.causalityToken();
+        int catalogVersion = parameters.catalogVersion();
 
         if (!busyLock.enterBusy()) {
-            fireEvent(IndexEvent.CREATE,
-                    new IndexEventParameters(causalityToken, index.tableId(), 
index.id()),
+            fireEvent(
+                    IndexEvent.CREATE,
+                    new IndexEventParameters(causalityToken, catalogVersion, 
tableId, indexId),
                     new NodeStoppingException()
             );
 
@@ -201,11 +203,11 @@ public class IndexManager extends Producer<IndexEvent, 
IndexEventParameters> imp
         }
 
         try {
-            CatalogTableDescriptor table = 
catalogManager.table(index.tableId(), parameters.catalogVersion());
+            CatalogTableDescriptor table = catalogManager.table(tableId, 
catalogVersion);
 
-            assert table != null : "tableId=" + index.tableId() + ", indexId=" 
+ index.id();
+            assert table != null : "tableId=" + tableId + ", indexId=" + 
indexId;
 
-            return createIndexLocally(causalityToken, table, 
index).thenApply(unused -> false);
+            return createIndexLocally(causalityToken, catalogVersion, table, 
index).thenApply(unused -> false);
         } catch (Throwable t) {
             return failedFuture(t);
         } finally {
@@ -215,6 +217,7 @@ public class IndexManager extends Producer<IndexEvent, 
IndexEventParameters> imp
 
     private CompletableFuture<Void> createIndexLocally(
             long causalityToken,
+            int catalogVersion,
             CatalogTableDescriptor table,
             CatalogIndexDescriptor index
     ) {
@@ -228,9 +231,9 @@ public class IndexManager extends Producer<IndexEvent, 
IndexEventParameters> imp
             );
         }
 
-        CompletableFuture<?> fireCreateIndexEventFuture = 
fireCreateIndexEvent(index, causalityToken, tableId);
+        CompletableFuture<?> fireCreateIndexEventFuture = 
fireCreateIndexEvent(index, causalityToken, catalogVersion);
 
-        CompletableFuture<Void> registerIndexFuture = registerIndex(table, 
index, causalityToken, tableId);
+        CompletableFuture<Void> registerIndexFuture = registerIndex(table, 
index, causalityToken);
 
         return allOf(fireCreateIndexEventFuture, registerIndexFuture);
     }
@@ -328,54 +331,6 @@ public class IndexManager extends Producer<IndexEvent, 
IndexEventParameters> imp
         }
     }
 
-    /**
-     * Converts a catalog index descriptor to an event index descriptor.
-     *
-     * @param descriptor Catalog index descriptor.
-     */
-    private static IndexDescriptor 
toEventIndexDescriptor(CatalogIndexDescriptor descriptor) {
-        if (descriptor instanceof CatalogHashIndexDescriptor) {
-            return toEventHashIndexDescriptor(((CatalogHashIndexDescriptor) 
descriptor));
-        }
-
-        if (descriptor instanceof CatalogSortedIndexDescriptor) {
-            return 
toEventSortedIndexDescriptor(((CatalogSortedIndexDescriptor) descriptor));
-        }
-
-        throw new IllegalArgumentException("Unknown index type: " + 
descriptor);
-    }
-
-    /**
-     * Converts a catalog hash index descriptor to an event hash index 
descriptor.
-     *
-     * @param descriptor Catalog hash index descriptor.
-     */
-    private static IndexDescriptor 
toEventHashIndexDescriptor(CatalogHashIndexDescriptor descriptor) {
-        return new IndexDescriptor(descriptor.name(), descriptor.columns());
-    }
-
-    /**
-     * Converts a catalog sorted index descriptor to an event sorted index 
descriptor.
-     *
-     * @param descriptor Catalog sorted index descriptor.
-     */
-    private static SortedIndexDescriptor 
toEventSortedIndexDescriptor(CatalogSortedIndexDescriptor descriptor) {
-        List<String> columns = new ArrayList<>(descriptor.columns().size());
-        List<ColumnCollation> collations = new 
ArrayList<>(descriptor.columns().size());
-
-        for (CatalogIndexColumnDescriptor column : descriptor.columns()) {
-            columns.add(column.name());
-
-            collations.add(toEventCollation(column.collation()));
-        }
-
-        return new SortedIndexDescriptor(descriptor.name(), columns, 
collations);
-    }
-
-    private static ColumnCollation toEventCollation(CatalogColumnCollation 
collation) {
-        return ColumnCollation.get(collation.asc(), collation.nullsFirst());
-    }
-
     private void startIndexes() {
         CompletableFuture<Long> recoveryFinishedFuture = 
metaStorageManager.recoveryFinishedFuture();
 
@@ -393,9 +348,9 @@ public class IndexManager extends Producer<IndexEvent, 
IndexEventParameters> imp
 
             assert table != null : "tableId=" + tableId + ", indexId=" + 
index.id();
 
-            CompletableFuture<?> fireCreateIndexEventFuture = 
fireCreateIndexEvent(index, causalityToken, tableId);
+            CompletableFuture<?> fireCreateIndexEventFuture = 
fireCreateIndexEvent(index, causalityToken, catalogVersion);
 
-            CompletableFuture<Void> registerIndexFuture = registerIndex(table, 
index, causalityToken, tableId);
+            CompletableFuture<Void> registerIndexFuture = registerIndex(table, 
index, causalityToken);
 
             startIndexFutures.add(allOf(fireCreateIndexEventFuture, 
registerIndexFuture));
         }
@@ -405,9 +360,7 @@ public class IndexManager extends Producer<IndexEvent, 
IndexEventParameters> imp
                     if (throwable != null) {
                         LOG.error("Error starting indexes", throwable);
                     } else {
-                        if (LOG.isDebugEnabled()) {
-                            LOG.debug("Indexes started successfully");
-                        }
+                        LOG.debug("Indexes started successfully");
                     }
                 });
     }
@@ -415,18 +368,19 @@ public class IndexManager extends Producer<IndexEvent, 
IndexEventParameters> imp
     private CompletableFuture<Void> registerIndex(
             CatalogTableDescriptor table,
             CatalogIndexDescriptor index,
-            long causalityToken,
-            int configTableId
+            long causalityToken
     ) {
+        int tableId = index.tableId();
+
         // TODO: IGNITE-19712 Listen to assignment changes and start new index 
storages.
-        CompletableFuture<PartitionSet> tablePartitionFuture = 
tableManager.localPartitionSetAsync(causalityToken, configTableId);
+        CompletableFuture<PartitionSet> tablePartitionFuture = 
tableManager.localPartitionSetAsync(causalityToken, tableId);
 
-        CompletableFuture<SchemaRegistry> schemaRegistryFuture = 
schemaManager.schemaRegistry(causalityToken, configTableId);
+        CompletableFuture<SchemaRegistry> schemaRegistryFuture = 
schemaManager.schemaRegistry(causalityToken, tableId);
 
         return tablePartitionFuture.thenAcceptBoth(schemaRegistryFuture, 
(partitionSet, schemaRegistry) -> {
-            TableImpl tableImpl = tableManager.getTable(configTableId);
+            TableImpl tableImpl = tableManager.getTable(tableId);
 
-            assert tableImpl != null : "tableId=" + configTableId + ", 
indexId=" + index.id();
+            assert tableImpl != null : "tableId=" + tableId + ", indexId=" + 
index.id();
 
             var storageIndexDescriptor = StorageIndexDescriptor.create(table, 
index);
 
@@ -461,11 +415,8 @@ public class IndexManager extends Producer<IndexEvent, 
IndexEventParameters> imp
     private CompletableFuture<?> fireCreateIndexEvent(
             CatalogIndexDescriptor index,
             long causalityToken,
-            int configTableId
+            int catalogVersion
     ) {
-        return fireEvent(
-                IndexEvent.CREATE,
-                new IndexEventParameters(causalityToken, configTableId, 
index.id(), toEventIndexDescriptor(index))
-        );
+        return fireEvent(IndexEvent.CREATE, new 
IndexEventParameters(causalityToken, catalogVersion, index.tableId(), 
index.id()));
     }
 }
diff --git 
a/modules/index/src/main/java/org/apache/ignite/internal/index/SortedIndex.java 
b/modules/index/src/main/java/org/apache/ignite/internal/index/SortedIndex.java
deleted file mode 100644
index f03c72aaf1..0000000000
--- 
a/modules/index/src/main/java/org/apache/ignite/internal/index/SortedIndex.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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.index;
-
-import java.util.BitSet;
-import java.util.UUID;
-import java.util.concurrent.Flow.Publisher;
-import org.apache.ignite.internal.hlc.HybridTimestamp;
-import org.apache.ignite.internal.schema.BinaryRow;
-import org.apache.ignite.internal.schema.BinaryTuplePrefix;
-import org.apache.ignite.internal.utils.PrimaryReplica;
-import org.apache.ignite.network.ClusterNode;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * An object describing a sorted index.
- *
- * <p>Extends a basic index with operations related to sorted structures.
- */
-public interface SortedIndex extends Index<SortedIndexDescriptor> {
-    /** A flag denotes that left bound should be included into result. */
-    byte INCLUDE_LEFT = 0b01;
-
-    /** A flag denotes that right bound should be included into result. */
-    byte INCLUDE_RIGHT = 0b10;
-
-    /**
-     * Opens a range cursor for given bounds. Inclusion of the bounds is 
defined by {@code flags} mask.
-     *
-     * @param partId Partition.
-     * @param txId Transaction id.
-     * @param recipient Primary replica that will handle given get request.
-     * @param leftBound Left bound of range.
-     * @param rightBound Right bound of range.
-     * @param flags A mask that defines whether to include bounds into the 
final result or not.
-     * @param columnsToInclude Columns to include.
-     * @return A cursor from resulting rows.
-     * @see SortedIndex#INCLUDE_LEFT
-     * @see SortedIndex#INCLUDE_RIGHT
-     */
-    Publisher<BinaryRow> scan(
-            int partId,
-            UUID txId,
-            PrimaryReplica recipient,
-            @Nullable BinaryTuplePrefix leftBound,
-            @Nullable BinaryTuplePrefix rightBound,
-            int flags,
-            @Nullable BitSet columnsToInclude
-    );
-
-    /**
-     * Opens a read-only range cursor for given bounds with left bound 
included in result and right excluded.
-     *
-     * @param partId Partition.
-     * @param readTimestamp Read timestamp.
-     * @param recipientNode Cluster node that will handle given get request.
-     * @param left Left bound of range.
-     * @param right Right bound of range.
-     * @param columns Columns to include.
-     * @return A cursor from resulting rows.
-     */
-    default Publisher<BinaryRow> scan(
-            int partId,
-            HybridTimestamp readTimestamp,
-            ClusterNode recipientNode,
-            @Nullable BinaryTuplePrefix left,
-            @Nullable BinaryTuplePrefix right,
-            @Nullable BitSet columns
-    ) {
-        return scan(partId, readTimestamp, recipientNode, left, right, 
INCLUDE_LEFT, columns);
-    }
-
-    /**
-     * Opens a range cursor for given bounds. Inclusion of the bounds is 
defined by {@code flags} mask.
-     *
-     * @param partId Partition.
-     * @param readTimestamp Read timestamp.
-     * @param recipientNode Cluster node that will handle given get request.
-     * @param leftBound Left bound of range.
-     * @param rightBound Right bound of range.
-     * @param flags A mask that defines whether to include bounds into the 
final result or not.
-     * @param columnsToInclude Columns to include.
-     * @return A cursor from resulting rows.
-     * @see SortedIndex#INCLUDE_LEFT
-     * @see SortedIndex#INCLUDE_RIGHT
-     */
-    Publisher<BinaryRow> scan(
-            int partId,
-            HybridTimestamp readTimestamp,
-            ClusterNode recipientNode,
-            @Nullable BinaryTuplePrefix leftBound,
-            @Nullable BinaryTuplePrefix rightBound,
-            int flags,
-            @Nullable BitSet columnsToInclude
-    );
-}
diff --git 
a/modules/index/src/main/java/org/apache/ignite/internal/index/SortedIndexDescriptor.java
 
b/modules/index/src/main/java/org/apache/ignite/internal/index/SortedIndexDescriptor.java
deleted file mode 100644
index f859cf6774..0000000000
--- 
a/modules/index/src/main/java/org/apache/ignite/internal/index/SortedIndexDescriptor.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.index;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Description of the sorted index.
- */
-public class SortedIndexDescriptor extends IndexDescriptor {
-    private final Map<String, ColumnCollation> collations;
-
-    /**
-     * Constructs a index description.
-     *
-     * @param name Name of the index.
-     * @param columns A list of indexed columns. Must not contain duplicates.
-     * @param collations A list of columns collations. Must be the same size 
as columns list.
-     * @throws IllegalArgumentException If columns list contains duplicates or 
columns size doesn't match the collations size.
-     */
-    public SortedIndexDescriptor(
-            String name,
-            List<String> columns,
-            List<ColumnCollation> collations
-    ) {
-        super(name, columns);
-
-        Objects.requireNonNull(collations, "collations");
-
-        if (collations.size() != columns.size()) {
-            throw new IllegalArgumentException("Both collection of columns and 
collations should have the same size");
-        }
-
-        Map<String, ColumnCollation> tmp = new HashMap<>();
-
-        for (int i = 0; i < columns().size(); i++) {
-            ColumnCollation prev = tmp.putIfAbsent(columns().get(i), 
collations.get(i));
-
-            assert prev == null;
-        }
-
-        this.collations = Map.copyOf(tmp);
-    }
-
-    /**
-     * Returns collation for the given column.
-     *
-     * @param columnName A column of interest.
-     * @return Collation of the column or {@code null} if the given column is 
not part of this index.
-     */
-    public @Nullable ColumnCollation collation(String columnName) {
-        return collations.get(columnName);
-    }
-}
diff --git 
a/modules/index/src/main/java/org/apache/ignite/internal/index/SortedIndexImpl.java
 
b/modules/index/src/main/java/org/apache/ignite/internal/index/SortedIndexImpl.java
deleted file mode 100644
index f6bf5622b4..0000000000
--- 
a/modules/index/src/main/java/org/apache/ignite/internal/index/SortedIndexImpl.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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.index;
-
-import java.util.BitSet;
-import java.util.Objects;
-import java.util.UUID;
-import java.util.concurrent.Flow.Publisher;
-import org.apache.ignite.internal.hlc.HybridTimestamp;
-import org.apache.ignite.internal.schema.BinaryRow;
-import org.apache.ignite.internal.schema.BinaryTuple;
-import org.apache.ignite.internal.schema.BinaryTuplePrefix;
-import org.apache.ignite.internal.table.InternalTable;
-import org.apache.ignite.internal.utils.PrimaryReplica;
-import org.apache.ignite.network.ClusterNode;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * An object that represents a sorted index.
- */
-public class SortedIndexImpl implements SortedIndex {
-    private final int id;
-    private final InternalTable table;
-    private final SortedIndexDescriptor descriptor;
-
-    /**
-     * Constructs the sorted index.
-     *
-     * @param id An identifier of the index.
-     * @param table A table this index relates to.
-     * @param descriptor A descriptor of the index.
-     */
-    public SortedIndexImpl(int id, InternalTable table, SortedIndexDescriptor 
descriptor) {
-        this.id = id;
-        this.table = Objects.requireNonNull(table, "table");
-        this.descriptor = Objects.requireNonNull(descriptor, "descriptor");
-    }
-
-    @Override
-    public int id() {
-        return id;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int tableId() {
-        return table.tableId();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public String name() {
-        return descriptor.name();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public SortedIndexDescriptor descriptor() {
-        return descriptor;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Publisher<BinaryRow> lookup(
-            int partId,
-            UUID txId,
-            PrimaryReplica recipient,
-            BinaryTuple key,
-            @Nullable BitSet columns
-    ) {
-        return table.lookup(partId, txId, recipient, id, key, columns);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Publisher<BinaryRow> lookup(
-            int partId,
-            HybridTimestamp timestamp,
-            ClusterNode recipientNode,
-            BinaryTuple key,
-            @Nullable BitSet columns
-    ) {
-        return table.lookup(partId, timestamp, recipientNode, id, key, 
columns);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Publisher<BinaryRow> scan(
-            int partId,
-            HybridTimestamp readTimestamp,
-            ClusterNode recipientNode,
-            @Nullable BinaryTuplePrefix leftBound,
-            @Nullable BinaryTuplePrefix rightBound,
-            int flags,
-            @Nullable BitSet columnsToInclude
-    ) {
-        return table.scan(partId, readTimestamp, recipientNode, id, leftBound, 
rightBound, flags, columnsToInclude);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Publisher<BinaryRow> scan(
-            int partId,
-            UUID txId,
-            PrimaryReplica recipient,
-            @Nullable BinaryTuplePrefix leftBound,
-            @Nullable BinaryTuplePrefix rightBound,
-            int flags,
-            @Nullable BitSet columnsToInclude
-    ) {
-        return table.scan(partId, txId, recipient, id, leftBound, rightBound, 
flags, columnsToInclude);
-    }
-}
diff --git 
a/modules/index/src/main/java/org/apache/ignite/internal/index/event/IndexEventParameters.java
 
b/modules/index/src/main/java/org/apache/ignite/internal/index/event/IndexEventParameters.java
index 222cd0d566..dcb656f965 100644
--- 
a/modules/index/src/main/java/org/apache/ignite/internal/index/event/IndexEventParameters.java
+++ 
b/modules/index/src/main/java/org/apache/ignite/internal/index/event/IndexEventParameters.java
@@ -17,74 +17,44 @@
 
 package org.apache.ignite.internal.index.event;
 
-import org.apache.ignite.internal.index.IndexDescriptor;
 import org.apache.ignite.internal.manager.EventParameters;
-import org.jetbrains.annotations.Nullable;
 
-/**
- * Index event parameters. There are properties which associate with a 
particular index.
- */
+/** Index event parameters. There are properties which associate with a 
particular index. */
 public class IndexEventParameters extends EventParameters {
-    /** Table identifier. */
     private final int tableId;
 
-    /** Index identifier. */
     private final int indexId;
 
-    /** Index instance. */
-    private final @Nullable IndexDescriptor indexDescriptor;
+    private final int catalogVersion;
 
     /**
      * Constructor.
      *
      * @param revision Causality token.
-     * @param tableId Table identifier.
-     * @param indexId Index identifier.
+     * @param catalogVersion Catalog version.
+     * @param tableId Table ID.
+     * @param indexId Index ID.
      */
-    public IndexEventParameters(long revision, int tableId, int indexId) {
-        this(revision, tableId, indexId, null);
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param revision Causality token.
-     * @param tableId Table identifier.
-     * @param indexId Index identifier.
-     * @param indexDescriptor Index descriptor.
-     */
-    public IndexEventParameters(long revision, int tableId, int indexId, 
@Nullable IndexDescriptor indexDescriptor) {
+    public IndexEventParameters(long revision, int catalogVersion, int 
tableId, int indexId) {
         super(revision);
 
+        this.catalogVersion = catalogVersion;
         this.tableId = tableId;
         this.indexId = indexId;
-        this.indexDescriptor = indexDescriptor;
     }
 
-    /**
-     * Returns an identifier of the table this event relates to.
-     *
-     * @return An id of the table.
-     */
+    /** Returns table ID this event relates to. */
     public int tableId() {
         return tableId;
     }
 
-    /**
-     * Returns an identifier of the index this event relates to.
-     *
-     * @return An id of the index.
-     */
+    /** Returns index ID this event relates to. */
     public int indexId() {
         return indexId;
     }
 
-    /**
-     * Returns an index instance this event relates to.
-     *
-     * @return An index.
-     */
-    public @Nullable IndexDescriptor indexDescriptor() {
-        return indexDescriptor;
+    /** Returns catalog version this event relates to. */
+    public int catalogVersion() {
+        return catalogVersion;
     }
 }
diff --git 
a/modules/index/src/test/java/org/apache/ignite/internal/index/IndexManagerTest.java
 
b/modules/index/src/test/java/org/apache/ignite/internal/index/IndexManagerTest.java
index 1680f2978f..1da4ee14c7 100644
--- 
a/modules/index/src/test/java/org/apache/ignite/internal/index/IndexManagerTest.java
+++ 
b/modules/index/src/test/java/org/apache/ignite/internal/index/IndexManagerTest.java
@@ -26,6 +26,7 @@ import static 
org.apache.ignite.internal.testframework.matchers.CompletableFutur
 import static org.apache.ignite.sql.ColumnType.STRING;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.greaterThan;
 import static org.hamcrest.Matchers.notNullValue;
 import static org.hamcrest.Matchers.nullValue;
 import static org.mockito.ArgumentMatchers.anyInt;
@@ -161,6 +162,8 @@ public class IndexManagerTest extends 
BaseIgniteAbstractTest {
             return completedFuture(true);
         });
 
+        int catalogVersion = catalogManager.latestCatalogVersion();
+
         assertThat(
                 catalogManager.execute(
                         CreateSortedIndexCommand.builder()
@@ -180,7 +183,7 @@ public class IndexManagerTest extends 
BaseIgniteAbstractTest {
         assertThat(holder.get(), notNullValue());
         assertThat(holder.get().indexId(), equalTo(index.id()));
         assertThat(holder.get().tableId(), equalTo(tableId));
-        assertThat(holder.get().indexDescriptor().name(), equalTo(indexName));
+        assertThat(holder.get().catalogVersion(), greaterThan(catalogVersion));
 
         assertThat(
                 
catalogManager.execute(DropIndexCommand.builder().schemaName(DEFAULT_SCHEMA_NAME).indexName(indexName).build()),
diff --git 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/index/ItIndexManagerTest.java
 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/index/ItIndexManagerTest.java
index 53b71e1286..5f740f413c 100644
--- 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/index/ItIndexManagerTest.java
+++ 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/index/ItIndexManagerTest.java
@@ -20,11 +20,10 @@ package org.apache.ignite.internal.index;
 import static 
org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.hasItems;
+import static org.hamcrest.Matchers.greaterThan;
 import static org.hamcrest.Matchers.notNullValue;
 
 import java.util.concurrent.CompletableFuture;
-import org.apache.ignite.Ignite;
 import org.apache.ignite.internal.app.IgniteImpl;
 import org.apache.ignite.internal.index.event.IndexEvent;
 import org.apache.ignite.internal.index.event.IndexEventParameters;
@@ -46,13 +45,15 @@ public class ItIndexManagerTest extends 
ClusterPerClassIntegrationTest {
 
     @Test
     public void eventsAreFiredWhenIndexesCreatedAndDropped() {
-        Ignite ignite = CLUSTER_NODES.get(0);
-        IndexManager indexManager = ((IgniteImpl) ignite).indexManager();
+        IgniteImpl ignite = (IgniteImpl) CLUSTER_NODES.get(0);
+        IndexManager indexManager = ignite.indexManager();
 
         CompletableFuture<IndexEventParameters> pkCreatedFuture = 
registerListener(indexManager, IndexEvent.CREATE);
 
         String tableName = "TNAME";
 
+        int catalogVersion = ignite.catalogManager().latestCatalogVersion();
+
         sql(String.format("CREATE TABLE %s (c1 INT PRIMARY KEY, c2 INT, c3 
INT)", tableName));
 
         TableImpl table = (TableImpl) ignite.tables().table(tableName);
@@ -64,8 +65,7 @@ public class ItIndexManagerTest extends 
ClusterPerClassIntegrationTest {
 
             assertThat(parameters, notNullValue());
             assertThat(parameters.tableId(), equalTo(table.tableId()));
-            assertThat(parameters.indexDescriptor().columns(), hasItems("C1"));
-            assertThat(parameters.indexDescriptor().name(), 
equalTo("TNAME_PK"));
+            assertThat(parameters.catalogVersion(), 
greaterThan(catalogVersion));
         }
 
         CompletableFuture<IndexEventParameters> indexCreatedFuture = 
registerListener(indexManager, IndexEvent.CREATE);
@@ -82,8 +82,7 @@ public class ItIndexManagerTest extends 
ClusterPerClassIntegrationTest {
 
             assertThat(parameters, notNullValue());
             assertThat(parameters.tableId(), equalTo(table.tableId()));
-            assertThat(parameters.indexDescriptor().columns(), hasItems("C3", 
"C2"));
-            assertThat(parameters.indexDescriptor().name(), 
equalTo(indexName));
+            assertThat(parameters.catalogVersion(), 
greaterThan(catalogVersion));
 
             createdIndexId = parameters.indexId();
         }
diff --git 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItTableScanTest.java
 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItTableScanTest.java
index 28eddb3223..df4bf8f7e2 100644
--- 
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItTableScanTest.java
+++ 
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItTableScanTest.java
@@ -17,8 +17,8 @@
 
 package org.apache.ignite.internal.table;
 
-import static org.apache.ignite.internal.index.SortedIndex.INCLUDE_LEFT;
-import static org.apache.ignite.internal.index.SortedIndex.INCLUDE_RIGHT;
+import static 
org.apache.ignite.internal.storage.index.SortedIndexStorage.GREATER_OR_EQUAL;
+import static 
org.apache.ignite.internal.storage.index.SortedIndexStorage.LESS_OR_EQUAL;
 import static org.apache.ignite.internal.testframework.IgniteTestUtils.runRace;
 import static 
org.apache.ignite.internal.testframework.IgniteTestUtils.waitForCondition;
 import static 
org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully;
@@ -477,7 +477,7 @@ public class ItTableScanTest extends 
ClusterPerClassIntegrationTest {
                         soredIndexId,
                         lowBound,
                         upperBound,
-                        INCLUDE_LEFT | INCLUDE_RIGHT,
+                        LESS_OR_EQUAL | GREATER_OR_EQUAL,
                         null
                 )
         );
@@ -503,7 +503,7 @@ public class ItTableScanTest extends 
ClusterPerClassIntegrationTest {
                         soredIndexId,
                         lowBound,
                         upperBound,
-                        INCLUDE_LEFT | INCLUDE_RIGHT,
+                        LESS_OR_EQUAL | GREATER_OR_EQUAL,
                         null
                 )
         );
@@ -524,7 +524,7 @@ public class ItTableScanTest extends 
ClusterPerClassIntegrationTest {
                 soredIndexId,
                 lowBound,
                 upperBound,
-                INCLUDE_LEFT | INCLUDE_RIGHT,
+                LESS_OR_EQUAL | GREATER_OR_EQUAL,
                 null
         );
 
diff --git 
a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ScannableTableImpl.java
 
b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ScannableTableImpl.java
index 158fd7a94a..cd44d9bf34 100644
--- 
a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ScannableTableImpl.java
+++ 
b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ScannableTableImpl.java
@@ -17,11 +17,13 @@
 
 package org.apache.ignite.internal.sql.engine.exec;
 
+import static 
org.apache.ignite.internal.storage.index.SortedIndexStorage.GREATER_OR_EQUAL;
+import static 
org.apache.ignite.internal.storage.index.SortedIndexStorage.LESS_OR_EQUAL;
+
 import java.util.BitSet;
 import java.util.List;
 import java.util.concurrent.Flow.Publisher;
 import org.apache.ignite.internal.hlc.HybridTimestamp;
-import org.apache.ignite.internal.index.SortedIndex;
 import org.apache.ignite.internal.schema.BinaryRow;
 import org.apache.ignite.internal.schema.BinaryTuple;
 import org.apache.ignite.internal.schema.BinaryTuplePrefix;
@@ -100,15 +102,15 @@ public class ScannableTableImpl implements ScannableTable 
{
         int flags = 0;
 
         if (cond == null) {
-            flags = SortedIndex.INCLUDE_LEFT | SortedIndex.INCLUDE_RIGHT;
+            flags = LESS_OR_EQUAL | GREATER_OR_EQUAL;
             lower = null;
             upper = null;
         } else {
             lower = toBinaryTuplePrefix(ctx, indexRowSchema, cond.lower(), 
rowFactory);
             upper = toBinaryTuplePrefix(ctx, indexRowSchema, cond.upper(), 
rowFactory);
 
-            flags |= (cond.lowerInclude()) ? SortedIndex.INCLUDE_LEFT : 0;
-            flags |= (cond.upperInclude()) ? SortedIndex.INCLUDE_RIGHT : 0;
+            flags |= (cond.lowerInclude()) ? GREATER_OR_EQUAL : 0;
+            flags |= (cond.upperInclude()) ? LESS_OR_EQUAL : 0;
         }
 
         if (txAttributes.readOnly()) {
diff --git 
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/rel/ScannableTableSelfTest.java
 
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/rel/ScannableTableSelfTest.java
index 79b6f14149..be5c18f77e 100644
--- 
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/rel/ScannableTableSelfTest.java
+++ 
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/rel/ScannableTableSelfTest.java
@@ -18,6 +18,8 @@
 package org.apache.ignite.internal.sql.engine.exec.rel;
 
 import static 
org.apache.ignite.internal.sql.engine.exec.exp.ExpressionFactoryImpl.UNSPECIFIED_VALUE_PLACEHOLDER;
+import static 
org.apache.ignite.internal.storage.index.SortedIndexStorage.GREATER_OR_EQUAL;
+import static 
org.apache.ignite.internal.storage.index.SortedIndexStorage.LESS_OR_EQUAL;
 import static org.apache.ignite.lang.IgniteStringFormatter.format;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNull;
@@ -53,7 +55,6 @@ import org.apache.calcite.rel.type.RelDataTypeFactory.Builder;
 import org.apache.calcite.rel.type.RelDataTypeField;
 import org.apache.calcite.sql.type.SqlTypeName;
 import org.apache.ignite.internal.hlc.HybridTimestamp;
-import org.apache.ignite.internal.index.SortedIndex;
 import org.apache.ignite.internal.schema.BinaryRow;
 import org.apache.ignite.internal.schema.BinaryTuple;
 import org.apache.ignite.internal.schema.BinaryTuplePrefix;
@@ -855,7 +856,7 @@ public class ScannableTableSelfTest extends 
BaseIgniteAbstractTest {
 
         static int toFlags(Bound lower, Bound upper) {
             if (lower == NONE && upper == NONE) {
-                return SortedIndex.INCLUDE_LEFT | SortedIndex.INCLUDE_RIGHT;
+                return LESS_OR_EQUAL | GREATER_OR_EQUAL;
             } else {
                 int flags = 0;
                 flags |= lower.bit(true);
@@ -867,7 +868,7 @@ public class ScannableTableSelfTest extends 
BaseIgniteAbstractTest {
         int bit(boolean lower) {
             switch (this) {
                 case INCLUSIVE:
-                    return lower ? SortedIndex.INCLUDE_LEFT : 
SortedIndex.INCLUDE_RIGHT;
+                    return lower ? GREATER_OR_EQUAL : LESS_OR_EQUAL;
                 case EXCLUSIVE:
                 case NONE:
                     return 0;
diff --git 
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/AbstractPlannerTest.java
 
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/AbstractPlannerTest.java
index 0217e5ce29..2276cbf8c0 100644
--- 
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/AbstractPlannerTest.java
+++ 
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/AbstractPlannerTest.java
@@ -31,7 +31,6 @@ import static org.junit.jupiter.api.Assertions.fail;
 import com.google.common.collect.ImmutableList;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.BitSet;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
@@ -40,7 +39,6 @@ import java.util.List;
 import java.util.Objects;
 import java.util.Set;
 import java.util.UUID;
-import java.util.concurrent.Flow.Publisher;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.BiFunction;
 import java.util.function.Consumer;
@@ -55,9 +53,7 @@ import org.apache.calcite.plan.RelOptTable;
 import org.apache.calcite.plan.RelOptUtil;
 import org.apache.calcite.plan.RelTraitSet;
 import org.apache.calcite.rel.AbstractRelNode;
-import org.apache.calcite.rel.RelCollation;
 import org.apache.calcite.rel.RelDistribution;
-import org.apache.calcite.rel.RelFieldCollation.NullDirection;
 import org.apache.calcite.rel.RelNode;
 import org.apache.calcite.rel.RelVisitor;
 import org.apache.calcite.rel.core.TableScan;
@@ -77,15 +73,6 @@ import org.apache.calcite.sql2rel.SqlToRelConverter;
 import org.apache.calcite.util.ImmutableBitSet;
 import org.apache.calcite.util.Util;
 import org.apache.ignite.internal.catalog.CatalogService;
-import org.apache.ignite.internal.hlc.HybridTimestamp;
-import org.apache.ignite.internal.index.ColumnCollation;
-import org.apache.ignite.internal.index.Index;
-import org.apache.ignite.internal.index.IndexDescriptor;
-import org.apache.ignite.internal.index.SortedIndex;
-import org.apache.ignite.internal.index.SortedIndexDescriptor;
-import org.apache.ignite.internal.schema.BinaryRow;
-import org.apache.ignite.internal.schema.BinaryTuple;
-import org.apache.ignite.internal.schema.BinaryTuplePrefix;
 import org.apache.ignite.internal.schema.NativeType;
 import org.apache.ignite.internal.sql.engine.externalize.RelJsonReader;
 import org.apache.ignite.internal.sql.engine.framework.TestBuilders;
@@ -116,9 +103,7 @@ import org.apache.ignite.internal.sql.engine.util.Commons;
 import org.apache.ignite.internal.sql.engine.util.StatementChecker;
 import org.apache.ignite.internal.testframework.IgniteAbstractTest;
 import org.apache.ignite.internal.testframework.IgniteTestUtils;
-import org.apache.ignite.internal.utils.PrimaryReplica;
 import org.apache.ignite.lang.IgniteStringBuilder;
-import org.apache.ignite.network.ClusterNode;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -889,152 +874,6 @@ public abstract class AbstractPlannerTest extends 
IgniteAbstractTest {
         }
     }
 
-    static class TestSortedIndex implements SortedIndex {
-        private final int id = 1;
-
-        private final int tableId = 1;
-
-        private final SortedIndexDescriptor descriptor;
-
-        public static TestSortedIndex create(RelCollation collation, String 
name, IgniteTable table) {
-            List<String> columns = new ArrayList<>();
-            List<ColumnCollation> collations = new ArrayList<>();
-            TableDescriptor tableDescriptor = table.descriptor();
-
-            for (var fieldCollation : collation.getFieldCollations()) {
-                
columns.add(tableDescriptor.columnDescriptor(fieldCollation.getFieldIndex()).name());
-                collations.add(ColumnCollation.get(
-                        !fieldCollation.getDirection().isDescending(),
-                        fieldCollation.nullDirection == NullDirection.FIRST
-                ));
-            }
-
-            var descriptor = new SortedIndexDescriptor(name, columns, 
collations);
-
-            return new TestSortedIndex(descriptor);
-        }
-
-        public TestSortedIndex(SortedIndexDescriptor descriptor) {
-            this.descriptor = descriptor;
-        }
-
-        @Override
-        public int id() {
-            return id;
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public String name() {
-            return descriptor.name();
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public int tableId() {
-            return tableId;
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public SortedIndexDescriptor descriptor() {
-            return descriptor;
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public Publisher<BinaryRow> lookup(int partId, UUID txId, 
PrimaryReplica recipient, BinaryTuple key,
-                @Nullable BitSet columns) {
-            throw new AssertionError("Should not be called");
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public Publisher<BinaryRow> lookup(int partId, HybridTimestamp 
timestamp, ClusterNode recipient, BinaryTuple key, BitSet columns) {
-            throw new AssertionError("Should not be called");
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public Publisher<BinaryRow> scan(int partId, HybridTimestamp 
timestamp, ClusterNode recipient,
-                @Nullable BinaryTuplePrefix leftBound, @Nullable 
BinaryTuplePrefix rightBound, int flags, BitSet columnsToInclude) {
-            throw new AssertionError("Should not be called");
-        }
-
-        @Override
-        public Publisher<BinaryRow> scan(int partId, UUID txId, PrimaryReplica 
recipient, @Nullable BinaryTuplePrefix leftBound,
-                @Nullable BinaryTuplePrefix rightBound, int flags, @Nullable 
BitSet columnsToInclude) {
-            throw new AssertionError("Should not be called");
-        }
-    }
-
-    /** Test Hash index implementation. */
-    public static class TestHashIndex implements Index<IndexDescriptor> {
-        private final int id = 1;
-
-        private int tableId = 1;
-
-        private final IndexDescriptor descriptor;
-
-        /** Create index. */
-        public static TestHashIndex create(List<String> indexedColumns, String 
name, int tableId) {
-            var descriptor = new IndexDescriptor(name, indexedColumns);
-
-            TestHashIndex idx = new TestHashIndex(descriptor);
-
-            idx.tableId = tableId;
-
-            return idx;
-        }
-
-        /** Create index. */
-        public static TestHashIndex create(List<String> indexedColumns, String 
name) {
-            var descriptor = new IndexDescriptor(name, indexedColumns);
-
-            return new TestHashIndex(descriptor);
-        }
-
-        TestHashIndex(IndexDescriptor descriptor) {
-            this.descriptor = descriptor;
-        }
-
-        @Override
-        public int id() {
-            return id;
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public String name() {
-            return descriptor.name();
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public int tableId() {
-            return tableId;
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public IndexDescriptor descriptor() {
-            return descriptor;
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public Publisher<BinaryRow> lookup(int partId, UUID txId, 
PrimaryReplica recipient, BinaryTuple key,
-                @Nullable BitSet columns) {
-            throw new AssertionError("Should not be called");
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public Publisher<BinaryRow> lookup(int partId, HybridTimestamp 
timestamp, ClusterNode recipient, BinaryTuple key, BitSet columns) {
-            throw new AssertionError("Should not be called");
-        }
-    }
-
     Predicate<SearchBounds> empty() {
         return Objects::isNull;
     }

Reply via email to