Search in sources :

Example 21 with IIOManager

use of org.apache.hyracks.api.io.IIOManager in project asterixdb by apache.

the class FileScanOperatorDescriptor method createPushRuntime.

@Override
public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx, IRecordDescriptorProvider recordDescProvider, int partition, int nPartitions) throws HyracksDataException {
    final FileSplit split = fileSplitProvider.getFileSplits()[partition];
    final ITupleParser tp = tupleParserFactory.createTupleParser(ctx);
    final IIOManager ioManager = ctx.getIoManager();
    return new AbstractUnaryOutputSourceOperatorNodePushable() {

        @Override
        public void initialize() throws HyracksDataException {
            File f = split.getFile(ioManager);
            try {
                writer.open();
                InputStream in;
                try {
                    in = new FileInputStream(f);
                } catch (FileNotFoundException e) {
                    writer.fail();
                    throw new HyracksDataException(e);
                }
                tp.parse(in, writer);
            } catch (Throwable th) {
                writer.fail();
                throw new HyracksDataException(th);
            } finally {
                writer.close();
            }
        }
    };
}
Also used : AbstractUnaryOutputSourceOperatorNodePushable(org.apache.hyracks.dataflow.std.base.AbstractUnaryOutputSourceOperatorNodePushable) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) FileNotFoundException(java.io.FileNotFoundException) FileSplit(org.apache.hyracks.api.io.FileSplit) IIOManager(org.apache.hyracks.api.io.IIOManager) File(java.io.File) FileInputStream(java.io.FileInputStream) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 22 with IIOManager

use of org.apache.hyracks.api.io.IIOManager in project asterixdb by apache.

the class ExternalBTreeLocalResource method createInstance.

@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);
}
Also used : FileReference(org.apache.hyracks.api.io.FileReference) IIOManager(org.apache.hyracks.api.io.IIOManager)

Aggregations

IIOManager (org.apache.hyracks.api.io.IIOManager)22 FileReference (org.apache.hyracks.api.io.FileReference)16 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)7 IBufferCache (org.apache.hyracks.storage.common.buffercache.IBufferCache)6 IFileMapProvider (org.apache.hyracks.storage.common.file.IFileMapProvider)5 FileSplit (org.apache.hyracks.api.io.FileSplit)4 IVirtualBufferCache (org.apache.hyracks.storage.am.lsm.common.api.IVirtualBufferCache)4 IOException (java.io.IOException)3 Test (org.junit.Test)3 File (java.io.File)2 FileNotFoundException (java.io.FileNotFoundException)2 ByteBuffer (java.nio.ByteBuffer)2 ArrayList (java.util.ArrayList)2 RecordDescriptor (org.apache.hyracks.api.dataflow.value.RecordDescriptor)2 AbstractUnaryInputSinkOperatorNodePushable (org.apache.hyracks.dataflow.std.base.AbstractUnaryInputSinkOperatorNodePushable)2 AbortRecoverLSMIndexFileManager (org.apache.hyracks.storage.am.lsm.common.impls.AbortRecoverLSMIndexFileManager)2 ICachedPage (org.apache.hyracks.storage.common.buffercache.ICachedPage)2 BufferedWriter (java.io.BufferedWriter)1 DataInputStream (java.io.DataInputStream)1 DataOutput (java.io.DataOutput)1