Repository: asterixdb Updated Branches: refs/heads/master 213842050 -> 63ab05d2a
[ASTERIXDB-1944][STO] Align LSM inverted index with other indexes - user model changes: no - storage format changes: no - interface changes: yes IInvertedIndexComponent was introduced to separate LSM inverted index from its component and avoid multiple MethodNotSupported exceptions Change-Id: I0fb7b446edfb14de25ecaf99965ae0a7325101c9 Reviewed-on: https://asterix-gerrit.ics.uci.edu/1852 Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> BAD: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Reviewed-by: Murtadha Hubail <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/63ab05d2 Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/63ab05d2 Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/63ab05d2 Branch: refs/heads/master Commit: 63ab05d2a60c5b18bba3e9e4a350a79abfc728f6 Parents: 2138420 Author: Abdullah Alamoudi <[email protected]> Authored: Sat Jun 24 03:21:34 2017 -0700 Committer: abdullah alamoudi <[email protected]> Committed: Sat Jun 24 04:38:13 2017 -0700 ---------------------------------------------------------------------- .../api/IInPlaceInvertedIndex.java | 53 ++++++++++++++++++++ .../lsm/invertedindex/api/IInvertedIndex.java | 16 ------ .../invertedindex/impls/LSMInvertedIndex.java | 17 ------- .../impls/LSMInvertedIndexDiskComponent.java | 10 ++-- .../inmemory/InMemoryInvertedIndex.java | 4 +- .../ondisk/OnDiskInvertedIndex.java | 4 +- .../ondisk/OnDiskInvertedIndexFactory.java | 3 +- .../OnDiskInvertedIndexRangeSearchCursor.java | 6 +-- .../PartitionedOnDiskInvertedIndexFactory.java | 4 +- .../search/AbstractTOccurrenceSearcher.java | 11 ++-- .../search/InvertedListCursorFactory.java | 6 +-- .../search/PartitionedTOccurrenceSearcher.java | 4 +- .../search/TOccurrenceSearcher.java | 5 +- 13 files changed, 83 insertions(+), 60 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/63ab05d2/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/api/IInPlaceInvertedIndex.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/api/IInPlaceInvertedIndex.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/api/IInPlaceInvertedIndex.java new file mode 100644 index 0000000..a26e14c --- /dev/null +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/api/IInPlaceInvertedIndex.java @@ -0,0 +1,53 @@ +/* + * 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.hyracks.storage.am.lsm.invertedindex.api; + +import org.apache.hyracks.api.exceptions.HyracksDataException; +import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference; +import org.apache.hyracks.storage.am.common.api.IIndexOperationContext; + +public interface IInPlaceInvertedIndex extends IInvertedIndex { + /** + * Create an inverted list cursor + */ + IInvertedListCursor createInvertedListCursor(); + + /** + * Open an inverted list cursor + * + * @param listCursor + * the cursor to open + * @param searchKey + * the search key to use for the operation + * @param ictx + * the operation context under which the cursor is to be open + * @throws HyracksDataException + */ + void openInvertedListCursor(IInvertedListCursor listCursor, ITupleReference searchKey, IIndexOperationContext ictx) + throws HyracksDataException; + + /** + * Purge the index files out of the buffer cache. + * Can only be called if the caller is absolutely sure the files don't contain dirty pages + * + * @throws HyracksDataException + * if the index is active + */ + void purge() throws HyracksDataException; +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/63ab05d2/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/api/IInvertedIndex.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/api/IInvertedIndex.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/api/IInvertedIndex.java index eceb7b4..a693a99 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/api/IInvertedIndex.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/api/IInvertedIndex.java @@ -21,16 +21,9 @@ package org.apache.hyracks.storage.am.lsm.invertedindex.api; import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; import org.apache.hyracks.api.dataflow.value.ITypeTraits; -import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference; -import org.apache.hyracks.storage.am.common.api.IIndexOperationContext; import org.apache.hyracks.storage.common.IIndex; public interface IInvertedIndex extends IIndex { - IInvertedListCursor createInvertedListCursor(); - - void openInvertedListCursor(IInvertedListCursor listCursor, ITupleReference searchKey, IIndexOperationContext ictx) - throws HyracksDataException; ITypeTraits[] getInvListTypeTraits(); @@ -39,13 +32,4 @@ public interface IInvertedIndex extends IIndex { ITypeTraits[] getTokenTypeTraits(); IBinaryComparatorFactory[] getTokenCmpFactories(); - - /** - * Purge the index files out of the buffer cache. - * Can only be called if the caller is absolutely sure the files don't contain dirty pages - * - * @throws HyracksDataException - * if the index is active - */ - void purge() throws HyracksDataException; } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/63ab05d2/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java index 0f862ac..023fb19 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java @@ -70,7 +70,6 @@ import org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentFileReferences import org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentFilterManager; import org.apache.hyracks.storage.am.lsm.common.impls.LSMIndexSearchCursor; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndex; -import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedListCursor; import org.apache.hyracks.storage.am.lsm.invertedindex.inmemory.InMemoryInvertedIndex; import org.apache.hyracks.storage.am.lsm.invertedindex.inmemory.InMemoryInvertedIndexAccessor; import org.apache.hyracks.storage.am.lsm.invertedindex.ondisk.OnDiskInvertedIndex; @@ -595,17 +594,6 @@ public class LSMInvertedIndex extends AbstractLSMIndex implements IInvertedIndex } @Override - public IInvertedListCursor createInvertedListCursor() { - throw new UnsupportedOperationException("Cannot create inverted list cursor on lsm inverted index."); - } - - @Override - public void openInvertedListCursor(IInvertedListCursor listCursor, ITupleReference searchKey, - IIndexOperationContext ictx) throws HyracksDataException { - throw new UnsupportedOperationException("Cannot open inverted list cursor on lsm inverted index."); - } - - @Override public ITypeTraits[] getInvListTypeTraits() { return invListTypeTraits; } @@ -737,9 +725,4 @@ public class LSMInvertedIndex extends AbstractLSMIndex implements IInvertedIndex mergeFileRefs.getInsertIndexFileReference(), mergeFileRefs.getDeleteIndexFileReference(), mergeFileRefs.getBloomFilterFileReference(), callback, fileManager.getBaseDir().getAbsolutePath()); } - - @Override - public void purge() throws HyracksDataException { - throw new UnsupportedOperationException(); - } } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/63ab05d2/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexDiskComponent.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexDiskComponent.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexDiskComponent.java index 8a12dea..f2b3284 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexDiskComponent.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexDiskComponent.java @@ -24,17 +24,17 @@ import org.apache.hyracks.storage.am.btree.impls.BTree; import org.apache.hyracks.storage.am.common.api.IMetadataPageManager; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilter; import org.apache.hyracks.storage.am.lsm.common.impls.AbstractLSMDiskComponent; -import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndex; +import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInPlaceInvertedIndex; import org.apache.hyracks.storage.am.lsm.invertedindex.ondisk.OnDiskInvertedIndex; public class LSMInvertedIndexDiskComponent extends AbstractLSMDiskComponent { - private final IInvertedIndex invIndex; + private final IInPlaceInvertedIndex invIndex; private final BTree deletedKeysBTree; private final BloomFilter bloomFilter; - public LSMInvertedIndexDiskComponent(IInvertedIndex invIndex, BTree deletedKeysBTree, BloomFilter bloomFilter, - ILSMComponentFilter filter) throws HyracksDataException { + public LSMInvertedIndexDiskComponent(IInPlaceInvertedIndex invIndex, BTree deletedKeysBTree, + BloomFilter bloomFilter, ILSMComponentFilter filter) throws HyracksDataException { super((IMetadataPageManager) deletedKeysBTree.getPageManager(), filter); this.invIndex = invIndex; this.deletedKeysBTree = deletedKeysBTree; @@ -51,7 +51,7 @@ public class LSMInvertedIndexDiskComponent extends AbstractLSMDiskComponent { bloomFilter.destroy(); } - public IInvertedIndex getInvIndex() { + public IInPlaceInvertedIndex getInvIndex() { return invIndex; } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/63ab05d2/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndex.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndex.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndex.java index d686634..959adcf 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndex.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndex.java @@ -31,7 +31,7 @@ import org.apache.hyracks.storage.am.btree.util.BTreeUtils; import org.apache.hyracks.storage.am.common.api.IIndexOperationContext; import org.apache.hyracks.storage.am.common.api.IPageManager; import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation; -import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndex; +import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInPlaceInvertedIndex; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedListCursor; import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizerFactory; import org.apache.hyracks.storage.common.IIndexAccessor; @@ -40,7 +40,7 @@ import org.apache.hyracks.storage.common.IModificationOperationCallback; import org.apache.hyracks.storage.common.ISearchOperationCallback; import org.apache.hyracks.storage.common.buffercache.IBufferCache; -public class InMemoryInvertedIndex implements IInvertedIndex { +public class InMemoryInvertedIndex implements IInPlaceInvertedIndex { protected final BTree btree; protected final ITypeTraits[] tokenTypeTraits; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/63ab05d2/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndex.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndex.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndex.java index 25e4201..d89a31a 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndex.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndex.java @@ -43,8 +43,8 @@ import org.apache.hyracks.storage.am.common.api.IIndexOperationContext; import org.apache.hyracks.storage.am.common.api.IPageManagerFactory; import org.apache.hyracks.storage.am.common.impls.NoOpOperationCallback; import org.apache.hyracks.storage.am.common.tuples.PermutingTupleReference; -import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndex; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndexAccessor; +import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInPlaceInvertedIndex; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndexSearcher; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedListBuilder; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedListCursor; @@ -69,7 +69,7 @@ import org.apache.hyracks.storage.common.file.BufferedFileHandle; * implemented features: updates (insert/update/delete) Limitations: a query * cannot exceed the size of a Hyracks frame. */ -public class OnDiskInvertedIndex implements IInvertedIndex { +public class OnDiskInvertedIndex implements IInPlaceInvertedIndex { protected final IHyracksCommonContext ctx = new DefaultHyracksCommonContext(); // Schema of BTree tuples, set in constructor. http://git-wip-us.apache.org/repos/asf/asterixdb/blob/63ab05d2/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndexFactory.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndexFactory.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndexFactory.java index 70fcd03..0edc63c 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndexFactory.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndexFactory.java @@ -26,6 +26,7 @@ import org.apache.hyracks.api.io.IIOManager; import org.apache.hyracks.storage.am.common.api.IPageManagerFactory; import org.apache.hyracks.storage.am.lsm.common.impls.IndexFactory; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndex; +import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInPlaceInvertedIndex; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndexFileNameMapper; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedListBuilder; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedListBuilderFactory; @@ -55,7 +56,7 @@ public class OnDiskInvertedIndexFactory extends IndexFactory<IInvertedIndex> { } @Override - public IInvertedIndex createIndexInstance(FileReference dictBTreeFile) throws HyracksDataException { + public IInPlaceInvertedIndex createIndexInstance(FileReference dictBTreeFile) throws HyracksDataException { String invListsFilePath = fileNameMapper.getInvListsFilePath(dictBTreeFile.getFile().getAbsolutePath()); FileReference invListsFile = ioManager.resolveAbsolutePath(invListsFilePath); IInvertedListBuilder invListBuilder = invListBuilderFactory.create(); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/63ab05d2/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndexRangeSearchCursor.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndexRangeSearchCursor.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndexRangeSearchCursor.java index 41cc7eb..fc6f025 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndexRangeSearchCursor.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndexRangeSearchCursor.java @@ -26,7 +26,7 @@ import org.apache.hyracks.storage.am.common.api.IIndexOperationContext; import org.apache.hyracks.storage.am.common.impls.NoOpOperationCallback; import org.apache.hyracks.storage.am.common.tuples.ConcatenatingTupleReference; import org.apache.hyracks.storage.am.common.tuples.PermutingTupleReference; -import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndex; +import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInPlaceInvertedIndex; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedListCursor; import org.apache.hyracks.storage.common.ICursorInitialState; import org.apache.hyracks.storage.common.IIndexAccessor; @@ -40,7 +40,7 @@ public class OnDiskInvertedIndexRangeSearchCursor implements IIndexCursor { private final BTree btree; private final IIndexAccessor btreeAccessor; - private final IInvertedIndex invIndex; + private final IInPlaceInvertedIndex invIndex; private final IIndexOperationContext opCtx; private final IInvertedListCursor invListCursor; private boolean unpinNeeded; @@ -51,7 +51,7 @@ public class OnDiskInvertedIndexRangeSearchCursor implements IIndexCursor { private final PermutingTupleReference tokenTuple; private ConcatenatingTupleReference concatTuple; - public OnDiskInvertedIndexRangeSearchCursor(IInvertedIndex invIndex, IIndexOperationContext opCtx) { + public OnDiskInvertedIndexRangeSearchCursor(IInPlaceInvertedIndex invIndex, IIndexOperationContext opCtx) { this.btree = ((OnDiskInvertedIndex) invIndex).getBTree(); this.btreeAccessor = btree.createAccessor(NoOpOperationCallback.INSTANCE, NoOpOperationCallback.INSTANCE); this.invIndex = invIndex; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/63ab05d2/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/PartitionedOnDiskInvertedIndexFactory.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/PartitionedOnDiskInvertedIndexFactory.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/PartitionedOnDiskInvertedIndexFactory.java index 5b2888a..e8d12ad 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/PartitionedOnDiskInvertedIndexFactory.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/ondisk/PartitionedOnDiskInvertedIndexFactory.java @@ -24,7 +24,7 @@ import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.io.FileReference; import org.apache.hyracks.api.io.IIOManager; import org.apache.hyracks.storage.am.common.api.IPageManagerFactory; -import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndex; +import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInPlaceInvertedIndex; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndexFileNameMapper; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedListBuilder; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedListBuilderFactory; @@ -42,7 +42,7 @@ public class PartitionedOnDiskInvertedIndexFactory extends OnDiskInvertedIndexFa } @Override - public IInvertedIndex createIndexInstance(FileReference dictBTreeFile) throws HyracksDataException { + public IInPlaceInvertedIndex createIndexInstance(FileReference dictBTreeFile) throws HyracksDataException { String invListsFilePath = fileNameMapper.getInvListsFilePath(dictBTreeFile.getFile().getAbsolutePath()); FileReference invListsFile = ioManager.resolveAbsolutePath(invListsFilePath); IInvertedListBuilder invListBuilder = invListBuilderFactory.create(); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/63ab05d2/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/AbstractTOccurrenceSearcher.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/AbstractTOccurrenceSearcher.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/AbstractTOccurrenceSearcher.java index 5faf595..294eb04 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/AbstractTOccurrenceSearcher.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/AbstractTOccurrenceSearcher.java @@ -37,7 +37,7 @@ import org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppenderAccessor; import org.apache.hyracks.dataflow.common.data.accessors.FrameTupleReference; import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference; import org.apache.hyracks.dataflow.common.data.marshalling.UTF8StringSerializerDeserializer; -import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndex; +import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInPlaceInvertedIndex; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndexSearcher; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedListCursor; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IObjectFactory; @@ -61,7 +61,7 @@ public abstract class AbstractTOccurrenceSearcher implements IInvertedIndexSearc protected final InvertedListMerger invListMerger; protected final SearchResult searchResult; - protected final IInvertedIndex invIndex; + protected final IInPlaceInvertedIndex invIndex; protected final MultiComparator invListCmp; protected final ArrayTupleBuilder queryTokenBuilder = new ArrayTupleBuilder(QUERY_TOKEN_REC_DESC.getFieldCount()); @@ -74,15 +74,16 @@ public abstract class AbstractTOccurrenceSearcher implements IInvertedIndexSearc protected final IObjectFactory<IInvertedListCursor> invListCursorFactory; protected final ObjectCache<IInvertedListCursor> invListCursorCache; - public AbstractTOccurrenceSearcher(IHyracksCommonContext ctx, IInvertedIndex invIndex) throws HyracksDataException { + public AbstractTOccurrenceSearcher(IHyracksCommonContext ctx, IInPlaceInvertedIndex invIndex) + throws HyracksDataException { this.ctx = ctx; this.invListMerger = new InvertedListMerger(ctx, invIndex); this.searchResult = new SearchResult(invIndex.getInvListTypeTraits(), ctx); this.invIndex = invIndex; this.invListCmp = MultiComparator.create(invIndex.getInvListCmpFactories()); this.invListCursorFactory = new InvertedListCursorFactory(invIndex); - this.invListCursorCache = new ObjectCache<>(invListCursorFactory, OBJECT_CACHE_INIT_SIZE, - OBJECT_CACHE_EXPAND_SIZE); + this.invListCursorCache = + new ObjectCache<>(invListCursorFactory, OBJECT_CACHE_INIT_SIZE, OBJECT_CACHE_EXPAND_SIZE); this.queryTokenFrame = new VSizeFrame(ctx); this.queryTokenAppender = new FrameTupleAppenderAccessor(QUERY_TOKEN_REC_DESC); this.queryTokenAppender.reset(queryTokenFrame, true); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/63ab05d2/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/InvertedListCursorFactory.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/InvertedListCursorFactory.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/InvertedListCursorFactory.java index 530686d..8ed80f6 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/InvertedListCursorFactory.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/InvertedListCursorFactory.java @@ -19,15 +19,15 @@ package org.apache.hyracks.storage.am.lsm.invertedindex.search; -import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndex; +import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInPlaceInvertedIndex; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedListCursor; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IObjectFactory; public class InvertedListCursorFactory implements IObjectFactory<IInvertedListCursor> { - private final IInvertedIndex invIndex; + private final IInPlaceInvertedIndex invIndex; - public InvertedListCursorFactory(IInvertedIndex invIndex) { + public InvertedListCursorFactory(IInPlaceInvertedIndex invIndex) { this.invIndex = invIndex; } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/63ab05d2/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/PartitionedTOccurrenceSearcher.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/PartitionedTOccurrenceSearcher.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/PartitionedTOccurrenceSearcher.java index 9221e1f..ff5306c 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/PartitionedTOccurrenceSearcher.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/PartitionedTOccurrenceSearcher.java @@ -31,7 +31,7 @@ import org.apache.hyracks.dataflow.common.comm.io.ArrayTupleReference; import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference; import org.apache.hyracks.storage.am.common.api.IIndexOperationContext; import org.apache.hyracks.storage.am.common.tuples.ConcatenatingTupleReference; -import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndex; +import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInPlaceInvertedIndex; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndexSearchModifier; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedListCursor; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IPartitionedInvertedIndex; @@ -52,7 +52,7 @@ public class PartitionedTOccurrenceSearcher extends AbstractTOccurrenceSearcher protected final ArrayList<IInvertedListCursor> cursorsOrderedByTokens = new ArrayList<>(); protected final InvertedListPartitions partitions = new InvertedListPartitions(); - public PartitionedTOccurrenceSearcher(IHyracksCommonContext ctx, IInvertedIndex invIndex) + public PartitionedTOccurrenceSearcher(IHyracksCommonContext ctx, IInPlaceInvertedIndex invIndex) throws HyracksDataException { super(ctx, invIndex); initHelperTuples(); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/63ab05d2/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/TOccurrenceSearcher.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/TOccurrenceSearcher.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/TOccurrenceSearcher.java index 508a51d..4269aa7 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/TOccurrenceSearcher.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/search/TOccurrenceSearcher.java @@ -25,7 +25,7 @@ import org.apache.hyracks.api.context.IHyracksCommonContext; import org.apache.hyracks.api.exceptions.ErrorCode; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.storage.am.common.api.IIndexOperationContext; -import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndex; +import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInPlaceInvertedIndex; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndexSearchModifier; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedListCursor; import org.apache.hyracks.storage.am.lsm.invertedindex.ondisk.OnDiskInvertedIndexSearchCursor; @@ -34,7 +34,8 @@ public class TOccurrenceSearcher extends AbstractTOccurrenceSearcher { protected final ArrayList<IInvertedListCursor> invListCursors = new ArrayList<>(); - public TOccurrenceSearcher(IHyracksCommonContext ctx, IInvertedIndex invIndex) throws HyracksDataException { + public TOccurrenceSearcher(IHyracksCommonContext ctx, IInPlaceInvertedIndex invIndex) + throws HyracksDataException { super(ctx, invIndex); }
