http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeDataflowHelperFactory.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeDataflowHelperFactory.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeDataflowHelperFactory.java deleted file mode 100644 index aab4b0b..0000000 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeDataflowHelperFactory.java +++ /dev/null @@ -1,50 +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.rtree.dataflow; - -import org.apache.hyracks.api.context.IHyracksTaskContext; -import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory; -import org.apache.hyracks.storage.am.common.dataflow.IIndexDataflowHelperFactory; -import org.apache.hyracks.storage.am.common.dataflow.IIndexOperatorDescriptor; -import org.apache.hyracks.storage.am.common.dataflow.IndexDataflowHelper; -import org.apache.hyracks.storage.am.rtree.frames.RTreePolicyType; - -public class RTreeDataflowHelperFactory implements IIndexDataflowHelperFactory { - - private static final long serialVersionUID = 1L; - - private final IPrimitiveValueProviderFactory[] valueProviderFactories; - private final RTreePolicyType rtreePolicyType; - private final boolean durable; - - public RTreeDataflowHelperFactory(IPrimitiveValueProviderFactory[] valueProviderFactories, - RTreePolicyType rtreePolicyType, boolean durable) { - this.valueProviderFactories = valueProviderFactories; - this.rtreePolicyType = rtreePolicyType; - this.durable = durable; - } - - @Override - public IndexDataflowHelper createIndexDataflowHelper(IIndexOperatorDescriptor opDesc, IHyracksTaskContext ctx, - int partition) throws HyracksDataException { - return new RTreeDataflowHelper(opDesc, ctx, partition, valueProviderFactories, rtreePolicyType, durable); - } -}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeResource.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeResource.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeResource.java new file mode 100644 index 0000000..5dc0a4e --- /dev/null +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeResource.java @@ -0,0 +1,72 @@ +/* + * 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.rtree.dataflow; + +import org.apache.hyracks.api.application.INCServiceContext; +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.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.common.api.IPrimitiveValueProviderFactory; +import org.apache.hyracks.storage.am.rtree.frames.RTreePolicyType; +import org.apache.hyracks.storage.am.rtree.util.RTreeUtils; +import org.apache.hyracks.storage.common.IIndex; +import org.apache.hyracks.storage.common.IResource; +import org.apache.hyracks.storage.common.IStorageManager; + +public class RTreeResource implements IResource { + + private static final long serialVersionUID = 1L; + private final String path; + private final IStorageManager storageManager; + private final ITypeTraits[] typeTraits; + private final IBinaryComparatorFactory[] comparatorFactories; + private final IPageManagerFactory pageManagerFactory; + private final IPrimitiveValueProviderFactory[] valueProviderFactories; + private final RTreePolicyType rtreePolicyType; + + public RTreeResource(String path, IStorageManager storageManager, ITypeTraits[] typeTraits, + IBinaryComparatorFactory[] comparatorFactories, IPageManagerFactory pageManagerFactory, + IPrimitiveValueProviderFactory[] valueProviderFactories, RTreePolicyType rtreePolicyType) { + this.path = path; + this.storageManager = storageManager; + this.typeTraits = typeTraits; + this.comparatorFactories = comparatorFactories; + this.pageManagerFactory = pageManagerFactory; + this.valueProviderFactories = valueProviderFactories; + this.rtreePolicyType = rtreePolicyType; + } + + @Override + public IIndex createInstance(INCServiceContext ctx) throws HyracksDataException { + IIOManager ioManager = ctx.getIoManager(); + FileReference resourceRef = ioManager.resolve(path); + return RTreeUtils.createRTree(storageManager.getBufferCache(ctx), storageManager.getFileMapProvider(ctx), + typeTraits, valueProviderFactories, comparatorFactories, rtreePolicyType, resourceRef, false, + pageManagerFactory); + } + + @Override + public String getPath() { + return path; + } + +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeResourceFactory.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeResourceFactory.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeResourceFactory.java new file mode 100644 index 0000000..1a3bb0b --- /dev/null +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeResourceFactory.java @@ -0,0 +1,58 @@ +/* + * 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.rtree.dataflow; + +import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; +import org.apache.hyracks.api.dataflow.value.ITypeTraits; +import org.apache.hyracks.api.io.FileReference; +import org.apache.hyracks.storage.am.common.api.IPageManagerFactory; +import org.apache.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory; +import org.apache.hyracks.storage.am.rtree.frames.RTreePolicyType; +import org.apache.hyracks.storage.common.IResource; +import org.apache.hyracks.storage.common.IResourceFactory; +import org.apache.hyracks.storage.common.IStorageManager; + +public class RTreeResourceFactory implements IResourceFactory { + + private static final long serialVersionUID = 1L; + private final IStorageManager storageManager; + private final ITypeTraits[] typeTraits; + private final IBinaryComparatorFactory[] comparatorFactories; + private final IPageManagerFactory pageManagerFactory; + private final IPrimitiveValueProviderFactory[] valueProviderFactories; + private final RTreePolicyType rtreePolicyType; + + public RTreeResourceFactory(IStorageManager storageManager, ITypeTraits[] typeTraits, + IBinaryComparatorFactory[] comparatorFactories, IPageManagerFactory pageManagerFactory, + IPrimitiveValueProviderFactory[] valueProviderFactories, RTreePolicyType rtreePolicyType) { + this.storageManager = storageManager; + this.typeTraits = typeTraits; + this.comparatorFactories = comparatorFactories; + this.pageManagerFactory = pageManagerFactory; + this.valueProviderFactories = valueProviderFactories; + this.rtreePolicyType = rtreePolicyType; + } + + @Override + public IResource createResource(FileReference fileRef) { + return new RTreeResource(fileRef.getRelativePath(), storageManager, typeTraits, comparatorFactories, + pageManagerFactory, valueProviderFactories, rtreePolicyType); + } + +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorDescriptor.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorDescriptor.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorDescriptor.java index 85639ad..0a4d2a7 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorDescriptor.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorDescriptor.java @@ -21,66 +21,56 @@ package org.apache.hyracks.storage.am.rtree.dataflow; import org.apache.hyracks.api.context.IHyracksTaskContext; import org.apache.hyracks.api.dataflow.IOperatorNodePushable; -import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; import org.apache.hyracks.api.dataflow.value.IMissingWriterFactory; import org.apache.hyracks.api.dataflow.value.IRecordDescriptorProvider; -import org.apache.hyracks.api.dataflow.value.ITypeTraits; import org.apache.hyracks.api.dataflow.value.RecordDescriptor; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.job.IOperatorDescriptorRegistry; -import org.apache.hyracks.dataflow.std.file.IFileSplitProvider; -import org.apache.hyracks.storage.am.common.api.IIndexLifecycleManagerProvider; -import org.apache.hyracks.storage.am.common.api.IPageManagerFactory; +import org.apache.hyracks.dataflow.std.base.AbstractSingleActivityOperatorDescriptor; import org.apache.hyracks.storage.am.common.api.ISearchOperationCallbackFactory; -import org.apache.hyracks.storage.am.common.dataflow.AbstractTreeIndexOperatorDescriptor; import org.apache.hyracks.storage.am.common.dataflow.IIndexDataflowHelperFactory; -import org.apache.hyracks.storage.am.common.impls.NoOpOperationCallbackFactory; -import org.apache.hyracks.storage.common.IStorageManager; -import org.apache.hyracks.storage.common.file.NoOpLocalResourceFactoryProvider; -public class RTreeSearchOperatorDescriptor extends AbstractTreeIndexOperatorDescriptor { +public class RTreeSearchOperatorDescriptor extends AbstractSingleActivityOperatorDescriptor { private static final long serialVersionUID = 1L; - - protected int[] keyFields; // fields in input tuple to be used as keys + protected final int[] keyFields; + protected final boolean lowKeyInclusive; + protected final boolean highKeyInclusive; protected final int[] minFilterFieldIndexes; protected final int[] maxFilterFieldIndexes; - protected final boolean appendFilter; + protected final boolean appendIndexFilter; + protected final IIndexDataflowHelperFactory indexHelperFactory; + protected final boolean retainInput; + protected final boolean retainMissing; + protected final IMissingWriterFactory missingWriterFactory; + protected final ISearchOperationCallbackFactory searchCallbackFactory; - public RTreeSearchOperatorDescriptor(IOperatorDescriptorRegistry spec, RecordDescriptor recDesc, - IStorageManager storageManager, IIndexLifecycleManagerProvider lifecycleManagerProvider, - IFileSplitProvider fileSplitProvider, ITypeTraits[] typeTraits, - IBinaryComparatorFactory[] comparatorFactories, int[] keyFields, - IIndexDataflowHelperFactory dataflowHelperFactory, boolean retainInput, boolean retainNull, - IMissingWriterFactory nullWriterFactory, ISearchOperationCallbackFactory searchOpCallbackFactory, - boolean appendFilter, int[] minFilterFieldIndexes, int[] maxFilterFieldIndexes, - IPageManagerFactory pageManagerFactory) { - super(spec, 1, 1, recDesc, storageManager, lifecycleManagerProvider, fileSplitProvider, typeTraits, - comparatorFactories, null, dataflowHelperFactory, null, retainInput, retainNull, nullWriterFactory, - NoOpLocalResourceFactoryProvider.INSTANCE, searchOpCallbackFactory, - NoOpOperationCallbackFactory.INSTANCE, pageManagerFactory); + public RTreeSearchOperatorDescriptor(IOperatorDescriptorRegistry spec, RecordDescriptor outRecDesc, int[] keyFields, + boolean lowKeyInclusive, boolean highKeyInclusive, IIndexDataflowHelperFactory indexHelperFactory, + boolean retainInput, boolean retainMissing, IMissingWriterFactory missingWriterFactory, + ISearchOperationCallbackFactory searchCallbackFactory, int[] minFilterFieldIndexes, + int[] maxFilterFieldIndexes, boolean appendIndexFilter) { + super(spec, 1, 1); + this.indexHelperFactory = indexHelperFactory; + this.retainInput = retainInput; + this.retainMissing = retainMissing; + this.missingWriterFactory = missingWriterFactory; + this.searchCallbackFactory = searchCallbackFactory; this.keyFields = keyFields; + this.lowKeyInclusive = lowKeyInclusive; + this.highKeyInclusive = highKeyInclusive; this.minFilterFieldIndexes = minFilterFieldIndexes; this.maxFilterFieldIndexes = maxFilterFieldIndexes; - this.appendFilter = appendFilter; - } - - public RTreeSearchOperatorDescriptor(IOperatorDescriptorRegistry spec, RecordDescriptor recDesc, - IStorageManager storageManager, IIndexLifecycleManagerProvider lifecycleManagerProvider, - IFileSplitProvider fileSplitProvider, ITypeTraits[] typeTraits, - IBinaryComparatorFactory[] comparatorFactories, int[] keyFields, - IIndexDataflowHelperFactory dataflowHelperFactory, boolean retainInput, boolean retainNull, - IMissingWriterFactory nullWriterFactory, ISearchOperationCallbackFactory searchOpCallbackFactory, - int[] minFilterFieldIndexes, int[] maxFilterFieldIndexes, IPageManagerFactory pageManagerFactory) { - this(spec, recDesc, storageManager, lifecycleManagerProvider, fileSplitProvider, typeTraits, - comparatorFactories, keyFields, dataflowHelperFactory, retainInput, retainNull, nullWriterFactory, - searchOpCallbackFactory, false, minFilterFieldIndexes, maxFilterFieldIndexes, pageManagerFactory); + this.appendIndexFilter = appendIndexFilter; + this.outRecDescs[0] = outRecDesc; } @Override public IOperatorNodePushable createPushRuntime(final IHyracksTaskContext ctx, IRecordDescriptorProvider recordDescProvider, int partition, int nPartitions) throws HyracksDataException { - return new RTreeSearchOperatorNodePushable(this, ctx, partition, recordDescProvider, keyFields, appendFilter, - minFilterFieldIndexes, maxFilterFieldIndexes); + return new RTreeSearchOperatorNodePushable(ctx, partition, + recordDescProvider.getInputRecordDescriptor(getActivityId(), 0), keyFields, minFilterFieldIndexes, + maxFilterFieldIndexes, indexHelperFactory, retainInput, retainMissing, missingWriterFactory, + searchCallbackFactory, appendIndexFilter); } } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorNodePushable.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorNodePushable.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorNodePushable.java index d0d77d9..07b6a60 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorNodePushable.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorNodePushable.java @@ -20,25 +20,30 @@ package org.apache.hyracks.storage.am.rtree.dataflow; import org.apache.hyracks.api.context.IHyracksTaskContext; -import org.apache.hyracks.api.dataflow.value.IRecordDescriptorProvider; +import org.apache.hyracks.api.dataflow.value.IMissingWriterFactory; +import org.apache.hyracks.api.dataflow.value.RecordDescriptor; import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.storage.am.common.api.ISearchPredicate; +import org.apache.hyracks.storage.am.common.api.ISearchOperationCallbackFactory; import org.apache.hyracks.storage.am.common.api.ITreeIndex; -import org.apache.hyracks.storage.am.common.dataflow.AbstractTreeIndexOperatorDescriptor; +import org.apache.hyracks.storage.am.common.dataflow.IIndexDataflowHelperFactory; import org.apache.hyracks.storage.am.common.dataflow.IndexSearchOperatorNodePushable; -import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator; import org.apache.hyracks.storage.am.common.tuples.PermutingFrameTupleReference; import org.apache.hyracks.storage.am.rtree.impls.SearchPredicate; import org.apache.hyracks.storage.am.rtree.util.RTreeUtils; +import org.apache.hyracks.storage.common.ISearchPredicate; +import org.apache.hyracks.storage.common.MultiComparator; public class RTreeSearchOperatorNodePushable extends IndexSearchOperatorNodePushable { protected PermutingFrameTupleReference searchKey; protected MultiComparator cmp; - public RTreeSearchOperatorNodePushable(AbstractTreeIndexOperatorDescriptor opDesc, IHyracksTaskContext ctx, - int partition, IRecordDescriptorProvider recordDescProvider, int[] keyFields, boolean appendFilter, - int[] minFilterFieldIndexes, int[] maxFilterFieldIndexes) throws HyracksDataException { - super(opDesc, ctx, partition, recordDescProvider, appendFilter, minFilterFieldIndexes, maxFilterFieldIndexes); + public RTreeSearchOperatorNodePushable(IHyracksTaskContext ctx, int partition, RecordDescriptor inputRecDesc, + int[] keyFields, int[] minFilterFieldIndexes, int[] maxFilterFieldIndexes, + IIndexDataflowHelperFactory indexHelperFactory, boolean retainInput, boolean retainMissing, + IMissingWriterFactory missingWriterFactory, ISearchOperationCallbackFactory searchCallbackFactory, + boolean appendIndexFilter) throws HyracksDataException { + super(ctx, inputRecDesc, partition, minFilterFieldIndexes, maxFilterFieldIndexes, indexHelperFactory, + retainInput, retainMissing, missingWriterFactory, searchCallbackFactory, appendIndexFilter); if (keyFields != null && keyFields.length > 0) { searchKey = new PermutingFrameTupleReference(); searchKey.setFieldPermutation(keyFields); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RStarTreePolicy.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RStarTreePolicy.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RStarTreePolicy.java index bf37eab..7ae616a 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RStarTreePolicy.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RStarTreePolicy.java @@ -30,7 +30,6 @@ import org.apache.hyracks.storage.am.common.api.ITreeIndexFrame; import org.apache.hyracks.storage.am.common.api.ITreeIndexTupleReference; import org.apache.hyracks.storage.am.common.api.ITreeIndexTupleWriter; import org.apache.hyracks.storage.am.common.frames.FrameOpSpaceStatus; -import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator; import org.apache.hyracks.storage.am.rtree.api.IRTreeFrame; import org.apache.hyracks.storage.am.rtree.api.IRTreePolicy; import org.apache.hyracks.storage.am.rtree.impls.EntriesOrder; @@ -39,6 +38,7 @@ import org.apache.hyracks.storage.am.rtree.impls.Rectangle; import org.apache.hyracks.storage.am.rtree.impls.TupleEntryArrayList; import org.apache.hyracks.storage.am.rtree.impls.UnorderedSlotManager; import org.apache.hyracks.storage.am.rtree.tuples.RTreeTypeAwareTupleWriter; +import org.apache.hyracks.storage.common.MultiComparator; public class RStarTreePolicy implements IRTreePolicy { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeComputationUtils.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeComputationUtils.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeComputationUtils.java index 80c3e32..31ade3c 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeComputationUtils.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeComputationUtils.java @@ -22,7 +22,7 @@ package org.apache.hyracks.storage.am.rtree.frames; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference; import org.apache.hyracks.storage.am.common.api.IPrimitiveValueProvider; -import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator; +import org.apache.hyracks.storage.common.MultiComparator; public class RTreeComputationUtils { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeNSMFrame.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeNSMFrame.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeNSMFrame.java index 9acfd39..ba542ea 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeNSMFrame.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeNSMFrame.java @@ -27,10 +27,10 @@ import org.apache.hyracks.storage.am.common.api.ITreeIndexFrame; import org.apache.hyracks.storage.am.common.api.ITreeIndexTupleReference; import org.apache.hyracks.storage.am.common.api.ITreeIndexTupleWriter; import org.apache.hyracks.storage.am.common.frames.TreeIndexNSMFrame; -import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator; import org.apache.hyracks.storage.am.rtree.api.IRTreeFrame; import org.apache.hyracks.storage.am.rtree.api.IRTreePolicy; import org.apache.hyracks.storage.am.rtree.impls.UnorderedSlotManager; +import org.apache.hyracks.storage.common.MultiComparator; import org.apache.hyracks.storage.common.buffercache.IBufferCache; import org.apache.hyracks.storage.common.buffercache.IExtraPageBlockHelper; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeNSMInteriorFrame.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeNSMInteriorFrame.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeNSMInteriorFrame.java index e24ab6b..18f7106 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeNSMInteriorFrame.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeNSMInteriorFrame.java @@ -33,10 +33,10 @@ import org.apache.hyracks.storage.am.common.api.ITreeIndexTupleReference; import org.apache.hyracks.storage.am.common.api.ITreeIndexTupleWriter; import org.apache.hyracks.storage.am.common.frames.AbstractSlotManager; import org.apache.hyracks.storage.am.common.frames.FrameOpSpaceStatus; -import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator; import org.apache.hyracks.storage.am.common.ophelpers.SlotOffTupleOff; import org.apache.hyracks.storage.am.rtree.api.IRTreeInteriorFrame; import org.apache.hyracks.storage.am.rtree.impls.PathList; +import org.apache.hyracks.storage.common.MultiComparator; public class RTreeNSMInteriorFrame extends RTreeNSMFrame implements IRTreeInteriorFrame { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeNSMLeafFrame.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeNSMLeafFrame.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeNSMLeafFrame.java index b8b8877..c86cc3d 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeNSMLeafFrame.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreeNSMLeafFrame.java @@ -24,8 +24,8 @@ import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference; import org.apache.hyracks.storage.am.common.api.IPrimitiveValueProvider; import org.apache.hyracks.storage.am.common.api.ITreeIndexTupleReference; import org.apache.hyracks.storage.am.common.api.ITreeIndexTupleWriter; -import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator; import org.apache.hyracks.storage.am.rtree.api.IRTreeLeafFrame; +import org.apache.hyracks.storage.common.MultiComparator; public class RTreeNSMLeafFrame extends RTreeNSMFrame implements IRTreeLeafFrame { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreePolicy.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreePolicy.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreePolicy.java index 31466ee..0dea4c2 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreePolicy.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/frames/RTreePolicy.java @@ -30,13 +30,13 @@ import org.apache.hyracks.storage.am.common.api.ITreeIndexFrame; import org.apache.hyracks.storage.am.common.api.ITreeIndexTupleReference; import org.apache.hyracks.storage.am.common.api.ITreeIndexTupleWriter; import org.apache.hyracks.storage.am.common.frames.FrameOpSpaceStatus; -import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator; import org.apache.hyracks.storage.am.rtree.api.IRTreeFrame; import org.apache.hyracks.storage.am.rtree.api.IRTreePolicy; import org.apache.hyracks.storage.am.rtree.impls.RTreeSplitKey; import org.apache.hyracks.storage.am.rtree.impls.Rectangle; import org.apache.hyracks.storage.am.rtree.impls.UnorderedSlotManager; import org.apache.hyracks.storage.am.rtree.tuples.RTreeTypeAwareTupleWriter; +import org.apache.hyracks.storage.common.MultiComparator; public class RTreePolicy implements IRTreePolicy { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTree.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTree.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTree.java index 00c67fa..1160da7 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTree.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTree.java @@ -30,13 +30,8 @@ import org.apache.hyracks.api.exceptions.ErrorCode; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.io.FileReference; import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference; -import org.apache.hyracks.storage.am.common.api.IIndexBulkLoader; -import org.apache.hyracks.storage.am.common.api.IIndexCursor; import org.apache.hyracks.storage.am.common.api.IIndexOperationContext; -import org.apache.hyracks.storage.am.common.api.IModificationOperationCallback; import org.apache.hyracks.storage.am.common.api.IPageManager; -import org.apache.hyracks.storage.am.common.api.ISearchOperationCallback; -import org.apache.hyracks.storage.am.common.api.ISearchPredicate; import org.apache.hyracks.storage.am.common.api.ITreeIndexAccessor; import org.apache.hyracks.storage.am.common.api.ITreeIndexCursor; import org.apache.hyracks.storage.am.common.api.ITreeIndexFrame; @@ -48,7 +43,6 @@ import org.apache.hyracks.storage.am.common.impls.AbstractTreeIndex; import org.apache.hyracks.storage.am.common.impls.NodeFrontier; import org.apache.hyracks.storage.am.common.impls.TreeIndexDiskOrderScanCursor; import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation; -import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator; import org.apache.hyracks.storage.am.common.util.TreeIndexUtils; import org.apache.hyracks.storage.am.rtree.api.IRTreeFrame; import org.apache.hyracks.storage.am.rtree.api.IRTreeInteriorFrame; @@ -56,6 +50,12 @@ import org.apache.hyracks.storage.am.rtree.api.IRTreeLeafFrame; import org.apache.hyracks.storage.am.rtree.frames.RTreeNSMFrame; import org.apache.hyracks.storage.am.rtree.frames.RTreeNSMInteriorFrame; import org.apache.hyracks.storage.am.rtree.tuples.RTreeTypeAwareTupleWriter; +import org.apache.hyracks.storage.common.IIndexBulkLoader; +import org.apache.hyracks.storage.common.IIndexCursor; +import org.apache.hyracks.storage.common.IModificationOperationCallback; +import org.apache.hyracks.storage.common.ISearchOperationCallback; +import org.apache.hyracks.storage.common.ISearchPredicate; +import org.apache.hyracks.storage.common.MultiComparator; import org.apache.hyracks.storage.common.buffercache.BufferCache; import org.apache.hyracks.storage.common.buffercache.IBufferCache; import org.apache.hyracks.storage.common.buffercache.ICachedPage; @@ -1096,4 +1096,9 @@ public class RTree extends AbstractTreeIndex { public void validate() throws HyracksDataException { throw new UnsupportedOperationException("Validation not implemented for R-Trees."); } + + @Override + public int getNumOfFilterFields() { + return 0; + } } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeCursorInitialState.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeCursorInitialState.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeCursorInitialState.java index b740314..bf51c9e 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeCursorInitialState.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeCursorInitialState.java @@ -19,9 +19,9 @@ package org.apache.hyracks.storage.am.rtree.impls; -import org.apache.hyracks.storage.am.common.api.ICursorInitialState; -import org.apache.hyracks.storage.am.common.api.ISearchOperationCallback; -import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator; +import org.apache.hyracks.storage.common.ICursorInitialState; +import org.apache.hyracks.storage.common.ISearchOperationCallback; +import org.apache.hyracks.storage.common.MultiComparator; import org.apache.hyracks.storage.common.buffercache.ICachedPage; public class RTreeCursorInitialState implements ICursorInitialState { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeOpContext.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeOpContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeOpContext.java index d23e3b7..9ceae20 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeOpContext.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeOpContext.java @@ -26,14 +26,14 @@ import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; 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.am.common.api.IModificationOperationCallback; import org.apache.hyracks.storage.am.common.api.IPageManager; import org.apache.hyracks.storage.am.common.api.ITreeIndexCursor; import org.apache.hyracks.storage.am.common.api.ITreeIndexMetadataFrame; import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation; -import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator; import org.apache.hyracks.storage.am.rtree.api.IRTreeInteriorFrame; import org.apache.hyracks.storage.am.rtree.api.IRTreeLeafFrame; +import org.apache.hyracks.storage.common.IModificationOperationCallback; +import org.apache.hyracks.storage.common.MultiComparator; import org.apache.hyracks.storage.common.buffercache.ICachedPage; import org.apache.hyracks.storage.common.buffercache.IExtraPageBlockHelper; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeSearchCursor.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeSearchCursor.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeSearchCursor.java index 218d34d..bb3d2f5 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeSearchCursor.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/RTreeSearchCursor.java @@ -21,13 +21,13 @@ package org.apache.hyracks.storage.am.rtree.impls; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference; -import org.apache.hyracks.storage.am.common.api.ICursorInitialState; -import org.apache.hyracks.storage.am.common.api.ISearchPredicate; import org.apache.hyracks.storage.am.common.api.ITreeIndexCursor; import org.apache.hyracks.storage.am.common.api.ITreeIndexTupleReference; -import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator; import org.apache.hyracks.storage.am.rtree.api.IRTreeInteriorFrame; import org.apache.hyracks.storage.am.rtree.api.IRTreeLeafFrame; +import org.apache.hyracks.storage.common.ICursorInitialState; +import org.apache.hyracks.storage.common.ISearchPredicate; +import org.apache.hyracks.storage.common.MultiComparator; import org.apache.hyracks.storage.common.buffercache.IBufferCache; import org.apache.hyracks.storage.common.buffercache.ICachedPage; import org.apache.hyracks.storage.common.file.BufferedFileHandle; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/SearchPredicate.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/SearchPredicate.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/SearchPredicate.java index da03608..f45ae78 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/SearchPredicate.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/SearchPredicate.java @@ -21,7 +21,7 @@ package org.apache.hyracks.storage.am.rtree.impls; import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference; import org.apache.hyracks.storage.am.common.impls.AbstractSearchPredicate; -import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator; +import org.apache.hyracks.storage.common.MultiComparator; public class SearchPredicate extends AbstractSearchPredicate { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/UnorderedSlotManager.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/UnorderedSlotManager.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/UnorderedSlotManager.java index f85a9c5..22ca4b9 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/UnorderedSlotManager.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/UnorderedSlotManager.java @@ -25,8 +25,8 @@ import org.apache.hyracks.storage.am.common.api.ITreeIndexTupleReference; import org.apache.hyracks.storage.am.common.frames.AbstractSlotManager; import org.apache.hyracks.storage.am.common.ophelpers.FindTupleMode; import org.apache.hyracks.storage.am.common.ophelpers.FindTupleNoExactMatchPolicy; -import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator; import org.apache.hyracks.storage.am.rtree.frames.RTreeNSMFrame; +import org.apache.hyracks.storage.common.MultiComparator; public class UnorderedSlotManager extends AbstractSlotManager { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/util/RTreeUtils.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/util/RTreeUtils.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/util/RTreeUtils.java index ee1d89e..a8e668b 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/util/RTreeUtils.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/util/RTreeUtils.java @@ -29,12 +29,12 @@ import org.apache.hyracks.storage.am.common.api.IPageManagerFactory; import org.apache.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory; import org.apache.hyracks.storage.am.common.api.ITreeIndexFrameFactory; import org.apache.hyracks.storage.am.common.data.PointablePrimitiveValueProviderFactory; -import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator; import org.apache.hyracks.storage.am.rtree.frames.RTreeNSMInteriorFrameFactory; import org.apache.hyracks.storage.am.rtree.frames.RTreeNSMLeafFrameFactory; import org.apache.hyracks.storage.am.rtree.frames.RTreePolicyType; import org.apache.hyracks.storage.am.rtree.impls.RTree; import org.apache.hyracks.storage.am.rtree.tuples.RTreeTypeAwareTupleWriterFactory; +import org.apache.hyracks.storage.common.MultiComparator; import org.apache.hyracks.storage.common.buffercache.IBufferCache; import org.apache.hyracks.storage.common.file.IFileMapProvider; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-common/pom.xml ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/pom.xml b/hyracks-fullstack/hyracks/hyracks-storage-common/pom.xml index 38604e9..61e94b2 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-common/pom.xml +++ b/hyracks-fullstack/hyracks/hyracks-storage-common/pom.xml @@ -46,5 +46,10 @@ <artifactId>hyracks-api</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.hyracks</groupId> + <artifactId>hyracks-dataflow-common</artifactId> + <version>${project.version}</version> + </dependency> </dependencies> </project> http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/ICursorInitialState.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/ICursorInitialState.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/ICursorInitialState.java new file mode 100644 index 0000000..60a5cfa --- /dev/null +++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/ICursorInitialState.java @@ -0,0 +1,36 @@ +/* + * 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.common; + +import org.apache.hyracks.storage.common.buffercache.ICachedPage; + +public interface ICursorInitialState { + public ICachedPage getPage(); + + public void setPage(ICachedPage page); + + public ISearchOperationCallback getSearchOperationCallback(); + + public void setSearchOperationCallback(ISearchOperationCallback searchCallback); + + public MultiComparator getOriginalKeyComparator(); + + public void setOriginialKeyComparator(MultiComparator originalCmp); +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IIndex.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IIndex.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IIndex.java new file mode 100644 index 0000000..b23a345 --- /dev/null +++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IIndex.java @@ -0,0 +1,139 @@ +/* + * 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.common; + +import org.apache.hyracks.api.exceptions.HyracksDataException; +import org.apache.hyracks.storage.common.buffercache.IBufferCache; + +/** + * This interface describes the operations common to all indexes. Indexes + * implementing this interface can easily reuse existing index operators for + * dataflow. Users must perform operations on an via an {@link IIndexAccessor}. + * During dataflow, the lifecycle of IIndexes are handled through an {@link IResourceLifecycleManager}. + */ +public interface IIndex { + + /** + * Initializes the persistent state of an index. + * An index cannot be created if it is in the activated state. + * Calling create on an index that is deactivated has the effect of clearing the index. + * + * @throws HyracksDataException + * if there is an error in the BufferCache while (un)pinning pages, (un)latching pages, + * creating files, or deleting files + * if the index is in the activated state + */ + void create() throws HyracksDataException; + + /** + * Initializes the index's operational state. An index in the activated state may perform + * operations via an {@link IIndexAccessor}. + * + * @throws HyracksDataException + * if there is a problem in the BufferCache while (un)pinning pages, (un)latching pages, + * creating files, or deleting files + */ + void activate() throws HyracksDataException; + + /** + * Resets the operational state of the index. Calling clear has the same logical effect + * as calling deactivate(), destroy(), create(), then activate(), but not necessarily the + * same physical effect. + * + * @throws HyracksDataException + * if there is a problem in the BufferCache while (un)pinning pages, (un)latching pages, + * creating files, or deleting files + * if the index is not in the activated state + */ + void clear() throws HyracksDataException; + + /** + * Deinitializes the index's operational state. An index in the deactivated state may not + * perform operations. + * + * @throws HyracksDataException + * if there is a problem in the BufferCache while (un)pinning pages, (un)latching pages, + * creating files, or deleting files + */ + void deactivate() throws HyracksDataException; + + /** + * Removes the persistent state of an index. + * An index cannot be destroyed if it is in the activated state. + * + * @throws HyracksDataException + * if there is an error in the BufferCache while (un)pinning pages, (un)latching pages, + * creating files, or deleting files + * if the index is already activated + */ + void destroy() throws HyracksDataException; + + /** + * Creates an {@link IIndexAccessor} for performing operations on this index. + * An IIndexAccessor is not thread safe, but different IIndexAccessors can concurrently operate + * on the same {@link IIndex}. + * + * @returns IIndexAccessor an accessor for this {@link IIndex} + * @param modificationCallback + * the callback to be used for modification operations + * @param searchCallback + * the callback to be used for search operations + * @throws HyracksDataException + */ + IIndexAccessor createAccessor(IModificationOperationCallback modificationCallback, + ISearchOperationCallback searchCallback) throws HyracksDataException; + + /** + * Ensures that all pages (and tuples) of the index are logically consistent. + * An assertion error is thrown if validation fails. + * + * @throws HyracksDataException + * if there is an error performing validation + */ + public void validate() throws HyracksDataException; + + /** + * @return the {@link IBufferCache} underlying this index. + */ + public IBufferCache getBufferCache(); + + /** + * @return the size, in bytes, of pre-allocated memory space that this index was allotted. + */ + public long getMemoryAllocationSize(); + + /** + * @param fillFactor + * @param verifyInput + * @throws IndexException + */ + public IIndexBulkLoader createBulkLoader(float fillFactor, boolean verifyInput, long numElementsHint, + boolean checkIfEmptyIndex) throws HyracksDataException; + + /** + * @return true if the index needs memory components + */ + public boolean hasMemoryComponents(); + + /** + * @return the number of filter fields + */ + int getNumOfFilterFields(); +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IIndexAccessor.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IIndexAccessor.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IIndexAccessor.java new file mode 100644 index 0000000..27ca8c8 --- /dev/null +++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IIndexAccessor.java @@ -0,0 +1,105 @@ +/* + * 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.common; + +import org.apache.hyracks.api.exceptions.HyracksDataException; +import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference; + +/** + * Client handle for performing operations (insert/delete/update/search) on an + * IIndex. An IIndexAccessor is not thread safe, but different IIndexAccessors + * can concurrently operate on the same IIndex (i.e., the IIndex must allow + * concurrent operations). + */ +public interface IIndexAccessor { + /** + * Inserts the given tuple. + * + * @param tuple + * Tuple to be inserted. + * @throws HyracksDataException + * If the BufferCache throws while un/pinning or un/latching. + * @throws IndexException + * If an index-specific constraint is violated, e.g., the key + * already exists. + */ + public void insert(ITupleReference tuple) throws HyracksDataException; + + /** + * Updates the tuple in the index matching the given tuple with the new + * contents in the given tuple. + * + * @param tuple + * Tuple whose match in the index is to be update with the given + * tuples contents. + * @throws HyracksDataException + * If the BufferCache throws while un/pinning or un/latching. + * @throws IndexException + * If there is no matching tuple in the index. + */ + public void update(ITupleReference tuple) throws HyracksDataException; + + /** + * Deletes the tuple in the index matching the given tuple. + * + * @param tuple + * Tuple to be deleted. + * @throws HyracksDataException + * If the BufferCache throws while un/pinning or un/latching. + * @throws IndexException + * If there is no matching tuple in the index. + */ + public void delete(ITupleReference tuple) throws HyracksDataException; + + /** + * This operation is only supported by indexes with the notion of a unique key. + * If tuple's key already exists, then this operation performs an update. + * Otherwise, it performs an insert. + * + * @param tuple + * Tuple to be deleted. + * @throws HyracksDataException + * If the BufferCache throws while un/pinning or un/latching. + * @throws IndexException + * If there is no matching tuple in the index. + * + */ + public void upsert(ITupleReference tuple) throws HyracksDataException; + + /** + * Creates a cursor appropriate for passing into search(). + * + */ + public IIndexCursor createSearchCursor(boolean exclusive); + + /** + * Open the given cursor for an index search using the given predicate as + * search condition. + * + * @param icursor + * Cursor over the index entries satisfying searchPred. + * @param searchPred + * Search condition. + * @throws HyracksDataException + * If the BufferCache throws while un/pinning or un/latching. + * @throws IndexException + */ + public void search(IIndexCursor cursor, ISearchPredicate searchPred) throws HyracksDataException; +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IIndexBulkLoader.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IIndexBulkLoader.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IIndexBulkLoader.java new file mode 100644 index 0000000..5c4d3c0 --- /dev/null +++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IIndexBulkLoader.java @@ -0,0 +1,51 @@ +/* + * 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.common; + +import org.apache.hyracks.api.exceptions.HyracksDataException; +import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference; + +public interface IIndexBulkLoader { + /** + * Append a tuple to the index in the context of a bulk load. + * + * @param tuple + * Tuple to be inserted. + * @throws IndexException + * If the input stream is invalid for bulk loading (e.g., is not sorted). + * @throws HyracksDataException + * If the BufferCache throws while un/pinning or un/latching. + */ + public void add(ITupleReference tuple) throws HyracksDataException; + + /** + * Finalize the bulk loading operation in the given context. + * + * @throws IndexException + * @throws HyracksDataException + * If the BufferCache throws while un/pinning or un/latching. + */ + public void end() throws HyracksDataException; + + /** + * Release all resources held by this bulkloader, with no guarantee of + * persisted content. + */ + void abort() throws HyracksDataException; +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IIndexCursor.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IIndexCursor.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IIndexCursor.java new file mode 100644 index 0000000..cd16210 --- /dev/null +++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IIndexCursor.java @@ -0,0 +1,81 @@ +/* + * 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.common; + +import org.apache.hyracks.api.exceptions.HyracksDataException; +import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference; + +public interface IIndexCursor { + /** + * Opens the cursor + * if open succeeds, close must be called. + * + * @param initialState + * @param searchPred + * @throws HyracksDataException + */ + void open(ICursorInitialState initialState, ISearchPredicate searchPred) throws HyracksDataException; + + /** + * True if the cursor has a next value + * + * @return + * @throws HyracksDataException + */ + boolean hasNext() throws HyracksDataException; + + /** + * Moves the cursor to the next value + * + * @throws HyracksDataException + */ + void next() throws HyracksDataException; + + /** + * Closes the cursor + * + * @throws HyracksDataException + */ + void close() throws HyracksDataException; + + /** + * Reset the cursor to be reused + * + * @throws HyracksDataException + * @throws IndexException + */ + void reset() throws HyracksDataException; + + /** + * @return the tuple pointed to by the cursor + */ + ITupleReference getTuple(); + + /** + * @return the min tuple of the current index's filter + */ + ITupleReference getFilterMinTuple(); + + /** + * + * @return the max tuple of the current index's filter + */ + ITupleReference getFilterMaxTuple(); +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/ILocalResourceRepository.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/ILocalResourceRepository.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/ILocalResourceRepository.java new file mode 100644 index 0000000..491d476 --- /dev/null +++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/ILocalResourceRepository.java @@ -0,0 +1,32 @@ +/* + * 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.common; + +import org.apache.hyracks.api.exceptions.HyracksDataException; + +public interface ILocalResourceRepository { + + LocalResource get(String name) throws HyracksDataException; + + void insert(LocalResource resource) throws HyracksDataException; + + void delete(String name) throws HyracksDataException; + + long maxId() throws HyracksDataException; +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IModificationOperationCallback.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IModificationOperationCallback.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IModificationOperationCallback.java new file mode 100644 index 0000000..fac2cf6 --- /dev/null +++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IModificationOperationCallback.java @@ -0,0 +1,52 @@ +/* + * 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.common; + +import org.apache.hyracks.api.exceptions.HyracksDataException; +import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference; + +/** + * This operation callback allows for arbitrary actions to be taken while traversing + * an index structure. The {@link IModificationOperationCallback} will be called on + * all modifying operations (e.g. insert, update, delete...) for all indexes. + */ +public interface IModificationOperationCallback { + + /** + * This method is called on a tuple that is about to traverse an index's structure + * (i.e. before any pages are pinned or latched). + * The format of the tuple is the format that would be stored in the index itself. + * + * @param tuple + * the tuple that is about to be operated on + */ + public void before(ITupleReference tuple) throws HyracksDataException; + + /** + * This method is called on a tuple when a tuple with a matching key is found for the + * current operation. It is possible that tuple is null, in which case no tuple with a + * matching key was found. + * When found is called, the leaf page where the tuple resides will be pinned and latched, + * so blocking operations should be avoided. + * + * @param tuple + * a tuple with a matching key, otherwise null if none exists + */ + public void found(ITupleReference before, ITupleReference after) throws HyracksDataException; +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IResource.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IResource.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IResource.java new file mode 100644 index 0000000..bb27023 --- /dev/null +++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IResource.java @@ -0,0 +1,31 @@ +/* + * 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.common; + +import java.io.Serializable; + +import org.apache.hyracks.api.application.INCServiceContext; +import org.apache.hyracks.api.exceptions.HyracksDataException; + +public interface IResource extends Serializable { + + IIndex createInstance(INCServiceContext ncServiceCtx) throws HyracksDataException; + + String getPath(); +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IResourceFactory.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IResourceFactory.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IResourceFactory.java new file mode 100644 index 0000000..e25201f --- /dev/null +++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IResourceFactory.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.common; + +import java.io.Serializable; + +import org.apache.hyracks.api.io.FileReference; + +@FunctionalInterface +public interface IResourceFactory extends Serializable { + /** + * Create a serializable resource for the task partition + * + * @param fileRef + * the file reference for the resource + */ + IResource createResource(FileReference fileRef); +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IResourceLifecycleManager.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IResourceLifecycleManager.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IResourceLifecycleManager.java new file mode 100644 index 0000000..b653842 --- /dev/null +++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IResourceLifecycleManager.java @@ -0,0 +1,82 @@ +/* + * 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.common; + +import java.util.List; + +import org.apache.hyracks.api.exceptions.HyracksDataException; + +/** + * The base interface for resource management + * + * @param <R> + * resource class + */ +public interface IResourceLifecycleManager<R> extends IResourceMemoryManager { + /** + * get a list of all resources which are opened + * + * @return + */ + public List<R> getOpenResources(); + + /** + * Registers a resource. + * + * @param resourceId + * @param resource + * @throws HyracksDataException + * if a resource is already registered with this resourceId + */ + public void register(String resourceId, R resource) throws HyracksDataException; + + /** + * Opens a resource. The resource is moved to the open state + * + * @param resourceId + * @throws HyracksDataException + * if no resource with the resourceId exists + */ + public void open(String resourceId) throws HyracksDataException; + + /** + * closes a resource and free up its allocated resources + * + * @param resourceId + * @throws HyracksDataException + */ + public void close(String resourceId) throws HyracksDataException; + + /** + * gets the resource registered with this id + * + * @param resourceId + * @return the resource if registered or null + * @throws HyracksDataException + */ + public R get(String resourceId) throws HyracksDataException; + + /** + * unregister a resource removing its resources in memory and on disk + * + * @param resourceId + * @throws HyracksDataException + */ + public void unregister(String resourceId) throws HyracksDataException; +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/ISearchOperationCallback.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/ISearchOperationCallback.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/ISearchOperationCallback.java new file mode 100644 index 0000000..af17470 --- /dev/null +++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/ISearchOperationCallback.java @@ -0,0 +1,79 @@ +/* + * 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.common; + +import org.apache.hyracks.api.exceptions.HyracksDataException; +import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference; + +/** + * This operation callback allows for arbitrary actions to be taken while traversing + * an index structure. The {@link ISearchOperationCallback} will be called on + * all search operations for ordered indexes only. + * @author zheilbron + */ +public interface ISearchOperationCallback { + + /** + * After the harness enters the operation components and before an index search operation starts, + * this method will be called on the search key. + * @param tuple + * the tuple containing the search key (expected to be a point search key) + */ + public void before(ITupleReference tuple) throws HyracksDataException; + + /** + * During an index search operation, this method will be called on tuples as they are + * passed by with a search cursor. This call will be invoked while a leaf page is latched + * and pinned. If the call returns false, then the page will be unlatched and unpinned and + * {@link #reconcile(ITupleReference)} will be called with the tuple that was not proceeded + * on. + * @param tuple + * the tuple that is being passed over by the search cursor + * @return true to proceed otherwise false to unlatch and unpin, leading to reconciliation + */ + public boolean proceed(ITupleReference tuple) throws HyracksDataException; + + /** + * This method is only called on a tuple that was not 'proceeded' on + * (see {@link #proceed(ITupleReference)}). This method allows an opportunity to reconcile + * by performing any necessary actions before resuming the search (e.g. a try-lock may have + * failed in the proceed call, and now in reconcile we should take a full (blocking) lock). + * @param tuple + * the tuple that failed to proceed + */ + public void reconcile(ITupleReference tuple) throws HyracksDataException; + + /** + * This method is only called on a tuple that was reconciled on, but not found after + * retraversing. This method allows an opportunity to cancel some action that was taken in + * {@link #reconcile(ITupleReference))}. + * @param tuple + * the tuple that was previously reconciled + */ + public void cancel(ITupleReference tuple) throws HyracksDataException; + + /** + * This method is only called on a tuple that was reconciled on, and found after + * retraversing. This method allows an opportunity to do some subsequent action that was + * taken in {@link #reconcile(ITupleReference))}. + * @param tuple + * the tuple that was previously reconciled + */ + public void complete(ITupleReference tuple) throws HyracksDataException; +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/ISearchPredicate.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/ISearchPredicate.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/ISearchPredicate.java new file mode 100644 index 0000000..aac7aad --- /dev/null +++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/ISearchPredicate.java @@ -0,0 +1,40 @@ +/* + * 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.common; + +import java.io.Serializable; + +import org.apache.hyracks.api.exceptions.HyracksDataException; +import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference; + +public interface ISearchPredicate extends Serializable { + public MultiComparator getLowKeyComparator(); + + public MultiComparator getHighKeyComparator(); + + /** + * Get the search key to be used with point search operation on primary index. + * This method will only be called with point search predicates that only happen in primary index. + * + * @return + * @throws HyracksDataException + */ + public ITupleReference getLowKey(); +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IStorageManager.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IStorageManager.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IStorageManager.java index 24cf557..68f4cbb 100644 --- a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IStorageManager.java +++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IStorageManager.java @@ -20,10 +20,9 @@ package org.apache.hyracks.storage.common; import java.io.Serializable; -import org.apache.hyracks.api.context.IHyracksTaskContext; +import org.apache.hyracks.api.application.INCServiceContext; import org.apache.hyracks.storage.common.buffercache.IBufferCache; import org.apache.hyracks.storage.common.file.IFileMapProvider; -import org.apache.hyracks.storage.common.file.ILocalResourceRepository; import org.apache.hyracks.storage.common.file.IResourceIdFactory; /** @@ -32,29 +31,36 @@ import org.apache.hyracks.storage.common.file.IResourceIdFactory; public interface IStorageManager extends Serializable { /** * @param ctx - * hyracks task context + * the nc service context * @return the disk buffer cache {@link org.apache.hyracks.storage.common.buffercache.IBufferCache} */ - IBufferCache getBufferCache(IHyracksTaskContext ctx); + IBufferCache getBufferCache(INCServiceContext ctx); /** * @param ctx - * the task context + * the nc service context * @return the file map provider {@link org.apache.hyracks.storage.common.file.IFileMapProvider} */ - IFileMapProvider getFileMapProvider(IHyracksTaskContext ctx); + IFileMapProvider getFileMapProvider(INCServiceContext ctx); /** * @param ctx - * the task context - * @return the local resource repository {@link org.apache.hyracks.storage.common.file.ILocalResourceRepository} + * the nc service context + * @return the local resource repository {@link org.apache.hyracks.storage.am.common.build.ILocalResourceRepository} */ - ILocalResourceRepository getLocalResourceRepository(IHyracksTaskContext ctx); + ILocalResourceRepository getLocalResourceRepository(INCServiceContext ctx); /** * @param ctx - * the task context + * the nc service context * @return the resource id factory {@link org.apache.hyracks.storage.common.file.IResourceIdFactory} */ - IResourceIdFactory getResourceIdFactory(IHyracksTaskContext ctx); + IResourceIdFactory getResourceIdFactory(INCServiceContext ctx); + + /** + * @param ctx + * the nc service context + * @return the resource lifecycle manager + */ + IResourceLifecycleManager<IIndex> getLifecycleManager(INCServiceContext ctx); }