timoninmaxim commented on a change in pull request #8490:
URL: https://github.com/apache/ignite/pull/8490#discussion_r575306523
##########
File path:
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
##########
@@ -464,41 +427,59 @@ public GridKernalContext kernalContext() {
* @param unwrappedCols Unwrapped index columns for complex types.
* @param wrappedCols Index columns as is complex types.
* @param inlineSize Index inline size.
+ * @param cacheVisitor whether index created with new cache or on existing
one.
* @return Index.
*/
@SuppressWarnings("ConstantConditions")
GridH2IndexBase createSortedIndex(String name, GridH2Table tbl, boolean
pk, boolean affinityKey,
- List<IndexColumn> unwrappedCols, List<IndexColumn> wrappedCols, int
inlineSize) {
- try {
- GridCacheContextInfo cacheInfo = tbl.cacheInfo();
-
- if (log.isDebugEnabled())
- log.debug("Creating cache index [cacheId=" +
cacheInfo.cacheId() + ", idxName=" + name + ']');
-
- if (cacheInfo.affinityNode()) {
- final int segments =
tbl.rowDescriptor().context().config().getQueryParallelism();
-
- H2RowCache cache = rowCache.forGroup(cacheInfo.groupId());
-
- return H2TreeIndex.createIndex(
- cacheInfo.cacheContext(),
- cache,
- tbl,
- name,
- pk,
- affinityKey,
- unwrappedCols,
- wrappedCols,
- inlineSize,
- segments,
- log
- );
- }
+ List<IndexColumn> unwrappedCols, List<IndexColumn> wrappedCols, int
inlineSize, @Nullable SchemaIndexCacheVisitor cacheVisitor) {
+ GridCacheContextInfo cacheInfo = tbl.cacheInfo();
+
+ if (log.isDebugEnabled())
+ log.debug("Creating cache index [cacheId=" + cacheInfo.cacheId() +
", idxName=" + name + ']');
+
+ QueryIndexSchema schemaUnwrapped = new QueryIndexSchema(
+ tbl, unwrappedCols.toArray(new IndexColumn[0]));
+
+ QueryIndexSchema schemaWrapped = new QueryIndexSchema(
+ tbl, wrappedCols.toArray(new IndexColumn[0]));
+
+ if (cacheInfo.affinityNode()) {
+ SortedIndexDefinition idxDef = new QueryIndexDefinition(
Review comment:
Hi @korlov42 ! Sorry for the time delay. I'm working on your comments.
Most of the things look fine but there are some failed tests, I'm trying to fix
them now. I hope, will push updated for all your comments today or on Monday.
I've lost compatibility for POJOs, my bad! I've added tests to the
ignite-compatibility module and reproduced it, fix it. About other types (fixed
strings, case insensitive strings) I wrote a comment below the PR, please check
it.
I didn't implement it as `idxDefProvider`. As IndexDefinition should be
instantiated before index creation, as IndexFactory accepts it as a parameter.
So, I've moved the logic of finalizing key types to RowHandler. It replaced
Schema as you suggest in the previous comment.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]