Search in sources :

Example 1 with IDataSourceAdapter

use of org.apache.asterix.external.api.IDataSourceAdapter in project asterixdb by apache.

the class ExternalScanOperatorDescriptor method createPushRuntime.

@Override
public IOperatorNodePushable createPushRuntime(final IHyracksTaskContext ctx, IRecordDescriptorProvider recordDescProvider, final int partition, final int nPartitions) throws HyracksDataException {
    return new AbstractUnaryOutputSourceOperatorNodePushable() {

        @Override
        public void initialize() throws HyracksDataException {
            IDataSourceAdapter adapter = null;
            try {
                writer.open();
                adapter = adapterFactory.createAdapter(ctx, partition);
                adapter.start(partition, writer);
            } catch (Exception e) {
                writer.fail();
                throw new HyracksDataException(e);
            } finally {
                writer.close();
            }
        }
    };
}
Also used : IDataSourceAdapter(org.apache.asterix.external.api.IDataSourceAdapter) AbstractUnaryOutputSourceOperatorNodePushable(org.apache.hyracks.dataflow.std.base.AbstractUnaryOutputSourceOperatorNodePushable) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Aggregations

IDataSourceAdapter (org.apache.asterix.external.api.IDataSourceAdapter)1 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)1 AbstractUnaryOutputSourceOperatorNodePushable (org.apache.hyracks.dataflow.std.base.AbstractUnaryOutputSourceOperatorNodePushable)1