Repository: asterixdb Updated Branches: refs/heads/master 6e7ff4670 -> 356f6c6a0
Rename Component Filter Factory Change-Id: I1b3d9bef3fb6118c66195630cec23a7e41fc5861 Reviewed-on: https://asterix-gerrit.ics.uci.edu/1779 Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> BAD: Jenkins <[email protected]> Reviewed-by: Michael Blow <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/356f6c6a Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/356f6c6a Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/356f6c6a Branch: refs/heads/master Commit: 356f6c6a01cfa46c0c82077f11668236f991ea40 Parents: 6e7ff46 Author: Abdullah Alamoudi <[email protected]> Authored: Sat May 27 01:52:12 2017 -0700 Committer: abdullah alamoudi <[email protected]> Committed: Tue May 30 20:37:25 2017 -0700 ---------------------------------------------------------------------- .../storage/am/lsm/btree/impls/LSMBTree.java | 12 ++--- .../impls/LSMBTreeDiskComponentFactory.java | 10 ++--- .../am/lsm/btree/utils/LSMBTreeUtil.java | 11 +++-- .../lsm/common/api/IComponentFilterHelper.java | 34 +++++++++++++++ .../common/api/ILSMComponentFilterFactory.java | 34 --------------- .../am/lsm/common/impls/AbstractLSMIndex.java | 13 +++--- .../lsm/common/impls/ComponentFilterHelper.java | 46 ++++++++++++++++++++ .../common/impls/LSMComponentFilterFactory.java | 46 -------------------- .../invertedindex/impls/LSMInvertedIndex.java | 12 +++-- .../LSMInvertedIndexDiskComponentFactory.java | 10 ++--- .../impls/PartitionedLSMInvertedIndex.java | 6 +-- .../invertedindex/util/InvertedIndexUtils.java | 32 +++++++------- .../am/lsm/rtree/impls/AbstractLSMRTree.java | 8 ++-- .../storage/am/lsm/rtree/impls/LSMRTree.java | 8 ++-- .../impls/LSMRTreeDiskComponentFactory.java | 10 ++--- .../impls/LSMRTreeWithAntiMatterTuples.java | 10 ++--- ...ithAntiMatterTuplesDiskComponentFactory.java | 10 ++--- .../am/lsm/rtree/utils/LSMRTreeUtils.java | 36 ++++++++------- 18 files changed, 171 insertions(+), 177 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/356f6c6a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTree.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTree.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTree.java index 29532d4..4cd4dc6 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTree.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTree.java @@ -44,8 +44,8 @@ import org.apache.hyracks.storage.am.common.api.ITreeIndexCursor; import org.apache.hyracks.storage.am.common.api.ITreeIndexFrameFactory; import org.apache.hyracks.storage.am.common.impls.NoOpOperationCallback; import org.apache.hyracks.storage.am.lsm.btree.tuples.LSMBTreeTupleReference; +import org.apache.hyracks.storage.am.lsm.common.api.IComponentFilterHelper; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFactory; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFrameFactory; import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent; import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperation; @@ -99,7 +99,7 @@ public class LSMBTree extends AbstractLSMIndex implements ITreeIndex { ITreeIndexFrameFactory interiorFrameFactory, ITreeIndexFrameFactory insertLeafFrameFactory, ITreeIndexFrameFactory deleteLeafFrameFactory, ILSMIndexFileManager fileManager, TreeIndexFactory<BTree> diskBTreeFactory, TreeIndexFactory<BTree> bulkLoadBTreeFactory, - BloomFilterFactory bloomFilterFactory, ILSMComponentFilterFactory filterFactory, + BloomFilterFactory bloomFilterFactory, IComponentFilterHelper filterHelper, ILSMComponentFilterFrameFactory filterFrameFactory, LSMComponentFilterManager filterManager, double bloomFilterFalsePositiveRate, IFileMapProvider diskFileMapProvider, int fieldCount, IBinaryComparatorFactory[] cmpFactories, ILSMMergePolicy mergePolicy, ILSMOperationTracker opTracker, @@ -107,7 +107,7 @@ public class LSMBTree extends AbstractLSMIndex implements ITreeIndex { int[] btreeFields, int[] filterFields, boolean durable) throws HyracksDataException { super(ioManager, virtualBufferCaches, diskBTreeFactory.getBufferCache(), fileManager, diskFileMapProvider, bloomFilterFalsePositiveRate, mergePolicy, opTracker, ioScheduler, ioOpCallback, filterFrameFactory, - filterManager, filterFields, durable, filterFactory, btreeFields); + filterManager, filterFields, durable, filterHelper, btreeFields); this.insertLeafFrameFactory = insertLeafFrameFactory; this.deleteLeafFrameFactory = deleteLeafFrameFactory; this.cmpFactories = cmpFactories; @@ -119,13 +119,13 @@ public class LSMBTree extends AbstractLSMIndex implements ITreeIndex { insertLeafFrameFactory, cmpFactories, fieldCount, ioManager.resolveAbsolutePath(fileManager.getBaseDir() + "_virtual_" + i)), virtualBufferCache, i == 0 ? true : false, - filterFactory == null ? null : filterFactory.createFilter()); + filterHelper == null ? null : filterHelper.createFilter()); memoryComponents.add(mutableComponent); ++i; } - componentFactory = new LSMBTreeDiskComponentFactory(diskBTreeFactory, bloomFilterFactory, filterFactory); + componentFactory = new LSMBTreeDiskComponentFactory(diskBTreeFactory, bloomFilterFactory, filterHelper); bulkLoadComponentFactory = - new LSMBTreeDiskComponentFactory(bulkLoadBTreeFactory, bloomFilterFactory, filterFactory); + new LSMBTreeDiskComponentFactory(bulkLoadBTreeFactory, bloomFilterFactory, filterHelper); this.needKeyDupCheck = needKeyDupCheck; this.hasBloomFilter = needKeyDupCheck; } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/356f6c6a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeDiskComponentFactory.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeDiskComponentFactory.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeDiskComponentFactory.java index a8845cc..399904f 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeDiskComponentFactory.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/impls/LSMBTreeDiskComponentFactory.java @@ -22,7 +22,7 @@ package org.apache.hyracks.storage.am.lsm.btree.impls; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.storage.am.bloomfilter.impls.BloomFilterFactory; import org.apache.hyracks.storage.am.btree.impls.BTree; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFactory; +import org.apache.hyracks.storage.am.lsm.common.api.IComponentFilterHelper; import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponentFactory; import org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentFileReferences; import org.apache.hyracks.storage.am.lsm.common.impls.TreeIndexFactory; @@ -30,13 +30,13 @@ import org.apache.hyracks.storage.am.lsm.common.impls.TreeIndexFactory; public class LSMBTreeDiskComponentFactory implements ILSMDiskComponentFactory { private final TreeIndexFactory<BTree> btreeFactory; private final BloomFilterFactory bloomFilterFactory; - private final ILSMComponentFilterFactory filterFactory; + private final IComponentFilterHelper filterHelper; public LSMBTreeDiskComponentFactory(TreeIndexFactory<BTree> btreeFactory, BloomFilterFactory bloomFilterFactory, - ILSMComponentFilterFactory filterFactory) { + IComponentFilterHelper filterHelper) { this.btreeFactory = btreeFactory; this.bloomFilterFactory = bloomFilterFactory; - this.filterFactory = filterFactory; + this.filterHelper = filterHelper; } @Override @@ -44,7 +44,7 @@ public class LSMBTreeDiskComponentFactory implements ILSMDiskComponentFactory { return new LSMBTreeDiskComponent(btreeFactory.createIndexInstance(cfr.getInsertIndexFileReference()), bloomFilterFactory == null ? null : bloomFilterFactory.createBloomFiltertInstance(cfr.getBloomFilterFileReference()), - filterFactory == null ? null : filterFactory.createFilter()); + filterHelper == null ? null : filterHelper.createFilter()); } public int[] getBloomFilterKeyFields() { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/356f6c6a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/utils/LSMBTreeUtil.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/utils/LSMBTreeUtil.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/utils/LSMBTreeUtil.java index baedc78..0e5fcdb 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/utils/LSMBTreeUtil.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/utils/LSMBTreeUtil.java @@ -49,7 +49,7 @@ import org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTracker; import org.apache.hyracks.storage.am.lsm.common.api.IVirtualBufferCache; import org.apache.hyracks.storage.am.lsm.common.frames.LSMComponentFilterFrameFactory; import org.apache.hyracks.storage.am.lsm.common.impls.BTreeFactory; -import org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentFilterFactory; +import org.apache.hyracks.storage.am.lsm.common.impls.ComponentFilterHelper; import org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentFilterManager; import org.apache.hyracks.storage.am.lsm.common.impls.TreeIndexFactory; import org.apache.hyracks.storage.common.buffercache.IBufferCache; @@ -88,12 +88,12 @@ public class LSMBTreeUtil { BloomFilterFactory bloomFilterFactory = needKeyDupCheck ? new BloomFilterFactory(diskBufferCache, diskFileMapProvider, bloomFilterKeyFields) : null; - LSMComponentFilterFactory filterFactory = null; + ComponentFilterHelper filterHelper = null; LSMComponentFilterFrameFactory filterFrameFactory = null; LSMComponentFilterManager filterManager = null; if (filterCmpFactories != null) { TypeAwareTupleWriterFactory filterTupleWriterFactory = new TypeAwareTupleWriterFactory(filterTypeTraits); - filterFactory = new LSMComponentFilterFactory(filterTupleWriterFactory, filterCmpFactories); + filterHelper = new ComponentFilterHelper(filterTupleWriterFactory, filterCmpFactories); filterFrameFactory = new LSMComponentFilterFrameFactory(filterTupleWriterFactory); filterManager = new LSMComponentFilterManager(filterFrameFactory); } @@ -102,12 +102,11 @@ public class LSMBTreeUtil { ILSMIndexFileManager fileNameManager = new LSMBTreeFileManager(ioManager, diskFileMapProvider, file, diskBTreeFactory, needKeyDupCheck); - LSMBTree lsmTree = new LSMBTree(ioManager, virtualBufferCaches, interiorFrameFactory, insertLeafFrameFactory, + return new LSMBTree(ioManager, virtualBufferCaches, interiorFrameFactory, insertLeafFrameFactory, deleteLeafFrameFactory, fileNameManager, diskBTreeFactory, bulkLoadBTreeFactory, bloomFilterFactory, - filterFactory, filterFrameFactory, filterManager, bloomFilterFalsePositiveRate, diskFileMapProvider, + filterHelper, filterFrameFactory, filterManager, bloomFilterFalsePositiveRate, diskFileMapProvider, typeTraits.length, cmpFactories, mergePolicy, opTracker, ioScheduler, ioOpCallback, needKeyDupCheck, btreeFields, filterFields, durable); - return lsmTree; } public static ExternalBTree createExternalBTree(IIOManager ioManager, FileReference file, http://git-wip-us.apache.org/repos/asf/asterixdb/blob/356f6c6a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/IComponentFilterHelper.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/IComponentFilterHelper.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/IComponentFilterHelper.java new file mode 100644 index 0000000..176064a --- /dev/null +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/IComponentFilterHelper.java @@ -0,0 +1,34 @@ +/* + * 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.common.api; + +import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; + +public interface IComponentFilterHelper { + /** + * @return an instance of ILSMComponentFilter + */ + ILSMComponentFilter createFilter(); + + /** + * @return the array of binary comparator factories for the filter + */ + IBinaryComparatorFactory[] getFilterCmpFactories(); + +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/356f6c6a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilterFactory.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilterFactory.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilterFactory.java deleted file mode 100644 index 6284d4e..0000000 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/api/ILSMComponentFilterFactory.java +++ /dev/null @@ -1,34 +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.hyracks.storage.am.lsm.common.api; - -import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; - -public interface ILSMComponentFilterFactory { - /** - * @return an instance of ILSMComponentFilter - */ - ILSMComponentFilter createFilter(); - - /** - * @return the array of binary comparator factories for the filter - */ - IBinaryComparatorFactory[] getFilterCmpFactories(); - -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/356f6c6a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndex.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndex.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndex.java index 7c34326..4ee9769 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndex.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndex.java @@ -40,9 +40,9 @@ import org.apache.hyracks.storage.am.common.api.ITreeIndex; import org.apache.hyracks.storage.am.common.impls.AbstractSearchPredicate; import org.apache.hyracks.storage.am.common.impls.NoOpOperationCallback; import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation; +import org.apache.hyracks.storage.am.lsm.common.api.IComponentFilterHelper; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent.ComponentState; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFactory; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFrameFactory; import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent; import org.apache.hyracks.storage.am.lsm.common.api.ILSMHarness; @@ -83,7 +83,7 @@ public abstract class AbstractLSMIndex implements ILSMIndex { protected final List<ILSMDiskComponent> diskComponents; protected final List<ILSMDiskComponent> inactiveDiskComponents; protected final double bloomFilterFalsePositiveRate; - protected final ILSMComponentFilterFactory filterFactory; + protected final IComponentFilterHelper filterHelper; protected final ILSMComponentFilterFrameFactory filterFrameFactory; protected final LSMComponentFilterManager filterManager; protected final int[] treeFields; @@ -98,7 +98,8 @@ public abstract class AbstractLSMIndex implements ILSMIndex { double bloomFilterFalsePositiveRate, ILSMMergePolicy mergePolicy, ILSMOperationTracker opTracker, ILSMIOOperationScheduler ioScheduler, ILSMIOOperationCallback ioOpCallback, ILSMComponentFilterFrameFactory filterFrameFactory, LSMComponentFilterManager filterManager, - int[] filterFields, boolean durable, ILSMComponentFilterFactory filterFactory, int[] treeFields) { + int[] filterFields, boolean durable, IComponentFilterHelper filterHelper, + int[] treeFields) { this.ioManager = ioManager; this.virtualBufferCaches = virtualBufferCaches; this.diskBufferCache = diskBufferCache; @@ -108,7 +109,7 @@ public abstract class AbstractLSMIndex implements ILSMIndex { this.ioScheduler = ioScheduler; this.ioOpCallback = ioOpCallback; this.ioOpCallback.setNumOfMutableComponents(virtualBufferCaches.size()); - this.filterFactory = filterFactory; + this.filterHelper = filterHelper; this.filterFrameFactory = filterFrameFactory; this.filterManager = filterManager; this.treeFields = treeFields; @@ -148,7 +149,7 @@ public abstract class AbstractLSMIndex implements ILSMIndex { memoryComponents = null; currentMutableComponentId = null; flushRequests = null; - filterFactory = null; + filterHelper = null; filterFrameFactory = null; filterManager = null; treeFields = null; @@ -570,7 +571,7 @@ public abstract class AbstractLSMIndex implements ILSMIndex { } protected IBinaryComparatorFactory[] getFilterCmpFactories() { - return filterFactory == null ? null : filterFactory.getFilterCmpFactories(); + return filterHelper == null ? null : filterHelper.getFilterCmpFactories(); } @Override http://git-wip-us.apache.org/repos/asf/asterixdb/blob/356f6c6a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/ComponentFilterHelper.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/ComponentFilterHelper.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/ComponentFilterHelper.java new file mode 100644 index 0000000..b448341 --- /dev/null +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/ComponentFilterHelper.java @@ -0,0 +1,46 @@ +/* + * 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.common.impls; + +import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; +import org.apache.hyracks.storage.am.common.api.ITreeIndexTupleWriterFactory; +import org.apache.hyracks.storage.am.lsm.common.api.IComponentFilterHelper; +import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilter; + +public class ComponentFilterHelper implements IComponentFilterHelper { + + private final ITreeIndexTupleWriterFactory tupleWriterFactory; + private final IBinaryComparatorFactory[] filterCmpFactories; + + public ComponentFilterHelper(ITreeIndexTupleWriterFactory tupleWriterFactory, + IBinaryComparatorFactory[] filterCmpFactories) { + this.tupleWriterFactory = tupleWriterFactory; + this.filterCmpFactories = filterCmpFactories; + } + + @Override + public ILSMComponentFilter createFilter() { + return new LSMComponentFilter(tupleWriterFactory.createTupleWriter(), filterCmpFactories); + } + + @Override + public IBinaryComparatorFactory[] getFilterCmpFactories() { + return filterCmpFactories; + } +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/356f6c6a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMComponentFilterFactory.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMComponentFilterFactory.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMComponentFilterFactory.java deleted file mode 100644 index 390321f..0000000 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMComponentFilterFactory.java +++ /dev/null @@ -1,46 +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.hyracks.storage.am.lsm.common.impls; - -import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; -import org.apache.hyracks.storage.am.common.api.ITreeIndexTupleWriterFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilter; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFactory; - -public class LSMComponentFilterFactory implements ILSMComponentFilterFactory { - - private final ITreeIndexTupleWriterFactory tupleWriterFactory; - private final IBinaryComparatorFactory[] filterCmpFactories; - - public LSMComponentFilterFactory(ITreeIndexTupleWriterFactory tupleWriterFactory, - IBinaryComparatorFactory[] filterCmpFactories) { - this.tupleWriterFactory = tupleWriterFactory; - this.filterCmpFactories = filterCmpFactories; - } - - @Override - public ILSMComponentFilter createFilter() { - return new LSMComponentFilter(tupleWriterFactory.createTupleWriter(), filterCmpFactories); - } - - @Override - public IBinaryComparatorFactory[] getFilterCmpFactories() { - return filterCmpFactories; - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/356f6c6a/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 89d8f0b..2363c43 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 @@ -44,9 +44,9 @@ 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.impls.NoOpOperationCallback; import org.apache.hyracks.storage.am.common.tuples.PermutingTupleReference; +import org.apache.hyracks.storage.am.lsm.common.api.IComponentFilterHelper; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent.LSMComponentType; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFactory; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFrameFactory; import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent; import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponentFactory; @@ -107,7 +107,7 @@ public class LSMInvertedIndex extends AbstractLSMIndex implements IInvertedIndex public LSMInvertedIndex(IIOManager ioManager, List<IVirtualBufferCache> virtualBufferCaches, OnDiskInvertedIndexFactory diskInvIndexFactory, BTreeFactory deletedKeysBTreeFactory, - BloomFilterFactory bloomFilterFactory, ILSMComponentFilterFactory filterFactory, + BloomFilterFactory bloomFilterFactory, IComponentFilterHelper filterHelper, ILSMComponentFilterFrameFactory filterFrameFactory, LSMComponentFilterManager filterManager, double bloomFilterFalsePositiveRate, ILSMIndexFileManager fileManager, IFileMapProvider diskFileMapProvider, ITypeTraits[] invListTypeTraits, IBinaryComparatorFactory[] invListCmpFactories, @@ -118,8 +118,7 @@ public class LSMInvertedIndex extends AbstractLSMIndex implements IInvertedIndex boolean durable) throws HyracksDataException { super(ioManager, virtualBufferCaches, diskInvIndexFactory.getBufferCache(), fileManager, diskFileMapProvider, bloomFilterFalsePositiveRate, mergePolicy, opTracker, ioScheduler, ioOpCallback, filterFrameFactory, - filterManager, filterFields, durable, filterFactory, invertedIndexFields); - + filterManager, filterFields, durable, filterHelper, invertedIndexFields); this.tokenizerFactory = tokenizerFactory; this.invListTypeTraits = invListTypeTraits; this.invListCmpFactories = invListCmpFactories; @@ -127,9 +126,8 @@ public class LSMInvertedIndex extends AbstractLSMIndex implements IInvertedIndex this.tokenCmpFactories = tokenCmpFactories; this.filterFieldsForNonBulkLoadOps = filterFieldsForNonBulkLoadOps; this.invertedIndexFieldsForNonBulkLoadOps = invertedIndexFieldsForNonBulkLoadOps; - componentFactory = new LSMInvertedIndexDiskComponentFactory(diskInvIndexFactory, deletedKeysBTreeFactory, - bloomFilterFactory, filterFactory); + bloomFilterFactory, filterHelper); int i = 0; for (IVirtualBufferCache virtualBufferCache : virtualBufferCaches) { @@ -141,7 +139,7 @@ public class LSMInvertedIndex extends AbstractLSMIndex implements IInvertedIndex ioManager.resolveAbsolutePath(fileManager.getBaseDir() + "_virtual_del_" + i)); LSMInvertedIndexMemoryComponent mutableComponent = new LSMInvertedIndexMemoryComponent(memInvIndex, deleteKeysBTree, virtualBufferCache, - i == 0 ? true : false, filterFactory == null ? null : filterFactory.createFilter()); + i == 0 ? true : false, filterHelper == null ? null : filterHelper.createFilter()); memoryComponents.add(mutableComponent); ++i; } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/356f6c6a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexDiskComponentFactory.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexDiskComponentFactory.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexDiskComponentFactory.java index 270d3a1..d018535 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexDiskComponentFactory.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexDiskComponentFactory.java @@ -22,7 +22,7 @@ package org.apache.hyracks.storage.am.lsm.invertedindex.impls; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.storage.am.bloomfilter.impls.BloomFilterFactory; import org.apache.hyracks.storage.am.btree.impls.BTree; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFactory; +import org.apache.hyracks.storage.am.lsm.common.api.IComponentFilterHelper; import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponentFactory; import org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentFileReferences; import org.apache.hyracks.storage.am.lsm.common.impls.TreeIndexFactory; @@ -32,15 +32,15 @@ public class LSMInvertedIndexDiskComponentFactory implements ILSMDiskComponentFa private final OnDiskInvertedIndexFactory diskInvIndexFactory; private final TreeIndexFactory<BTree> btreeFactory; private final BloomFilterFactory bloomFilterFactory; - private final ILSMComponentFilterFactory filterFactory; + private final IComponentFilterHelper filterHelper; public LSMInvertedIndexDiskComponentFactory(OnDiskInvertedIndexFactory diskInvIndexFactory, TreeIndexFactory<BTree> btreeFactory, BloomFilterFactory bloomFilterFactory, - ILSMComponentFilterFactory filterFactory) { + IComponentFilterHelper filterHelper) { this.diskInvIndexFactory = diskInvIndexFactory; this.btreeFactory = btreeFactory; this.bloomFilterFactory = bloomFilterFactory; - this.filterFactory = filterFactory; + this.filterHelper = filterHelper; } @Override @@ -49,6 +49,6 @@ public class LSMInvertedIndexDiskComponentFactory implements ILSMDiskComponentFa diskInvIndexFactory.createIndexInstance(cfr.getInsertIndexFileReference()), btreeFactory.createIndexInstance(cfr.getDeleteIndexFileReference()), bloomFilterFactory.createBloomFiltertInstance(cfr.getBloomFilterFileReference()), - filterFactory == null ? null : filterFactory.createFilter()); + filterHelper == null ? null : filterHelper.createFilter()); } } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/356f6c6a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/PartitionedLSMInvertedIndex.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/PartitionedLSMInvertedIndex.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/PartitionedLSMInvertedIndex.java index 8cd45dc..8863427 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/PartitionedLSMInvertedIndex.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/impls/PartitionedLSMInvertedIndex.java @@ -26,7 +26,7 @@ import org.apache.hyracks.api.dataflow.value.ITypeTraits; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.io.IIOManager; import org.apache.hyracks.storage.am.bloomfilter.impls.BloomFilterFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFactory; +import org.apache.hyracks.storage.am.lsm.common.api.IComponentFilterHelper; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFrameFactory; import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallback; import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationScheduler; @@ -47,7 +47,7 @@ public class PartitionedLSMInvertedIndex extends LSMInvertedIndex { public PartitionedLSMInvertedIndex(IIOManager ioManager, List<IVirtualBufferCache> virtualBufferCaches, OnDiskInvertedIndexFactory diskInvIndexFactory, BTreeFactory deletedKeysBTreeFactory, - BloomFilterFactory bloomFilterFactory, ILSMComponentFilterFactory filterFactory, + BloomFilterFactory bloomFilterFactory, IComponentFilterHelper filterHelper, ILSMComponentFilterFrameFactory filterFrameFactory, LSMComponentFilterManager filterManager, double bloomFilterFalsePositiveRate, ILSMIndexFileManager fileManager, IFileMapProvider diskFileMapProvider, ITypeTraits[] invListTypeTraits, IBinaryComparatorFactory[] invListCmpFactories, @@ -57,7 +57,7 @@ public class PartitionedLSMInvertedIndex extends LSMInvertedIndex { int[] filterFields, int[] filterFieldsForNonBulkLoadOps, int[] invertedIndexFieldsForNonBulkLoadOps, boolean durable) throws HyracksDataException { super(ioManager, virtualBufferCaches, diskInvIndexFactory, deletedKeysBTreeFactory, bloomFilterFactory, - filterFactory, filterFrameFactory, filterManager, bloomFilterFalsePositiveRate, fileManager, + filterHelper, filterFrameFactory, filterManager, bloomFilterFalsePositiveRate, fileManager, diskFileMapProvider, invListTypeTraits, invListCmpFactories, tokenTypeTraits, tokenCmpFactories, tokenizerFactory, mergePolicy, opTracker, ioScheduler, ioOpCallback, invertedIndexFields, filterFields, filterFieldsForNonBulkLoadOps, invertedIndexFieldsForNonBulkLoadOps, durable); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/356f6c6a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/util/InvertedIndexUtils.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/util/InvertedIndexUtils.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/util/InvertedIndexUtils.java index 075cded..8a36f61 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/util/InvertedIndexUtils.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/util/InvertedIndexUtils.java @@ -42,7 +42,7 @@ import org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTracker; import org.apache.hyracks.storage.am.lsm.common.api.IVirtualBufferCache; import org.apache.hyracks.storage.am.lsm.common.frames.LSMComponentFilterFrameFactory; import org.apache.hyracks.storage.am.lsm.common.impls.BTreeFactory; -import org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentFilterFactory; +import org.apache.hyracks.storage.am.lsm.common.impls.ComponentFilterHelper; import org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentFilterManager; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedListBuilder; import org.apache.hyracks.storage.am.lsm.invertedindex.api.IInvertedListBuilderFactory; @@ -152,22 +152,21 @@ public class InvertedIndexUtils { diskFileMapProvider, invListBuilderFactory, invListTypeTraits, invListCmpFactories, tokenTypeTraits, tokenCmpFactories, fileManager, pageManagerFactory); - LSMComponentFilterFactory filterFactory = null; + ComponentFilterHelper filterHelper = null; LSMComponentFilterFrameFactory filterFrameFactory = null; LSMComponentFilterManager filterManager = null; if (filterCmpFactories != null) { TypeAwareTupleWriterFactory filterTupleWriterFactory = new TypeAwareTupleWriterFactory(filterTypeTraits); - filterFactory = new LSMComponentFilterFactory(filterTupleWriterFactory, filterCmpFactories); + filterHelper = new ComponentFilterHelper(filterTupleWriterFactory, filterCmpFactories); filterFrameFactory = new LSMComponentFilterFrameFactory(filterTupleWriterFactory); filterManager = new LSMComponentFilterManager(filterFrameFactory); } - LSMInvertedIndex invIndex = new LSMInvertedIndex(ioManager, virtualBufferCaches, invIndexFactory, - deletedKeysBTreeFactory, bloomFilterFactory, filterFactory, filterFrameFactory, filterManager, - bloomFilterFalsePositiveRate, fileManager, diskFileMapProvider, invListTypeTraits, invListCmpFactories, - tokenTypeTraits, tokenCmpFactories, tokenizerFactory, mergePolicy, opTracker, ioScheduler, ioOpCallback, + return new LSMInvertedIndex(ioManager, virtualBufferCaches, invIndexFactory, deletedKeysBTreeFactory, + bloomFilterFactory, filterHelper, filterFrameFactory, filterManager, bloomFilterFalsePositiveRate, + fileManager, diskFileMapProvider, invListTypeTraits, invListCmpFactories, tokenTypeTraits, + tokenCmpFactories, tokenizerFactory, mergePolicy, opTracker, ioScheduler, ioOpCallback, invertedIndexFields, filterFields, filterFieldsForNonBulkLoadOps, invertedIndexFieldsForNonBulkLoadOps, durable); - return invIndex; } public static PartitionedLSMInvertedIndex createPartitionedLSMInvertedIndex(IIOManager ioManager, @@ -201,21 +200,20 @@ public class InvertedIndexUtils { diskBufferCache, diskFileMapProvider, invListBuilderFactory, invListTypeTraits, invListCmpFactories, tokenTypeTraits, tokenCmpFactories, fileManager, pageManagerFactory); - LSMComponentFilterFactory filterFactory = null; + ComponentFilterHelper filterHelper = null; LSMComponentFilterFrameFactory filterFrameFactory = null; LSMComponentFilterManager filterManager = null; if (filterCmpFactories != null) { TypeAwareTupleWriterFactory filterTupleWriterFactory = new TypeAwareTupleWriterFactory(filterTypeTraits); - filterFactory = new LSMComponentFilterFactory(filterTupleWriterFactory, filterCmpFactories); + filterHelper = new ComponentFilterHelper(filterTupleWriterFactory, filterCmpFactories); filterFrameFactory = new LSMComponentFilterFrameFactory(filterTupleWriterFactory); filterManager = new LSMComponentFilterManager(filterFrameFactory); } - PartitionedLSMInvertedIndex invIndex = new PartitionedLSMInvertedIndex(ioManager, virtualBufferCaches, - invIndexFactory, deletedKeysBTreeFactory, bloomFilterFactory, filterFactory, filterFrameFactory, - filterManager, bloomFilterFalsePositiveRate, fileManager, diskFileMapProvider, invListTypeTraits, - invListCmpFactories, tokenTypeTraits, tokenCmpFactories, tokenizerFactory, mergePolicy, opTracker, - ioScheduler, ioOpCallback, invertedIndexFields, filterFields, filterFieldsForNonBulkLoadOps, - invertedIndexFieldsForNonBulkLoadOps, durable); - return invIndex; + return new PartitionedLSMInvertedIndex(ioManager, virtualBufferCaches, invIndexFactory, deletedKeysBTreeFactory, + bloomFilterFactory, filterHelper, filterFrameFactory, filterManager, bloomFilterFalsePositiveRate, + fileManager, diskFileMapProvider, invListTypeTraits, invListCmpFactories, tokenTypeTraits, + tokenCmpFactories, tokenizerFactory, mergePolicy, opTracker, ioScheduler, ioOpCallback, + invertedIndexFields, filterFields, filterFieldsForNonBulkLoadOps, invertedIndexFieldsForNonBulkLoadOps, + durable); } } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/356f6c6a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java index a9eca4d..444fd9d 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java @@ -34,7 +34,7 @@ import org.apache.hyracks.storage.am.common.api.IPageManager; import org.apache.hyracks.storage.am.common.api.ITreeIndex; import org.apache.hyracks.storage.am.common.api.ITreeIndexFrameFactory; import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFactory; +import org.apache.hyracks.storage.am.lsm.common.api.IComponentFilterHelper; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFrameFactory; import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent; import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponentFactory; @@ -86,13 +86,13 @@ public abstract class AbstractLSMRTree extends AbstractLSMIndex implements ITree IBinaryComparatorFactory[] btreeCmpFactories, ILinearizeComparatorFactory linearizer, int[] comparatorFields, IBinaryComparatorFactory[] linearizerArray, double bloomFilterFalsePositiveRate, ILSMMergePolicy mergePolicy, ILSMOperationTracker opTracker, ILSMIOOperationScheduler ioScheduler, - ILSMIOOperationCallback ioOpCallback, ILSMComponentFilterFactory filterFactory, + ILSMIOOperationCallback ioOpCallback, IComponentFilterHelper filterHelper, ILSMComponentFilterFrameFactory filterFrameFactory, LSMComponentFilterManager filterManager, int[] rtreeFields, int[] filterFields, boolean durable, boolean isPointMBR, IBufferCache diskBufferCache) throws HyracksDataException { super(ioManager, virtualBufferCaches, diskBufferCache, fileManager, diskFileMapProvider, bloomFilterFalsePositiveRate, mergePolicy, opTracker, ioScheduler, ioOpCallback, filterFrameFactory, - filterManager, filterFields, durable, filterFactory, rtreeFields); + filterManager, filterFields, durable, filterHelper, rtreeFields); int i = 0; for (IVirtualBufferCache virtualBufferCache : virtualBufferCaches) { RTree memRTree = new RTree(virtualBufferCache, virtualBufferCache.getFileMapProvider(), @@ -105,7 +105,7 @@ public abstract class AbstractLSMRTree extends AbstractLSMIndex implements ITree ioManager.resolveAbsolutePath(fileManager.getBaseDir() + "_virtual_b_" + i)); LSMRTreeMemoryComponent mutableComponent = new LSMRTreeMemoryComponent(memRTree, memBTree, virtualBufferCache, i == 0 ? true : false, - filterFactory == null ? null : filterFactory.createFilter()); + filterHelper == null ? null : filterHelper.createFilter()); memoryComponents.add(mutableComponent); ++i; } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/356f6c6a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTree.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTree.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTree.java index 640b311..13ff420 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTree.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTree.java @@ -45,8 +45,8 @@ import org.apache.hyracks.storage.am.common.api.ITreeIndexFrameFactory; import org.apache.hyracks.storage.am.common.impls.NoOpOperationCallback; import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation; import org.apache.hyracks.storage.am.common.tuples.DualTupleReference; +import org.apache.hyracks.storage.am.lsm.common.api.IComponentFilterHelper; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFactory; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFrameFactory; import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent; import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperation; @@ -81,7 +81,7 @@ public class LSMRTree extends AbstractLSMRTree { ITreeIndexFrameFactory btreeInteriorFrameFactory, ITreeIndexFrameFactory btreeLeafFrameFactory, ILSMIndexFileManager fileNameManager, TreeIndexFactory<RTree> diskRTreeFactory, TreeIndexFactory<BTree> diskBTreeFactory, BloomFilterFactory bloomFilterFactory, - ILSMComponentFilterFactory filterFactory, ILSMComponentFilterFrameFactory filterFrameFactory, + IComponentFilterHelper filterHelper, ILSMComponentFilterFrameFactory filterFrameFactory, LSMComponentFilterManager filterManager, double bloomFilterFalsePositiveRate, IFileMapProvider diskFileMapProvider, int fieldCount, IBinaryComparatorFactory[] rtreeCmpFactories, IBinaryComparatorFactory[] btreeCmpFactories, ILinearizeComparatorFactory linearizer, @@ -91,10 +91,10 @@ public class LSMRTree extends AbstractLSMRTree { throws HyracksDataException { super(ioManager, virtualBufferCaches, rtreeInteriorFrameFactory, rtreeLeafFrameFactory, btreeInteriorFrameFactory, btreeLeafFrameFactory, fileNameManager, - new LSMRTreeDiskComponentFactory(diskRTreeFactory, diskBTreeFactory, bloomFilterFactory, filterFactory), + new LSMRTreeDiskComponentFactory(diskRTreeFactory, diskBTreeFactory, bloomFilterFactory, filterHelper), diskFileMapProvider, fieldCount, rtreeCmpFactories, btreeCmpFactories, linearizer, comparatorFields, linearizerArray, bloomFilterFalsePositiveRate, mergePolicy, opTracker, ioScheduler, ioOpCallback, - filterFactory, filterFrameFactory, filterManager, rtreeFields, filterFields, durable, isPointMBR, + filterHelper, filterFrameFactory, filterManager, rtreeFields, filterFields, durable, isPointMBR, diskRTreeFactory.getBufferCache()); this.buddyBTreeFields = buddyBTreeFields; } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/356f6c6a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeDiskComponentFactory.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeDiskComponentFactory.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeDiskComponentFactory.java index 2e457d9..c3d8282 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeDiskComponentFactory.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeDiskComponentFactory.java @@ -22,7 +22,7 @@ package org.apache.hyracks.storage.am.lsm.rtree.impls; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.storage.am.bloomfilter.impls.BloomFilterFactory; import org.apache.hyracks.storage.am.btree.impls.BTree; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFactory; +import org.apache.hyracks.storage.am.lsm.common.api.IComponentFilterHelper; import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponentFactory; import org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentFileReferences; import org.apache.hyracks.storage.am.lsm.common.impls.TreeIndexFactory; @@ -32,14 +32,14 @@ public class LSMRTreeDiskComponentFactory implements ILSMDiskComponentFactory { private final TreeIndexFactory<RTree> rtreeFactory; private final TreeIndexFactory<BTree> btreeFactory; private final BloomFilterFactory bloomFilterFactory; - private final ILSMComponentFilterFactory filterFactory; + private final IComponentFilterHelper filterHelper; public LSMRTreeDiskComponentFactory(TreeIndexFactory<RTree> rtreeFactory, TreeIndexFactory<BTree> btreeFactory, - BloomFilterFactory bloomFilterFactory, ILSMComponentFilterFactory filterFactory) { + BloomFilterFactory bloomFilterFactory, IComponentFilterHelper filterHelper) { this.rtreeFactory = rtreeFactory; this.btreeFactory = btreeFactory; this.bloomFilterFactory = bloomFilterFactory; - this.filterFactory = filterFactory; + this.filterHelper = filterHelper; } @Override @@ -47,6 +47,6 @@ public class LSMRTreeDiskComponentFactory implements ILSMDiskComponentFactory { return new LSMRTreeDiskComponent(rtreeFactory.createIndexInstance(cfr.getInsertIndexFileReference()), btreeFactory.createIndexInstance(cfr.getDeleteIndexFileReference()), bloomFilterFactory.createBloomFiltertInstance(cfr.getBloomFilterFileReference()), - filterFactory == null ? null : filterFactory.createFilter()); + filterHelper == null ? null : filterHelper.createFilter()); } } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/356f6c6a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuples.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuples.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuples.java index bb85696..a20e6f2 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuples.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuples.java @@ -36,8 +36,8 @@ import org.apache.hyracks.storage.am.common.api.ITreeIndexCursor; import org.apache.hyracks.storage.am.common.api.ITreeIndexFrameFactory; 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.common.api.IComponentFilterHelper; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFactory; import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFrameFactory; import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent; import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponentFactory; @@ -82,7 +82,7 @@ public class LSMRTreeWithAntiMatterTuples extends AbstractLSMRTree { ITreeIndexFrameFactory rtreeInteriorFrameFactory, ITreeIndexFrameFactory rtreeLeafFrameFactory, ITreeIndexFrameFactory btreeInteriorFrameFactory, ITreeIndexFrameFactory btreeLeafFrameFactory, ILSMIndexFileManager fileManager, TreeIndexFactory<RTree> diskRTreeFactory, - TreeIndexFactory<RTree> bulkLoadRTreeFactory, ILSMComponentFilterFactory filterFactory, + TreeIndexFactory<RTree> bulkLoadRTreeFactory, IComponentFilterHelper filterHelper, ILSMComponentFilterFrameFactory filterFrameFactory, LSMComponentFilterManager filterManager, IFileMapProvider diskFileMapProvider, int fieldCount, IBinaryComparatorFactory[] rtreeCmpFactories, IBinaryComparatorFactory[] btreeComparatorFactories, ILinearizeComparatorFactory linearizer, @@ -91,13 +91,13 @@ public class LSMRTreeWithAntiMatterTuples extends AbstractLSMRTree { int[] rtreeFields, int[] filterFields, boolean durable, boolean isPointMBR) throws HyracksDataException { super(ioManager, virtualBufferCaches, rtreeInteriorFrameFactory, rtreeLeafFrameFactory, btreeInteriorFrameFactory, btreeLeafFrameFactory, fileManager, - new LSMRTreeWithAntiMatterTuplesDiskComponentFactory(diskRTreeFactory, filterFactory), + new LSMRTreeWithAntiMatterTuplesDiskComponentFactory(diskRTreeFactory, filterHelper), diskFileMapProvider, fieldCount, rtreeCmpFactories, btreeComparatorFactories, linearizer, - comparatorFields, linearizerArray, 0, mergePolicy, opTracker, ioScheduler, ioOpCallback, filterFactory, + comparatorFields, linearizerArray, 0, mergePolicy, opTracker, ioScheduler, ioOpCallback, filterHelper, filterFrameFactory, filterManager, rtreeFields, filterFields, durable, isPointMBR, diskRTreeFactory.getBufferCache()); bulkLoaComponentFactory = - new LSMRTreeWithAntiMatterTuplesDiskComponentFactory(bulkLoadRTreeFactory, filterFactory); + new LSMRTreeWithAntiMatterTuplesDiskComponentFactory(bulkLoadRTreeFactory, filterHelper); } @Override http://git-wip-us.apache.org/repos/asf/asterixdb/blob/356f6c6a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuplesDiskComponentFactory.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuplesDiskComponentFactory.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuplesDiskComponentFactory.java index f1af5a1..a6216fc 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuplesDiskComponentFactory.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/impls/LSMRTreeWithAntiMatterTuplesDiskComponentFactory.java @@ -20,7 +20,7 @@ package org.apache.hyracks.storage.am.lsm.rtree.impls; import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilterFactory; +import org.apache.hyracks.storage.am.lsm.common.api.IComponentFilterHelper; import org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponentFactory; import org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentFileReferences; import org.apache.hyracks.storage.am.lsm.common.impls.TreeIndexFactory; @@ -28,17 +28,17 @@ import org.apache.hyracks.storage.am.rtree.impls.RTree; public class LSMRTreeWithAntiMatterTuplesDiskComponentFactory implements ILSMDiskComponentFactory { private final TreeIndexFactory<RTree> rtreeFactory; - private final ILSMComponentFilterFactory filterFactory; + private final IComponentFilterHelper filterHelper; public LSMRTreeWithAntiMatterTuplesDiskComponentFactory(TreeIndexFactory<RTree> rtreeFactory, - ILSMComponentFilterFactory filterFactory) { + IComponentFilterHelper filterHelper) { this.rtreeFactory = rtreeFactory; - this.filterFactory = filterFactory; + this.filterHelper = filterHelper; } @Override public LSMRTreeDiskComponent createComponent(LSMComponentFileReferences cfr) throws HyracksDataException { return new LSMRTreeDiskComponent(rtreeFactory.createIndexInstance(cfr.getInsertIndexFileReference()), null, - null, filterFactory == null ? null : filterFactory.createFilter()); + null, filterHelper == null ? null : filterHelper.createFilter()); } } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/356f6c6a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/utils/LSMRTreeUtils.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/utils/LSMRTreeUtils.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/utils/LSMRTreeUtils.java index e702d59..d390be0 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/utils/LSMRTreeUtils.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/utils/LSMRTreeUtils.java @@ -47,7 +47,7 @@ import org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTracker; import org.apache.hyracks.storage.am.lsm.common.api.IVirtualBufferCache; import org.apache.hyracks.storage.am.lsm.common.frames.LSMComponentFilterFrameFactory; import org.apache.hyracks.storage.am.lsm.common.impls.BTreeFactory; -import org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentFilterFactory; +import org.apache.hyracks.storage.am.lsm.common.impls.ComponentFilterHelper; import org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentFilterManager; import org.apache.hyracks.storage.am.lsm.common.impls.TreeIndexFactory; import org.apache.hyracks.storage.am.lsm.rtree.impls.ExternalRTree; @@ -121,24 +121,23 @@ public class LSMRTreeUtils { BloomFilterFactory bloomFilterFactory = new BloomFilterFactory(diskBufferCache, diskFileMapProvider, bloomFilterKeyFields); - LSMComponentFilterFactory filterFactory = null; + ComponentFilterHelper filterHelper = null; LSMComponentFilterFrameFactory filterFrameFactory = null; LSMComponentFilterManager filterManager = null; if (filterCmpFactories != null) { TypeAwareTupleWriterFactory filterTupleWriterFactory = new TypeAwareTupleWriterFactory(filterTypeTraits); - filterFactory = new LSMComponentFilterFactory(filterTupleWriterFactory, filterCmpFactories); + filterHelper = new ComponentFilterHelper(filterTupleWriterFactory, filterCmpFactories); filterFrameFactory = new LSMComponentFilterFrameFactory(filterTupleWriterFactory); filterManager = new LSMComponentFilterManager(filterFrameFactory); } ILSMIndexFileManager fileNameManager = new LSMRTreeFileManager(ioManager, diskFileMapProvider, file, diskRTreeFactory, diskBTreeFactory); - LSMRTree lsmTree = new LSMRTree(ioManager, virtualBufferCaches, rtreeInteriorFrameFactory, - rtreeLeafFrameFactory, btreeInteriorFrameFactory, btreeLeafFrameFactory, fileNameManager, - diskRTreeFactory, diskBTreeFactory, bloomFilterFactory, filterFactory, filterFrameFactory, - filterManager, bloomFilterFalsePositiveRate, diskFileMapProvider, typeTraits.length, rtreeCmpFactories, - btreeCmpFactories, linearizeCmpFactory, comparatorFields, linearizerArray, mergePolicy, opTracker, - ioScheduler, ioOpCallback, rtreeFields, buddyBTreeFields, filterFields, durable, isPointMBR); - return lsmTree; + return new LSMRTree(ioManager, virtualBufferCaches, rtreeInteriorFrameFactory, rtreeLeafFrameFactory, + btreeInteriorFrameFactory, btreeLeafFrameFactory, fileNameManager, diskRTreeFactory, diskBTreeFactory, + bloomFilterFactory, filterHelper, filterFrameFactory, filterManager, bloomFilterFalsePositiveRate, + diskFileMapProvider, typeTraits.length, rtreeCmpFactories, btreeCmpFactories, linearizeCmpFactory, + comparatorFields, linearizerArray, mergePolicy, opTracker, ioScheduler, ioOpCallback, rtreeFields, + buddyBTreeFields, filterFields, durable, isPointMBR); } public static LSMRTreeWithAntiMatterTuples createLSMTreeWithAntiMatterTuples(IIOManager ioManager, @@ -204,24 +203,23 @@ public class LSMRTreeUtils { j++; } - LSMComponentFilterFactory filterFactory = null; + ComponentFilterHelper filterHelper = null; LSMComponentFilterFrameFactory filterFrameFactory = null; LSMComponentFilterManager filterManager = null; if (filterCmpFactories != null) { TypeAwareTupleWriterFactory filterTupleWriterFactory = new TypeAwareTupleWriterFactory(filterTypeTraits); - filterFactory = new LSMComponentFilterFactory(filterTupleWriterFactory, filterCmpFactories); + filterHelper = new ComponentFilterHelper(filterTupleWriterFactory, filterCmpFactories); filterFrameFactory = new LSMComponentFilterFrameFactory(filterTupleWriterFactory); filterManager = new LSMComponentFilterManager(filterFrameFactory); } ILSMIndexFileManager fileNameManager = new LSMRTreeWithAntiMatterTuplesFileManager(ioManager, diskFileMapProvider, file, diskRTreeFactory); - LSMRTreeWithAntiMatterTuples lsmTree = new LSMRTreeWithAntiMatterTuples(ioManager, virtualBufferCaches, - rtreeInteriorFrameFactory, rtreeLeafFrameFactory, btreeInteriorFrameFactory, btreeLeafFrameFactory, - fileNameManager, diskRTreeFactory, bulkLoadRTreeFactory, filterFactory, filterFrameFactory, - filterManager, diskFileMapProvider, typeTraits.length, rtreeCmpFactories, - btreeComparatorFactories, linearizerCmpFactory, comparatorFields, linearizerArray, mergePolicy, - opTracker, ioScheduler, ioOpCallback, rtreeFields, filterFields, durable, isPointMBR); - return lsmTree; + return new LSMRTreeWithAntiMatterTuples(ioManager, virtualBufferCaches, rtreeInteriorFrameFactory, + rtreeLeafFrameFactory, btreeInteriorFrameFactory, btreeLeafFrameFactory, fileNameManager, + diskRTreeFactory, bulkLoadRTreeFactory, filterHelper, filterFrameFactory, filterManager, + diskFileMapProvider, typeTraits.length, rtreeCmpFactories, btreeComparatorFactories, + linearizerCmpFactory, comparatorFields, linearizerArray, mergePolicy, opTracker, ioScheduler, + ioOpCallback, rtreeFields, filterFields, durable, isPointMBR); } public static ExternalRTree createExternalRTree(IIOManager ioManager, FileReference file,
