http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorDescriptor.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorDescriptor.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorDescriptor.java
index ddb5df7..fad344d 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorDescriptor.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorDescriptor.java
@@ -21,50 +21,41 @@ package org.apache.hyracks.storage.am.common.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.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.storage.am.common.impls.NoOpOperationCallbackFactory;
-import org.apache.hyracks.storage.common.IStorageManager;
-import org.apache.hyracks.storage.common.file.NoOpLocalResourceFactoryProvider;
+import 
org.apache.hyracks.dataflow.std.base.AbstractSingleActivityOperatorDescriptor;
 
-public class TreeIndexBulkLoadOperatorDescriptor extends 
AbstractTreeIndexOperatorDescriptor {
+public class TreeIndexBulkLoadOperatorDescriptor extends 
AbstractSingleActivityOperatorDescriptor {
 
     private static final long serialVersionUID = 1L;
 
-    private final int[] fieldPermutation;
-    private final float fillFactor;
-    private final boolean verifyInput;
-    private final long numElementsHint;
-    private final boolean checkIfEmptyIndex;
+    protected final int[] fieldPermutation;
+    protected final float fillFactor;
+    protected final boolean verifyInput;
+    protected final long numElementsHint;
+    protected final boolean checkIfEmptyIndex;
+    protected final IIndexDataflowHelperFactory indexHelperFactory;
 
-    public TreeIndexBulkLoadOperatorDescriptor(IOperatorDescriptorRegistry 
spec, RecordDescriptor recDesc,
-            IStorageManager storageManager, IIndexLifecycleManagerProvider 
lifecycleManagerProvider,
-            IFileSplitProvider fileSplitProvider, ITypeTraits[] typeTraits,
-            IBinaryComparatorFactory[] comparatorFactories, int[] 
bloomFilterKeyFields, int[] fieldPermutation,
-            float fillFactor, boolean verifyInput, long numElementsHint, 
boolean checkIfEmptyIndex,
-            IIndexDataflowHelperFactory dataflowHelperFactory, 
IPageManagerFactory pageManagerFactory) {
-        super(spec, 1, 1, recDesc, storageManager, lifecycleManagerProvider, 
fileSplitProvider, typeTraits,
-                comparatorFactories, bloomFilterKeyFields, 
dataflowHelperFactory, null, false, false, null,
-                NoOpLocalResourceFactoryProvider.INSTANCE, 
NoOpOperationCallbackFactory.INSTANCE,
-                NoOpOperationCallbackFactory.INSTANCE, pageManagerFactory);
+    public TreeIndexBulkLoadOperatorDescriptor(IOperatorDescriptorRegistry 
spec, RecordDescriptor outRecDesc,
+            int[] fieldPermutation, float fillFactor, boolean verifyInput, 
long numElementsHint,
+            boolean checkIfEmptyIndex, IIndexDataflowHelperFactory 
indexHelperFactory) {
+        super(spec, 1, 1);
+        this.indexHelperFactory = indexHelperFactory;
         this.fieldPermutation = fieldPermutation;
         this.fillFactor = fillFactor;
         this.verifyInput = verifyInput;
         this.numElementsHint = numElementsHint;
         this.checkIfEmptyIndex = checkIfEmptyIndex;
+        this.outRecDescs[0] = outRecDesc;
     }
 
     @Override
     public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx,
             IRecordDescriptorProvider recordDescProvider, int partition, int 
nPartitions) throws HyracksDataException {
-        return new IndexBulkLoadOperatorNodePushable(this, ctx, partition, 
fieldPermutation, fillFactor, verifyInput,
-                numElementsHint, checkIfEmptyIndex, recordDescProvider);
+        return new IndexBulkLoadOperatorNodePushable(indexHelperFactory, ctx, 
partition, fieldPermutation, fillFactor,
+                verifyInput, numElementsHint, checkIfEmptyIndex,
+                
recordDescProvider.getInputRecordDescriptor(this.getActivityId(), 0));
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexCreateOperatorDescriptor.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexCreateOperatorDescriptor.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexCreateOperatorDescriptor.java
deleted file mode 100644
index 5448b7b..0000000
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexCreateOperatorDescriptor.java
+++ /dev/null
@@ -1,59 +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.common.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.IRecordDescriptorProvider;
-import org.apache.hyracks.api.dataflow.value.ITypeTraits;
-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.IModificationOperationCallbackFactory;
-import org.apache.hyracks.storage.am.common.api.IPageManagerFactory;
-import org.apache.hyracks.storage.am.common.impls.NoOpOperationCallbackFactory;
-import org.apache.hyracks.storage.common.IStorageManager;
-import org.apache.hyracks.storage.common.file.ILocalResourceFactoryProvider;
-
-public class TreeIndexCreateOperatorDescriptor extends 
AbstractTreeIndexOperatorDescriptor {
-
-    private static final long serialVersionUID = 1L;
-
-    public TreeIndexCreateOperatorDescriptor(IOperatorDescriptorRegistry spec, 
IStorageManager storageManager,
-            IIndexLifecycleManagerProvider lifecycleManagerProvider, 
IFileSplitProvider fileSplitProvider,
-            ITypeTraits[] typeTraits, IBinaryComparatorFactory[] 
comparatorFactories, int[] bloomFilterKeyFields,
-            IIndexDataflowHelperFactory dataflowHelperFactory,
-            ILocalResourceFactoryProvider localResourceFactoryProvider,
-            IModificationOperationCallbackFactory 
modificationOpCallbackFactory,
-            IPageManagerFactory pageManagerFactory) {
-        super(spec, 0, 0, null, storageManager, lifecycleManagerProvider, 
fileSplitProvider, typeTraits,
-                comparatorFactories, bloomFilterKeyFields, 
dataflowHelperFactory, null, false, false, null,
-                localResourceFactoryProvider, 
NoOpOperationCallbackFactory.INSTANCE, modificationOpCallbackFactory,
-                pageManagerFactory);
-    }
-
-    @Override
-    public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx,
-            IRecordDescriptorProvider recordDescProvider, int partition, int 
nPartitions) throws HyracksDataException {
-        return new IndexCreateOperatorNodePushable(this, ctx, partition);
-    }
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexDataflowHelper.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexDataflowHelper.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexDataflowHelper.java
deleted file mode 100644
index b7a6df9..0000000
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexDataflowHelper.java
+++ /dev/null
@@ -1,42 +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.common.dataflow;
-
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.storage.am.common.api.ITreeIndexCursor;
-import org.apache.hyracks.storage.am.common.api.ITreeIndexFrame;
-import org.apache.hyracks.storage.am.common.impls.TreeIndexDiskOrderScanCursor;
-
-public abstract class TreeIndexDataflowHelper extends IndexDataflowHelper {
-    @Override
-    public int getNumFilterFields() {
-        return 0;
-    }
-
-    public TreeIndexDataflowHelper(IIndexOperatorDescriptor opDesc, 
IHyracksTaskContext ctx, int partition,
-            boolean durable) throws HyracksDataException {
-        super(opDesc, ctx, partition, durable);
-    }
-
-    public ITreeIndexCursor createDiskOrderScanCursor(ITreeIndexFrame 
leafFrame) throws HyracksDataException {
-        return new TreeIndexDiskOrderScanCursor(leafFrame);
-    }
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorDescriptor.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorDescriptor.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorDescriptor.java
index 378c49b..099d668 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorDescriptor.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorDescriptor.java
@@ -22,36 +22,30 @@ package org.apache.hyracks.storage.am.common.dataflow;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.IOperatorNodePushable;
 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.impls.NoOpOperationCallbackFactory;
-import org.apache.hyracks.storage.common.IStorageManager;
-import org.apache.hyracks.storage.common.file.NoOpLocalResourceFactoryProvider;
 
-public class TreeIndexDiskOrderScanOperatorDescriptor extends 
AbstractTreeIndexOperatorDescriptor {
+public class TreeIndexDiskOrderScanOperatorDescriptor extends 
AbstractSingleActivityOperatorDescriptor {
 
     private static final long serialVersionUID = 1L;
+    private final IIndexDataflowHelperFactory indexHelperFactory;
+    private final ISearchOperationCallbackFactory searchCallbackFactory;
 
-    public 
TreeIndexDiskOrderScanOperatorDescriptor(IOperatorDescriptorRegistry spec, 
RecordDescriptor recDesc,
-            IStorageManager storageManager, IIndexLifecycleManagerProvider 
lifecycleManagerProvider,
-            IFileSplitProvider fileSplitProvider, ITypeTraits[] typeTraits,
-            IIndexDataflowHelperFactory dataflowHelperFactory,
-            ISearchOperationCallbackFactory searchOpCallbackProvider, 
IPageManagerFactory pageManagerFactory) {
-        super(spec, 0, 1, recDesc, storageManager, lifecycleManagerProvider, 
fileSplitProvider, typeTraits, null, null,
-                dataflowHelperFactory, null, false, false, null,
-                NoOpLocalResourceFactoryProvider.INSTANCE, 
searchOpCallbackProvider,
-                NoOpOperationCallbackFactory.INSTANCE, pageManagerFactory);
+    public 
TreeIndexDiskOrderScanOperatorDescriptor(IOperatorDescriptorRegistry spec, 
RecordDescriptor outRecDesc,
+            IIndexDataflowHelperFactory indexHelperFactory, 
ISearchOperationCallbackFactory searchCallbackFactory) {
+        super(spec, 0, 1);
+        this.indexHelperFactory = indexHelperFactory;
+        this.searchCallbackFactory = searchCallbackFactory;
+        this.outRecDescs[0] = outRecDesc;
     }
 
     @Override
     public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx,
             IRecordDescriptorProvider recordDescProvider, int partition, int 
nPartitions) throws HyracksDataException {
-        return new TreeIndexDiskOrderScanOperatorNodePushable(this, ctx, 
partition);
+        return new TreeIndexDiskOrderScanOperatorNodePushable(ctx, partition, 
indexHelperFactory,
+                searchCallbackFactory);
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorNodePushable.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorNodePushable.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorNodePushable.java
index fc47548..6075c3d 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorNodePushable.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorNodePushable.java
@@ -28,40 +28,42 @@ import 
org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender;
 import org.apache.hyracks.dataflow.common.comm.util.FrameUtils;
 import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
 import 
org.apache.hyracks.dataflow.std.base.AbstractUnaryOutputSourceOperatorNodePushable;
-import org.apache.hyracks.storage.am.common.api.ISearchOperationCallback;
+import org.apache.hyracks.storage.am.common.api.IIndexDataflowHelper;
+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.api.ITreeIndexAccessor;
 import org.apache.hyracks.storage.am.common.api.ITreeIndexCursor;
 import org.apache.hyracks.storage.am.common.api.ITreeIndexFrame;
 import org.apache.hyracks.storage.am.common.impls.NoOpOperationCallback;
-import org.apache.hyracks.storage.common.file.LocalResource;
+import org.apache.hyracks.storage.am.common.impls.TreeIndexDiskOrderScanCursor;
+import org.apache.hyracks.storage.common.ISearchOperationCallback;
+import org.apache.hyracks.storage.common.LocalResource;
 
 public class TreeIndexDiskOrderScanOperatorNodePushable extends 
AbstractUnaryOutputSourceOperatorNodePushable {
-    private final AbstractTreeIndexOperatorDescriptor opDesc;
     private final IHyracksTaskContext ctx;
-    private final TreeIndexDataflowHelper treeIndexHelper;
-    private ITreeIndex treeIndex;
+    private final IIndexDataflowHelper treeIndexHelper;
+    private final ISearchOperationCallbackFactory searchCallbackFactory;
 
-    public 
TreeIndexDiskOrderScanOperatorNodePushable(AbstractTreeIndexOperatorDescriptor 
opDesc,
-            IHyracksTaskContext ctx, int partition) throws 
HyracksDataException {
-        this.opDesc = opDesc;
+    public TreeIndexDiskOrderScanOperatorNodePushable(IHyracksTaskContext ctx, 
int partition,
+            IIndexDataflowHelperFactory indexHelperFactory, 
ISearchOperationCallbackFactory searchCallbackFactory)
+            throws HyracksDataException {
         this.ctx = ctx;
-        this.treeIndexHelper = (TreeIndexDataflowHelper) 
opDesc.getIndexDataflowHelperFactory()
-                .createIndexDataflowHelper(opDesc, ctx, partition);
+        this.treeIndexHelper = indexHelperFactory.create(ctx, partition);
+        this.searchCallbackFactory = searchCallbackFactory;
     }
 
     @Override
     public void initialize() throws HyracksDataException {
         treeIndexHelper.open();
-        treeIndex = (ITreeIndex) treeIndexHelper.getIndexInstance();
+        ITreeIndex treeIndex = (ITreeIndex) treeIndexHelper.getIndexInstance();
         try {
             ITreeIndexFrame cursorFrame = 
treeIndex.getLeafFrameFactory().createFrame();
-            ITreeIndexCursor cursor = 
treeIndexHelper.createDiskOrderScanCursor(cursorFrame);
+            ITreeIndexCursor cursor = new 
TreeIndexDiskOrderScanCursor(cursorFrame);
             LocalResource resource = treeIndexHelper.getResource();
-            ISearchOperationCallback searchCallback = 
opDesc.getSearchOpCallbackFactory()
-                    .createSearchOperationCallback(resource.getId(), ctx, 
null);
-            ITreeIndexAccessor indexAccessor = (ITreeIndexAccessor) treeIndex
-                    .createAccessor(NoOpOperationCallback.INSTANCE, 
searchCallback);
+            ISearchOperationCallback searchCallback =
+                    
searchCallbackFactory.createSearchOperationCallback(resource.getId(), ctx, 
null);
+            ITreeIndexAccessor indexAccessor =
+                    (ITreeIndexAccessor) 
treeIndex.createAccessor(NoOpOperationCallback.INSTANCE, searchCallback);
             try {
                 writer.open();
                 indexAccessor.diskOrderScan(cursor);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorDescriptor.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorDescriptor.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorDescriptor.java
index c9a5be7..f5cab5c 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorDescriptor.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorDescriptor.java
@@ -21,49 +21,42 @@ package org.apache.hyracks.storage.am.common.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.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.dataflow.std.base.AbstractSingleActivityOperatorDescriptor;
 import 
org.apache.hyracks.storage.am.common.api.IModificationOperationCallbackFactory;
-import org.apache.hyracks.storage.am.common.api.IPageManagerFactory;
 import org.apache.hyracks.storage.am.common.api.ITupleFilterFactory;
-import org.apache.hyracks.storage.am.common.impls.NoOpOperationCallbackFactory;
 import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation;
-import org.apache.hyracks.storage.common.IStorageManager;
-import org.apache.hyracks.storage.common.file.NoOpLocalResourceFactoryProvider;
 
-public class TreeIndexInsertUpdateDeleteOperatorDescriptor extends 
AbstractTreeIndexOperatorDescriptor {
+public class TreeIndexInsertUpdateDeleteOperatorDescriptor extends 
AbstractSingleActivityOperatorDescriptor {
 
     private static final long serialVersionUID = 1L;
-
-    private final int[] fieldPermutation;
+    private final IIndexDataflowHelperFactory indexHelperFactory;
     private final IndexOperation op;
+    private final int[] fieldPermutation;
+    private final IModificationOperationCallbackFactory 
modificationOpCallbackFactory;
+    private final ITupleFilterFactory tupleFilterFactory;
 
-    public 
TreeIndexInsertUpdateDeleteOperatorDescriptor(IOperatorDescriptorRegistry spec, 
RecordDescriptor recDesc,
-            IStorageManager storageManager, IIndexLifecycleManagerProvider 
lifecycleManagerProvider,
-            IFileSplitProvider fileSplitProvider, ITypeTraits[] typeTraits,
-            IBinaryComparatorFactory[] comparatorFactories, int[] 
bloomFilterKeyFields, int[] fieldPermutation,
-            IndexOperation op, IIndexDataflowHelperFactory 
dataflowHelperFactory,
+    public 
TreeIndexInsertUpdateDeleteOperatorDescriptor(IOperatorDescriptorRegistry spec, 
RecordDescriptor outRecDesc,
+            int[] fieldPermutation, IndexOperation op, 
IIndexDataflowHelperFactory indexHelperFactory,
             ITupleFilterFactory tupleFilterFactory,
-            IModificationOperationCallbackFactory 
modificationOpCallbackProvider,
-            IPageManagerFactory pageManagerFactory) {
-        super(spec, 1, 1, recDesc, storageManager, lifecycleManagerProvider, 
fileSplitProvider, typeTraits,
-                comparatorFactories, bloomFilterKeyFields, 
dataflowHelperFactory, tupleFilterFactory, false,
-                false, null, NoOpLocalResourceFactoryProvider.INSTANCE, 
NoOpOperationCallbackFactory.INSTANCE,
-                modificationOpCallbackProvider, pageManagerFactory);
+            IModificationOperationCallbackFactory 
modificationOpCallbackFactory) {
+        super(spec, 1, 1);
+        this.indexHelperFactory = indexHelperFactory;
         this.fieldPermutation = fieldPermutation;
         this.op = op;
+        this.modificationOpCallbackFactory = modificationOpCallbackFactory;
+        this.tupleFilterFactory = tupleFilterFactory;
+        this.outRecDescs[0] = outRecDesc;
     }
 
     @Override
     public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx,
             IRecordDescriptorProvider recordDescProvider, int partition, int 
nPartitions) throws HyracksDataException {
-        return new IndexInsertUpdateDeleteOperatorNodePushable(this, ctx, 
partition, fieldPermutation,
-                recordDescProvider, op);
+        return new IndexInsertUpdateDeleteOperatorNodePushable(ctx, partition, 
indexHelperFactory, fieldPermutation,
+                recordDescProvider.getInputRecordDescriptor(getActivityId(), 
0), op, modificationOpCallbackFactory,
+                tupleFilterFactory);
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorDescriptor.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorDescriptor.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorDescriptor.java
index c145ea9..6ed1858 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorDescriptor.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorDescriptor.java
@@ -20,43 +20,34 @@ package org.apache.hyracks.storage.am.common.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.IRecordDescriptorProvider;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-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.common.data.marshalling.UTF8StringSerializerDeserializer;
-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.storage.am.common.api.ISearchOperationCallbackFactory;
-import org.apache.hyracks.storage.am.common.impls.NoOpOperationCallbackFactory;
+import 
org.apache.hyracks.dataflow.std.base.AbstractSingleActivityOperatorDescriptor;
 import org.apache.hyracks.storage.common.IStorageManager;
-import org.apache.hyracks.storage.common.file.NoOpLocalResourceFactoryProvider;
 
-public class TreeIndexStatsOperatorDescriptor extends 
AbstractTreeIndexOperatorDescriptor {
+public class TreeIndexStatsOperatorDescriptor extends 
AbstractSingleActivityOperatorDescriptor {
 
     private static final long serialVersionUID = 1L;
-    private static final RecordDescriptor recDesc = new RecordDescriptor(
-            new ISerializerDeserializer[] { new 
UTF8StringSerializerDeserializer() });
+    private static final RecordDescriptor recDesc =
+            new RecordDescriptor(new ISerializerDeserializer[] { new 
UTF8StringSerializerDeserializer() });
+    private final IIndexDataflowHelperFactory indexHelperFactory;
+    private final IStorageManager storageManager;
 
     public TreeIndexStatsOperatorDescriptor(IOperatorDescriptorRegistry spec, 
IStorageManager storageManager,
-            IIndexLifecycleManagerProvider lifecycleManagerProvider, 
IFileSplitProvider fileSplitProvider,
-            ITypeTraits[] typeTraits, IBinaryComparatorFactory[] 
comparatorFactories, int[] bloomFilterKeyFields,
-            IIndexDataflowHelperFactory dataflowHelperFactory,
-            ISearchOperationCallbackFactory searchOpCallbackProvider,
-            IPageManagerFactory pageManagerFactory) {
-        super(spec, 0, 1, recDesc, storageManager, lifecycleManagerProvider, 
fileSplitProvider, typeTraits,
-                comparatorFactories, bloomFilterKeyFields, 
dataflowHelperFactory, null, false, false, null,
-                NoOpLocalResourceFactoryProvider.INSTANCE, 
searchOpCallbackProvider,
-                NoOpOperationCallbackFactory.INSTANCE, pageManagerFactory);
+            IIndexDataflowHelperFactory indexHelperFactory) {
+        super(spec, 0, 1);
+        this.indexHelperFactory = indexHelperFactory;
+        this.storageManager = storageManager;
+        this.outRecDescs[0] = recDesc;
     }
 
     @Override
     public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx,
             IRecordDescriptorProvider recordDescProvider, int partition, int 
nPartitions) throws HyracksDataException {
-        return new TreeIndexStatsOperatorNodePushable(this, ctx, partition);
+        return new TreeIndexStatsOperatorNodePushable(ctx, partition, 
indexHelperFactory, storageManager);
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorNodePushable.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorNodePushable.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorNodePushable.java
index 0462909..0210145 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorNodePushable.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorNodePushable.java
@@ -30,27 +30,27 @@ import 
org.apache.hyracks.dataflow.common.comm.io.ArrayTupleBuilder;
 import org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender;
 import 
org.apache.hyracks.dataflow.common.data.marshalling.UTF8StringSerializerDeserializer;
 import 
org.apache.hyracks.dataflow.std.base.AbstractUnaryOutputSourceOperatorNodePushable;
+import org.apache.hyracks.storage.am.common.api.IIndexDataflowHelper;
 import org.apache.hyracks.storage.am.common.api.ITreeIndex;
 import org.apache.hyracks.storage.am.common.util.TreeIndexStats;
 import org.apache.hyracks.storage.am.common.util.TreeIndexStatsGatherer;
+import org.apache.hyracks.storage.common.IStorageManager;
+import org.apache.hyracks.storage.common.LocalResource;
 import org.apache.hyracks.storage.common.buffercache.IBufferCache;
 import org.apache.hyracks.storage.common.file.IFileMapProvider;
-import org.apache.hyracks.storage.common.file.LocalResource;
 
 public class TreeIndexStatsOperatorNodePushable extends 
AbstractUnaryOutputSourceOperatorNodePushable {
-    private final AbstractTreeIndexOperatorDescriptor opDesc;
     private final IHyracksTaskContext ctx;
-    private final TreeIndexDataflowHelper treeIndexHelper;
+    private final IStorageManager storageManager;
+    private final IIndexDataflowHelper treeIndexHelper;
     private final UTF8StringSerializerDeserializer utf8SerDer = new 
UTF8StringSerializerDeserializer();
-    private TreeIndexStatsGatherer statsGatherer;
 
-    public 
TreeIndexStatsOperatorNodePushable(AbstractTreeIndexOperatorDescriptor opDesc, 
IHyracksTaskContext ctx,
-            int partition) throws HyracksDataException {
-        this.opDesc = opDesc;
+    public TreeIndexStatsOperatorNodePushable(IHyracksTaskContext ctx, int 
partition,
+            IIndexDataflowHelperFactory indexHelperFactory, IStorageManager 
storageManager)
+            throws HyracksDataException {
         this.ctx = ctx;
-        this.treeIndexHelper = (TreeIndexDataflowHelper) 
opDesc.getIndexDataflowHelperFactory()
-                .createIndexDataflowHelper(opDesc, ctx, partition);
-
+        this.treeIndexHelper = indexHelperFactory.create(ctx, partition);
+        this.storageManager = storageManager;
     }
 
     @Override
@@ -68,16 +68,18 @@ public class TreeIndexStatsOperatorNodePushable extends 
AbstractUnaryOutputSourc
         ITreeIndex treeIndex = (ITreeIndex) treeIndexHelper.getIndexInstance();
         try {
             writer.open();
-            IBufferCache bufferCache = 
opDesc.getStorageManager().getBufferCache(ctx);
-            IFileMapProvider fileMapProvider = 
opDesc.getStorageManager().getFileMapProvider(ctx);
+            IBufferCache bufferCache = 
storageManager.getBufferCache(ctx.getJobletContext().getServiceContext());
+            IFileMapProvider fileMapProvider =
+                    
storageManager.getFileMapProvider(ctx.getJobletContext().getServiceContext());
             LocalResource resource = treeIndexHelper.getResource();
-            IIOManager ioManager = ctx.getIOManager();
+            IIOManager ioManager = ctx.getIoManager();
             FileReference fileRef = ioManager.resolve(resource.getPath());
             int indexFileId = fileMapProvider.lookupFileId(fileRef);
-            statsGatherer = new TreeIndexStatsGatherer(bufferCache, 
treeIndex.getPageManager(), indexFileId,
-                    treeIndex.getRootPageId());
-            TreeIndexStats stats = 
statsGatherer.gatherStats(treeIndex.getLeafFrameFactory().createFrame(), 
treeIndex
-                    .getInteriorFrameFactory().createFrame(), 
treeIndex.getPageManager().createMetadataFrame());
+            TreeIndexStatsGatherer statsGatherer = new 
TreeIndexStatsGatherer(bufferCache, treeIndex.getPageManager(),
+                    indexFileId, treeIndex.getRootPageId());
+            TreeIndexStats stats = 
statsGatherer.gatherStats(treeIndex.getLeafFrameFactory().createFrame(),
+                    treeIndex.getInteriorFrameFactory().createFrame(),
+                    treeIndex.getPageManager().createMetadataFrame());
             // Write the stats output as a single string field.
             FrameTupleAppender appender = new FrameTupleAppender(new 
VSizeFrame(ctx));
             ArrayTupleBuilder tb = new ArrayTupleBuilder(1);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/AbstractSearchPredicate.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/AbstractSearchPredicate.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/AbstractSearchPredicate.java
index 3ad2b72..6e27678 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/AbstractSearchPredicate.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/AbstractSearchPredicate.java
@@ -20,7 +20,7 @@
 package org.apache.hyracks.storage.am.common.impls;
 
 import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
-import org.apache.hyracks.storage.am.common.api.ISearchPredicate;
+import org.apache.hyracks.storage.common.ISearchPredicate;
 
 public abstract class AbstractSearchPredicate implements ISearchPredicate {
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/AbstractTreeIndex.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/AbstractTreeIndex.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/AbstractTreeIndex.java
index 2c8429d..0ed5f19 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/AbstractTreeIndex.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/AbstractTreeIndex.java
@@ -26,7 +26,6 @@ import 
org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 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.IPageManager;
 import org.apache.hyracks.storage.am.common.api.ITreeIndex;
 import org.apache.hyracks.storage.am.common.api.ITreeIndexAccessor;
@@ -34,7 +33,8 @@ import 
org.apache.hyracks.storage.am.common.api.ITreeIndexFrame;
 import org.apache.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import org.apache.hyracks.storage.am.common.api.ITreeIndexMetadataFrame;
 import org.apache.hyracks.storage.am.common.api.ITreeIndexTupleWriter;
-import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator;
+import org.apache.hyracks.storage.common.IIndexBulkLoader;
+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.buffercache.IFIFOPageQueue;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/NoOpOperationCallback.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/NoOpOperationCallback.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/NoOpOperationCallback.java
index 511d166..8245338 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/NoOpOperationCallback.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/NoOpOperationCallback.java
@@ -21,8 +21,8 @@ package org.apache.hyracks.storage.am.common.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.IModificationOperationCallback;
-import org.apache.hyracks.storage.am.common.api.ISearchOperationCallback;
+import org.apache.hyracks.storage.common.IModificationOperationCallback;
+import org.apache.hyracks.storage.common.ISearchOperationCallback;
 
 /**
  * Dummy operation callback that simply does nothing.

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/NoOpOperationCallbackFactory.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/NoOpOperationCallbackFactory.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/NoOpOperationCallbackFactory.java
index 90eb5a1..4ef89d1 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/NoOpOperationCallbackFactory.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/NoOpOperationCallbackFactory.java
@@ -21,11 +21,11 @@ package org.apache.hyracks.storage.am.common.impls;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.IOperatorNodePushable;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.storage.am.common.api.IModificationOperationCallback;
 import 
org.apache.hyracks.storage.am.common.api.IModificationOperationCallbackFactory;
-import org.apache.hyracks.storage.am.common.api.ISearchOperationCallback;
 import 
org.apache.hyracks.storage.am.common.api.ISearchOperationCallbackFactory;
-import org.apache.hyracks.storage.common.file.LocalResource;
+import org.apache.hyracks.storage.common.IModificationOperationCallback;
+import org.apache.hyracks.storage.common.ISearchOperationCallback;
+import org.apache.hyracks.storage.common.LocalResource;
 
 /**
  * Dummy NoOp callback factory used primarily for testing. Always returns the 
{@link NoOpOperationCallback} instance.

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/TreeIndexDiskOrderScanCursor.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/TreeIndexDiskOrderScanCursor.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/TreeIndexDiskOrderScanCursor.java
index 6bd3e60..88c9e51 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/TreeIndexDiskOrderScanCursor.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/impls/TreeIndexDiskOrderScanCursor.java
@@ -21,11 +21,11 @@ package org.apache.hyracks.storage.am.common.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.ITreeIndexFrame;
 import org.apache.hyracks.storage.am.common.api.ITreeIndexTupleReference;
+import org.apache.hyracks.storage.common.ICursorInitialState;
+import org.apache.hyracks.storage.common.ISearchPredicate;
 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-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/MultiComparator.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/MultiComparator.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/MultiComparator.java
deleted file mode 100644
index d99ea3a..0000000
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/MultiComparator.java
+++ /dev/null
@@ -1,133 +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.common.ophelpers;
-
-import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
-import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
-
-public class MultiComparator {
-
-    protected final IBinaryComparator[] cmps;
-
-    public MultiComparator(IBinaryComparator[] cmps) {
-        this.cmps = cmps;
-    }
-
-    public int compare(ITupleReference tupleA, ITupleReference tupleB) throws 
HyracksDataException {
-        for (int i = 0; i < cmps.length; i++) {
-            int cmp = cmps[i].compare(tupleA.getFieldData(i), 
tupleA.getFieldStart(i), tupleA.getFieldLength(i),
-                    tupleB.getFieldData(i), tupleB.getFieldStart(i), 
tupleB.getFieldLength(i));
-            if (cmp != 0) {
-                return cmp;
-            }
-        }
-        return 0;
-    }
-
-    public int selectiveFieldCompare(ITupleReference tupleA, ITupleReference 
tupleB, int[] fields)
-            throws HyracksDataException {
-        for (int j = 0; j < cmps.length; j++) {
-            int i = fields[j];
-            int cmp = cmps[j].compare(tupleA.getFieldData(i), 
tupleA.getFieldStart(i), tupleA.getFieldLength(i),
-                    tupleB.getFieldData(i), tupleB.getFieldStart(i), 
tupleB.getFieldLength(i));
-            if (cmp != 0) {
-                return cmp;
-            }
-        }
-        return 0;
-    }
-
-    public int compare(ITupleReference tupleA, ITupleReference tupleB, int 
startFieldIndex) throws HyracksDataException {
-        for (int i = 0; i < cmps.length; i++) {
-            int ix = startFieldIndex + i;
-            int cmp = cmps[i].compare(tupleA.getFieldData(ix), 
tupleA.getFieldStart(ix), tupleA.getFieldLength(ix),
-                    tupleB.getFieldData(ix), tupleB.getFieldStart(ix), 
tupleB.getFieldLength(ix));
-            if (cmp != 0) {
-                return cmp;
-            }
-        }
-        return 0;
-    }
-
-    public int fieldRangeCompare(ITupleReference tupleA, ITupleReference 
tupleB, int startFieldIndex, int numFields)
-            throws HyracksDataException {
-        for (int i = startFieldIndex; i < startFieldIndex + numFields; i++) {
-            int cmp = cmps[i].compare(tupleA.getFieldData(i), 
tupleA.getFieldStart(i), tupleA.getFieldLength(i),
-                    tupleB.getFieldData(i), tupleB.getFieldStart(i), 
tupleB.getFieldLength(i));
-            if (cmp != 0) {
-                return cmp;
-            }
-        }
-        return 0;
-    }
-
-    public IBinaryComparator[] getComparators() {
-        return cmps;
-    }
-
-    public int getKeyFieldCount() {
-        return cmps.length;
-    }
-
-    public static MultiComparator create(IBinaryComparatorFactory[] 
cmpFactories) {
-        IBinaryComparator[] cmps = new IBinaryComparator[cmpFactories.length];
-        for (int i = 0; i < cmpFactories.length; i++) {
-            cmps[i] = cmpFactories[i].createBinaryComparator();
-        }
-        if (cmps.length == 1) {
-            return new SingleComparator(cmps);
-        } else {
-            return new MultiComparator(cmps);
-        }
-    }
-
-    public static MultiComparator create(IBinaryComparatorFactory[] 
cmpFactories, int startIndex, int numCmps) {
-        IBinaryComparator[] cmps = new IBinaryComparator[numCmps];
-        for (int i = startIndex; i < startIndex + numCmps; i++) {
-            cmps[i] = cmpFactories[i].createBinaryComparator();
-        }
-        if (cmps.length == 1) {
-            return new SingleComparator(cmps);
-        } else {
-            return new MultiComparator(cmps);
-        }
-    }
-
-    public static MultiComparator create(IBinaryComparatorFactory[]... 
cmpFactories) {
-        int size = 0;
-        for (int i = 0; i < cmpFactories.length; i++) {
-            size += cmpFactories[i].length;
-        }
-        IBinaryComparator[] cmps = new IBinaryComparator[size];
-        int x = 0;
-        for (int i = 0; i < cmpFactories.length; i++) {
-            for (int j = 0; j < cmpFactories[i].length; j++) {
-                cmps[x++] = cmpFactories[i][j].createBinaryComparator();
-            }
-        }
-        if (cmps.length == 1) {
-            return new SingleComparator(cmps);
-        } else {
-            return new MultiComparator(cmps);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/SingleComparator.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/SingleComparator.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/SingleComparator.java
deleted file mode 100644
index 3ceec3e..0000000
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/SingleComparator.java
+++ /dev/null
@@ -1,42 +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.common.ophelpers;
-
-import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
-
-/**
- * MultiComparator optimized for the special case where there is only a single 
comparator.
- */
-public class SingleComparator extends MultiComparator {
-
-    private final IBinaryComparator cmp;
-
-    protected SingleComparator(IBinaryComparator[] cmps) {
-        super(cmps);
-        this.cmp = cmps[0];
-    }
-
-    public int compare(ITupleReference tupleA, ITupleReference tupleB) throws 
HyracksDataException {
-        return cmp.compare(tupleA.getFieldData(0), tupleA.getFieldStart(0), 
tupleA.getFieldLength(0),
-                tupleB.getFieldData(0), tupleB.getFieldStart(0), 
tupleB.getFieldLength(0));
-    }
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/util/IndexFileNameUtil.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/util/IndexFileNameUtil.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/util/IndexFileNameUtil.java
index 71d7c76..6f2850d 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/util/IndexFileNameUtil.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/util/IndexFileNameUtil.java
@@ -25,7 +25,7 @@ import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.io.FileReference;
 import org.apache.hyracks.api.io.FileSplit;
 import org.apache.hyracks.api.io.IIOManager;
-import org.apache.hyracks.storage.am.common.dataflow.IIndexOperatorDescriptor;
+import org.apache.hyracks.dataflow.std.file.IFileSplitProvider;
 
 public class IndexFileNameUtil {
 
@@ -36,9 +36,9 @@ public class IndexFileNameUtil {
         return path + File.separator + IO_DEVICE_NAME_PREFIX + ioDeviceId;
     }
 
-    public static FileReference 
getIndexAbsoluteFileRef(IIndexOperatorDescriptor opDesc, int partition,
+    public static FileReference getIndexAbsoluteFileRef(IFileSplitProvider 
fileSplitProvider, int partition,
             IIOManager ioManager) throws HyracksDataException {
-        FileSplit split = 
opDesc.getFileSplitProvider().getFileSplits()[partition];
+        FileSplit split = fileSplitProvider.getFileSplits()[partition];
         return split.getFileReference(ioManager);
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeDataflowHelper.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeDataflowHelper.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeDataflowHelper.java
deleted file mode 100644
index ab544e7..0000000
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeDataflowHelper.java
+++ /dev/null
@@ -1,82 +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.btree.dataflow;
-
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.api.io.FileReference;
-import org.apache.hyracks.storage.am.common.api.IIndex;
-import org.apache.hyracks.storage.am.common.api.IMetadataPageManagerFactory;
-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.IIndexOperatorDescriptor;
-import org.apache.hyracks.storage.am.common.util.IndexFileNameUtil;
-import org.apache.hyracks.storage.am.lsm.btree.utils.LSMBTreeUtil;
-import 
org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory;
-import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationScheduler;
-import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicy;
-import 
org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory;
-
-public class ExternalBTreeDataflowHelper extends LSMBTreeDataflowHelper {
-
-    private final int version;
-
-    public ExternalBTreeDataflowHelper(IIndexOperatorDescriptor opDesc, 
IHyracksTaskContext ctx, int partition,
-            double bloomFilterFalsePositiveRate, ILSMMergePolicy mergePolicy,
-            ILSMOperationTrackerFactory opTrackerFactory, 
ILSMIOOperationScheduler ioScheduler,
-            ILSMIOOperationCallbackFactory ioOpCallbackFactory, int version, 
boolean durable)
-            throws HyracksDataException {
-        super(opDesc, ctx, partition, null, bloomFilterFalsePositiveRate, 
mergePolicy, opTrackerFactory, ioScheduler,
-                ioOpCallbackFactory, false, null, null, null, null, durable);
-        this.version = version;
-    }
-
-    @Override
-    public IIndex getIndexInstance() {
-        synchronized (lcManager) {
-            if (index == null) {
-                try {
-                    index = lcManager.get(resourceName);
-                } catch (HyracksDataException e) {
-                    return null;
-                }
-            }
-        }
-        return index;
-    }
-
-    @Override
-    public ITreeIndex createIndexInstance() throws HyracksDataException {
-        AbstractTreeIndexOperatorDescriptor treeOpDesc = 
(AbstractTreeIndexOperatorDescriptor) opDesc;
-        FileReference fileRef = 
IndexFileNameUtil.getIndexAbsoluteFileRef(treeOpDesc, ctx.getTaskAttemptId()
-                .getTaskId().getPartition(), ctx.getIOManager());
-        return LSMBTreeUtil.createExternalBTree(ctx.getIOManager(), fileRef, 
opDesc.getStorageManager()
-                .getBufferCache(ctx), opDesc
-                .getStorageManager().getFileMapProvider(ctx), 
treeOpDesc.getTreeIndexTypeTraits(), treeOpDesc
-                .getTreeIndexComparatorFactories(), 
treeOpDesc.getTreeIndexBloomFilterKeyFields(),
-                bloomFilterFalsePositiveRate, mergePolicy, 
opTrackerFactory.getOperationTracker(ctx.getJobletContext()
-                        .getServiceContext()), ioScheduler,
-                ioOpCallbackFactory.createIoOpCallback(), getVersion(), 
durable,
-                (IMetadataPageManagerFactory) opDesc.getPageManagerFactory());
-    }
-
-    public int getVersion() {
-        return version;
-    }
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeDataflowHelperFactory.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeDataflowHelperFactory.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeDataflowHelperFactory.java
deleted file mode 100644
index 9d0d2ac..0000000
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeDataflowHelperFactory.java
+++ /dev/null
@@ -1,56 +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.btree.dataflow;
-
-import java.util.Map;
-
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.storage.am.common.api.IIndexDataflowHelper;
-import org.apache.hyracks.storage.am.common.dataflow.IIndexOperatorDescriptor;
-import 
org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory;
-import 
org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationSchedulerProvider;
-import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory;
-import 
org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory;
-import 
org.apache.hyracks.storage.am.lsm.common.dataflow.AbstractLSMIndexDataflowHelperFactory;
-
-public class ExternalBTreeDataflowHelperFactory extends 
AbstractLSMIndexDataflowHelperFactory {
-
-    private static final long serialVersionUID = 1L;
-
-    private final int version;
-
-    public ExternalBTreeDataflowHelperFactory(ILSMMergePolicyFactory 
mergePolicyFactory,
-            Map<String, String> mergePolicyProperties, 
ILSMOperationTrackerFactory opTrackerFactory,
-            ILSMIOOperationSchedulerProvider ioSchedulerProvider, 
ILSMIOOperationCallbackFactory ioOpCallbackFactory,
-            double bloomFilterFalsePositiveRate, int version, boolean durable) 
{
-        super(null, mergePolicyFactory, mergePolicyProperties, 
opTrackerFactory, ioSchedulerProvider,
-                ioOpCallbackFactory, bloomFilterFalsePositiveRate, null, null, 
null, durable);
-        this.version = version;
-    }
-
-    @Override
-    public IIndexDataflowHelper 
createIndexDataflowHelper(IIndexOperatorDescriptor opDesc, IHyracksTaskContext 
ctx,
-            int partition) throws HyracksDataException {
-        return new ExternalBTreeDataflowHelper(opDesc, ctx, partition, 
bloomFilterFalsePositiveRate,
-                mergePolicyFactory.createMergePolicy(mergePolicyProperties, 
ctx), opTrackerFactory,
-                ioSchedulerProvider.getIOScheduler(ctx), ioOpCallbackFactory, 
version, durable);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeLocalResource.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeLocalResource.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeLocalResource.java
new file mode 100644
index 0000000..6860b97
--- /dev/null
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeLocalResource.java
@@ -0,0 +1,66 @@
+/*
+ * 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.btree.dataflow;
+
+import java.util.Map;
+
+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.IMetadataPageManagerFactory;
+import org.apache.hyracks.storage.am.lsm.btree.utils.LSMBTreeUtil;
+import 
org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory;
+import 
org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationSchedulerProvider;
+import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndex;
+import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory;
+import 
org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory;
+import org.apache.hyracks.storage.common.IStorageManager;
+
+public class ExternalBTreeLocalResource extends LSMBTreeLocalResource {
+
+    private static final long serialVersionUID = 1L;
+
+    public ExternalBTreeLocalResource(ITypeTraits[] typeTraits, 
IBinaryComparatorFactory[] cmpFactories,
+            int[] bloomFilterKeyFields, double bloomFilterFalsePositiveRate, 
boolean isPrimary, String path,
+            IStorageManager storageManager, ILSMMergePolicyFactory 
mergePolicyFactory,
+            Map<String, String> mergePolicyProperties, ITypeTraits[] 
filterTypeTraits,
+            IBinaryComparatorFactory[] filterCmpFactories, int[] btreeFields, 
int[] filterFields,
+            ILSMOperationTrackerFactory opTrackerProvider, 
ILSMIOOperationCallbackFactory ioOpCallbackFactory,
+            IMetadataPageManagerFactory metadataPageManagerFactory,
+            ILSMIOOperationSchedulerProvider ioSchedulerProvider, boolean 
durable) {
+        super(typeTraits, cmpFactories, bloomFilterKeyFields, 
bloomFilterFalsePositiveRate, isPrimary, path,
+                storageManager, mergePolicyFactory, mergePolicyProperties, 
filterTypeTraits, filterCmpFactories,
+                btreeFields, filterFields, opTrackerProvider, 
ioOpCallbackFactory, metadataPageManagerFactory, null,
+                ioSchedulerProvider, durable);
+    }
+
+    @Override
+    public ILSMIndex createInstance(INCServiceContext serviceCtx) throws 
HyracksDataException {
+        IIOManager ioManager = serviceCtx.getIoManager();
+        FileReference file = ioManager.resolve(path);
+        return LSMBTreeUtil.createExternalBTree(ioManager, file, 
storageManager.getBufferCache(serviceCtx),
+                storageManager.getFileMapProvider(serviceCtx), typeTraits, 
cmpFactories, bloomFilterKeyFields,
+                bloomFilterFalsePositiveRate, 
mergePolicyFactory.createMergePolicy(mergePolicyProperties, serviceCtx),
+                opTrackerProvider.getOperationTracker(serviceCtx), 
ioSchedulerProvider.getIoScheduler(serviceCtx),
+                ioOpCallbackFactory.createIoOpCallback(), durable, 
metadataPageManagerFactory);
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeLocalResourceFactory.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeLocalResourceFactory.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeLocalResourceFactory.java
new file mode 100644
index 0000000..a4c24c9
--- /dev/null
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeLocalResourceFactory.java
@@ -0,0 +1,59 @@
+/*
+ * 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.btree.dataflow;
+
+import java.util.Map;
+
+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.IMetadataPageManagerFactory;
+import 
org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory;
+import 
org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationSchedulerProvider;
+import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory;
+import 
org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory;
+import org.apache.hyracks.storage.am.lsm.common.dataflow.LsmResource;
+import org.apache.hyracks.storage.common.IStorageManager;
+
+public class ExternalBTreeLocalResourceFactory extends 
LSMBTreeLocalResourceFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    public ExternalBTreeLocalResourceFactory(IStorageManager storageManager, 
ITypeTraits[] typeTraits,
+            IBinaryComparatorFactory[] cmpFactories, ITypeTraits[] 
filterTypeTraits,
+            IBinaryComparatorFactory[] filterCmpFactories, int[] filterFields,
+            ILSMOperationTrackerFactory opTrackerFactory, 
ILSMIOOperationCallbackFactory ioOpCallbackFactory,
+            IMetadataPageManagerFactory metadataPageManagerFactory,
+            ILSMIOOperationSchedulerProvider ioSchedulerProvider, 
ILSMMergePolicyFactory mergePolicyFactory,
+            Map<String, String> mergePolicyProperties, boolean durable, int[] 
bloomFilterKeyFields,
+            double bloomFilterFalsePositiveRate, boolean isPrimary, int[] 
btreeFields) {
+        super(storageManager, typeTraits, cmpFactories, filterTypeTraits, 
filterCmpFactories, filterFields,
+                opTrackerFactory, ioOpCallbackFactory, 
metadataPageManagerFactory, null, ioSchedulerProvider,
+                mergePolicyFactory, mergePolicyProperties, durable, 
bloomFilterKeyFields, bloomFilterFalsePositiveRate,
+                isPrimary, btreeFields);
+    }
+
+    @Override
+    public LsmResource createResource(FileReference fileRef) {
+        return new ExternalBTreeLocalResource(typeTraits, cmpFactories, 
bloomFilterKeyFields,
+                bloomFilterFalsePositiveRate, isPrimary, 
fileRef.getRelativePath(), storageManager, mergePolicyFactory,
+                mergePolicyProperties, filterTypeTraits, filterCmpFactories, 
btreeFields, bloomFilterKeyFields,
+                opTrackerProvider, ioOpCallbackFactory, 
metadataPageManagerFactory, ioSchedulerProvider, durable);
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeWithBuddyDataflowHelper.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeWithBuddyDataflowHelper.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeWithBuddyDataflowHelper.java
deleted file mode 100644
index 4e3c022..0000000
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeWithBuddyDataflowHelper.java
+++ /dev/null
@@ -1,92 +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.btree.dataflow;
-
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.api.io.FileReference;
-import org.apache.hyracks.storage.am.common.api.IIndex;
-import org.apache.hyracks.storage.am.common.api.IMetadataPageManagerFactory;
-import 
org.apache.hyracks.storage.am.common.dataflow.AbstractTreeIndexOperatorDescriptor;
-import org.apache.hyracks.storage.am.common.dataflow.IIndexOperatorDescriptor;
-import org.apache.hyracks.storage.am.common.util.IndexFileNameUtil;
-import org.apache.hyracks.storage.am.lsm.btree.utils.LSMBTreeUtil;
-import 
org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory;
-import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationScheduler;
-import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicy;
-import 
org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory;
-import 
org.apache.hyracks.storage.am.lsm.common.dataflow.AbstractLSMIndexDataflowHelper;
-
-public class ExternalBTreeWithBuddyDataflowHelper extends 
AbstractLSMIndexDataflowHelper {
-
-    private final int[] buddyBtreeFields;
-    private final int version;
-
-    public ExternalBTreeWithBuddyDataflowHelper(IIndexOperatorDescriptor 
opDesc, IHyracksTaskContext ctx,
-            int partition, ILSMMergePolicy mergePolicy, 
ILSMOperationTrackerFactory opTrackerFactory,
-            ILSMIOOperationScheduler ioScheduler, 
ILSMIOOperationCallbackFactory ioOpCallbackFactory,
-            int[] buddyBtreeFields, int version, boolean durable) throws 
HyracksDataException {
-        super(opDesc, ctx, partition, null, mergePolicy, opTrackerFactory, 
ioScheduler, ioOpCallbackFactory, null,
-                null, null, durable);
-        this.buddyBtreeFields = buddyBtreeFields;
-        this.version = version;
-    }
-
-    public ExternalBTreeWithBuddyDataflowHelper(IIndexOperatorDescriptor 
opDesc, IHyracksTaskContext ctx,
-            int partition, double bloomFilterFalsePositiveRate, 
ILSMMergePolicy mergePolicy,
-            ILSMOperationTrackerFactory opTrackerFactory, 
ILSMIOOperationScheduler ioScheduler,
-            ILSMIOOperationCallbackFactory ioOpCallbackFactory, int[] 
buddyBtreeFields, int version, boolean durable)
-            throws HyracksDataException {
-        super(opDesc, ctx, partition, null, bloomFilterFalsePositiveRate, 
mergePolicy, opTrackerFactory, ioScheduler,
-                ioOpCallbackFactory, null, null, null, durable);
-        this.buddyBtreeFields = buddyBtreeFields;
-        this.version = version;
-    }
-
-    @Override
-    public IIndex getIndexInstance() {
-        synchronized (lcManager) {
-            if (index == null) {
-                try {
-                    index = lcManager.get(resourceName);
-                } catch (HyracksDataException e) {
-                    return null;
-                }
-            }
-        }
-        return index;
-    }
-
-    @Override
-    protected IIndex createIndexInstance() throws HyracksDataException {
-        AbstractTreeIndexOperatorDescriptor treeOpDesc = 
(AbstractTreeIndexOperatorDescriptor) opDesc;
-        FileReference fileRef = 
IndexFileNameUtil.getIndexAbsoluteFileRef(treeOpDesc, ctx.getTaskAttemptId()
-                .getTaskId().getPartition(), ctx.getIOManager());
-        return LSMBTreeUtil.createExternalBTreeWithBuddy(ctx.getIOManager(), 
fileRef,
-                opDesc.getStorageManager().getBufferCache(ctx),
-                opDesc.getStorageManager().getFileMapProvider(ctx), 
treeOpDesc.getTreeIndexTypeTraits(),
-                treeOpDesc.getTreeIndexComparatorFactories(), 
bloomFilterFalsePositiveRate, mergePolicy,
-                
opTrackerFactory.getOperationTracker(ctx.getJobletContext().getServiceContext()),
 ioScheduler,
-                ioOpCallbackFactory.createIoOpCallback(), buddyBtreeFields, 
version, durable,
-                (IMetadataPageManagerFactory) opDesc.getPageManagerFactory());
-    }
-    public int getTargetVersion() {
-        return version;
-    }
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeWithBuddyDataflowHelperFactory.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeWithBuddyDataflowHelperFactory.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeWithBuddyDataflowHelperFactory.java
deleted file mode 100644
index 3b49b0f..0000000
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeWithBuddyDataflowHelperFactory.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.hyracks.storage.am.lsm.btree.dataflow;
-
-import java.util.Map;
-
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.storage.am.common.api.IIndexDataflowHelper;
-import org.apache.hyracks.storage.am.common.dataflow.IIndexOperatorDescriptor;
-import 
org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory;
-import 
org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationSchedulerProvider;
-import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory;
-import 
org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory;
-import 
org.apache.hyracks.storage.am.lsm.common.dataflow.AbstractLSMIndexDataflowHelperFactory;
-
-public class ExternalBTreeWithBuddyDataflowHelperFactory extends 
AbstractLSMIndexDataflowHelperFactory {
-
-    private static final long serialVersionUID = 1L;
-    private final int[] buddyBtreeFields;
-    private final int version;
-
-    public ExternalBTreeWithBuddyDataflowHelperFactory(ILSMMergePolicyFactory 
mergePolicyFactory,
-            Map<String, String> mergePolicyProperties, 
ILSMOperationTrackerFactory opTrackerFactory,
-            ILSMIOOperationSchedulerProvider ioSchedulerProvider, 
ILSMIOOperationCallbackFactory ioOpCallbackFactory,
-            double bloomFilterFalsePositiveRate, int[] buddyBtreeFields, int 
version, boolean durable) {
-        super(null, mergePolicyFactory, mergePolicyProperties, 
opTrackerFactory, ioSchedulerProvider,
-                ioOpCallbackFactory, bloomFilterFalsePositiveRate, null, null, 
null, durable);
-        this.buddyBtreeFields = buddyBtreeFields;
-        this.version = version;
-    }
-
-    @Override
-    public IIndexDataflowHelper 
createIndexDataflowHelper(IIndexOperatorDescriptor opDesc, IHyracksTaskContext 
ctx,
-            int partition) throws HyracksDataException {
-        return new ExternalBTreeWithBuddyDataflowHelper(opDesc, ctx, 
partition, bloomFilterFalsePositiveRate,
-                mergePolicyFactory.createMergePolicy(mergePolicyProperties, 
ctx), opTrackerFactory,
-                ioSchedulerProvider.getIOScheduler(ctx), ioOpCallbackFactory, 
buddyBtreeFields, version, durable);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeWithBuddyLocalResource.java
----------------------------------------------------------------------
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeWithBuddyLocalResource.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeWithBuddyLocalResource.java
new file mode 100644
index 0000000..3819066
--- /dev/null
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/ExternalBTreeWithBuddyLocalResource.java
@@ -0,0 +1,69 @@
+/*
+ * 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.btree.dataflow;
+
+import java.util.Map;
+
+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.IMetadataPageManagerFactory;
+import org.apache.hyracks.storage.am.lsm.btree.utils.LSMBTreeUtil;
+import 
org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory;
+import 
org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationSchedulerProvider;
+import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndex;
+import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory;
+import 
org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory;
+import org.apache.hyracks.storage.common.IStorageManager;
+
+/**
+ * The local resource for disk only lsm btree with buddy tree
+ */
+public class ExternalBTreeWithBuddyLocalResource extends LSMBTreeLocalResource 
{
+
+    private static final long serialVersionUID = 1L;
+
+    public ExternalBTreeWithBuddyLocalResource(ITypeTraits[] typeTraits, 
IBinaryComparatorFactory[] cmpFactories,
+            int[] buddyBtreeFields, double bloomFilterFalsePositiveRate, 
boolean isPrimary, String path,
+            IStorageManager storageManager, ILSMMergePolicyFactory 
mergePolicyFactory,
+            Map<String, String> mergePolicyProperties, ITypeTraits[] 
filterTypeTraits,
+            IBinaryComparatorFactory[] filterCmpFactories, int[] btreeFields, 
int[] filterFields,
+            ILSMOperationTrackerFactory opTrackerProvider, 
ILSMIOOperationCallbackFactory ioOpCallbackFactory,
+            IMetadataPageManagerFactory metadataPageManagerFactory,
+            ILSMIOOperationSchedulerProvider ioSchedulerProvider, boolean 
durable) {
+        super(typeTraits, cmpFactories, buddyBtreeFields, 
bloomFilterFalsePositiveRate, isPrimary, path, storageManager,
+                mergePolicyFactory, mergePolicyProperties, filterTypeTraits, 
filterCmpFactories, btreeFields,
+                filterFields, opTrackerProvider, ioOpCallbackFactory, 
metadataPageManagerFactory, null,
+                ioSchedulerProvider, durable);
+    }
+
+    @Override
+    public ILSMIndex createInstance(INCServiceContext serviceCtx) throws 
HyracksDataException {
+        IIOManager ioManager = serviceCtx.getIoManager();
+        FileReference file = ioManager.resolve(path);
+        return LSMBTreeUtil.createExternalBTreeWithBuddy(ioManager, file, 
storageManager.getBufferCache(serviceCtx),
+                storageManager.getFileMapProvider(serviceCtx), typeTraits, 
cmpFactories, bloomFilterFalsePositiveRate,
+                mergePolicyFactory.createMergePolicy(mergePolicyProperties, 
serviceCtx),
+                opTrackerProvider.getOperationTracker(serviceCtx), 
ioSchedulerProvider.getIoScheduler(serviceCtx),
+                ioOpCallbackFactory.createIoOpCallback(), 
bloomFilterKeyFields, durable, metadataPageManagerFactory);
+    }
+}

Reply via email to