Search in sources :

Example 96 with HyracksDataException

use of org.apache.hyracks.api.exceptions.HyracksDataException in project asterixdb by apache.

the class ResultState method read.

public synchronized long read(long offset, ByteBuffer buffer) throws HyracksDataException {
    long readSize = 0;
    while (offset >= size && !eos.get() && !failed.get()) {
        try {
            wait();
        } catch (InterruptedException e) {
            throw new HyracksDataException(e);
        }
    }
    if ((offset >= size && eos.get()) || failed.get()) {
        return readSize;
    }
    if (readFileHandle == null) {
        initReadFileHandle();
    }
    readSize = ioManager.syncRead(readFileHandle, offset, buffer);
    return readSize;
}
Also used : HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 97 with HyracksDataException

use of org.apache.hyracks.api.exceptions.HyracksDataException in project asterixdb by apache.

the class ResultState method read.

public long read(DatasetMemoryManager datasetMemoryManager, long offset, ByteBuffer buffer) throws HyracksDataException {
    long readSize = 0;
    synchronized (this) {
        while (offset >= size && !eos.get() && !failed.get()) {
            try {
                wait();
            } catch (InterruptedException e) {
                throw new HyracksDataException(e);
            }
        }
        if ((offset >= size && eos.get()) || failed.get()) {
            return readSize;
        }
        if (offset < persistentSize) {
            if (readFileHandle == null) {
                initReadFileHandle();
            }
            readSize = ioManager.syncRead(readFileHandle, offset, buffer);
            if (readSize < 0) {
                throw new HyracksDataException("Premature end of file");
            }
        }
        if (readSize < buffer.capacity()) {
            long localPageOffset = offset - persistentSize;
            int localPageIndex = (int) (localPageOffset / DatasetMemoryManager.getPageSize());
            int pageOffset = (int) (localPageOffset % DatasetMemoryManager.getPageSize());
            Page page = getPage(localPageIndex);
            if (page == null) {
                return readSize;
            }
            readSize += buffer.remaining();
            buffer.put(page.getBuffer().array(), pageOffset, buffer.remaining());
        }
    }
    datasetMemoryManager.pageReferenced(resultSetPartitionId);
    return readSize;
}
Also used : HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 98 with HyracksDataException

use of org.apache.hyracks.api.exceptions.HyracksDataException in project asterixdb by apache.

the class ExceptionUtils method setNodeIds.

/**
     * Associate a node with a list of exceptions
     *
     * @param exceptions
     * @param nodeId
     */
public static void setNodeIds(Collection<Exception> exceptions, String nodeId) {
    List<Exception> newExceptions = new ArrayList<>();
    for (Exception e : exceptions) {
        if (e instanceof HyracksDataException) {
            newExceptions.add(HyracksDataException.create((HyracksDataException) e, nodeId));
        } else {
            newExceptions.add(new HyracksDataException(ErrorCode.HYRACKS, ErrorCode.FAILURE_ON_NODE, e.getMessage(), e, nodeId));
        }
    }
    exceptions.clear();
    exceptions.addAll(newExceptions);
}
Also used : ArrayList(java.util.ArrayList) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 99 with HyracksDataException

use of org.apache.hyracks.api.exceptions.HyracksDataException in project asterixdb by apache.

the class DatasetPartitionWriter method registerResultPartitionLocation.

void registerResultPartitionLocation(boolean empty) throws HyracksDataException {
    try {
        if (!partitionRegistered) {
            manager.registerResultPartitionLocation(jobId, resultSetId, partition, nPartitions, orderedResult, empty);
            partitionRegistered = true;
        }
    } catch (HyracksException e) {
        if (e instanceof HyracksDataException) {
            throw (HyracksDataException) e;
        } else {
            throw new HyracksDataException(e);
        }
    }
}
Also used : HyracksException(org.apache.hyracks.api.exceptions.HyracksException) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 100 with HyracksDataException

use of org.apache.hyracks.api.exceptions.HyracksDataException in project asterixdb by apache.

the class MiniDFSClusterFactory method getMiniDFSCluster.

public MiniDFSCluster getMiniDFSCluster(Configuration conf, int numberOfNC) throws HyracksDataException {
    try {
        MiniDFSCluster.Builder builder = new MiniDFSCluster.Builder(conf);
        builder.numDataNodes(numberOfNC);
        MiniDFSCluster dfsCluster = builder.build();
        return dfsCluster;
    } catch (Exception e) {
        throw new HyracksDataException(e);
    }
}
Also used : MiniDFSCluster(org.apache.hadoop.hdfs.MiniDFSCluster) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Aggregations

HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)566 IOException (java.io.IOException)209 DataOutput (java.io.DataOutput)96 ArrayBackedValueStorage (org.apache.hyracks.data.std.util.ArrayBackedValueStorage)78 ITupleReference (org.apache.hyracks.dataflow.common.data.accessors.ITupleReference)75 IPointable (org.apache.hyracks.data.std.api.IPointable)73 IFrameTupleReference (org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference)70 TypeMismatchException (org.apache.asterix.runtime.exceptions.TypeMismatchException)67 IScalarEvaluator (org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator)67 VoidPointable (org.apache.hyracks.data.std.primitive.VoidPointable)64 IScalarEvaluatorFactory (org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory)61 IHyracksTaskContext (org.apache.hyracks.api.context.IHyracksTaskContext)60 ArrayList (java.util.ArrayList)57 ACIDException (org.apache.asterix.common.exceptions.ACIDException)56 ISerializerDeserializer (org.apache.hyracks.api.dataflow.value.ISerializerDeserializer)56 ATypeTag (org.apache.asterix.om.types.ATypeTag)39 AsterixException (org.apache.asterix.common.exceptions.AsterixException)36 ArrayTupleBuilder (org.apache.hyracks.dataflow.common.comm.io.ArrayTupleBuilder)32 ByteBuffer (java.nio.ByteBuffer)30 MetadataEntityValueExtractor (org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor)27