use of org.apache.hyracks.storage.am.common.api.IIndexDataflowHelper in project asterixdb by apache.
the class ExternalFilesIndexCreateOperatorDescriptor method createPushRuntime.
@Override
public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx, IRecordDescriptorProvider recordDescProvider, int partition, int nPartitions) throws HyracksDataException {
return new AbstractOperatorNodePushable() {
@Override
public void initialize() throws HyracksDataException {
IIndexBuilder indexBuilder = indexBuilderFactory.create(ctx, partition);
IIndexDataflowHelper indexHelper = dataflowHelperFactory.create(ctx, partition);
FileIndexTupleTranslator filesTupleTranslator = new FileIndexTupleTranslator();
// Build the index
indexBuilder.build();
// Open the index
indexHelper.open();
try {
IIndex index = indexHelper.getIndexInstance();
// Create bulk loader
IIndexBulkLoader bulkLoader = index.createBulkLoader(BTree.DEFAULT_FILL_FACTOR, false, files.size(), false);
// Load files
for (ExternalFile file : files) {
bulkLoader.add(filesTupleTranslator.getTupleFromFile(file));
}
bulkLoader.end();
} finally {
indexHelper.close();
}
}
@Override
public void deinitialize() throws HyracksDataException {
}
@Override
public int getInputArity() {
return 0;
}
@Override
public void setOutputFrameWriter(int index, IFrameWriter writer, RecordDescriptor recordDesc) throws HyracksDataException {
}
@Override
public IFrameWriter getInputFrameWriter(int index) {
return null;
}
};
}
Aggregations