Search in sources :

Example 6 with HyracksDataException

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

the class HDFSLookupReaderFactory method configure.

@Override
public void configure(IServiceContext serviceCtx, Map<String, String> configuration) throws AsterixException {
    this.serviceCtx = serviceCtx;
    this.configuration = configuration;
    JobConf conf = HDFSUtils.configureHDFSJobConf(configuration);
    try {
        confFactory = new ConfFactory(conf);
    } catch (HyracksDataException e) {
        throw new AsterixException(e);
    }
}
Also used : ConfFactory(org.apache.hyracks.hdfs.dataflow.ConfFactory) AsterixException(org.apache.asterix.common.exceptions.AsterixException) JobConf(org.apache.hadoop.mapred.JobConf) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 7 with HyracksDataException

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

the class StreamDataFlowController method start.

@Override
public void start(IFrameWriter writer) throws HyracksDataException {
    try {
        ArrayTupleBuilder tb = new ArrayTupleBuilder(1);
        tupleForwarder.initialize(ctx, writer);
        while (true) {
            tb.reset();
            if (!dataParser.parse(tb.getDataOutput())) {
                break;
            }
            tb.addFieldEndOffset();
            tupleForwarder.addTuple(tb);
        }
        tupleForwarder.close();
    } catch (Exception e) {
        throw new HyracksDataException(e);
    }
}
Also used : ArrayTupleBuilder(org.apache.hyracks.dataflow.common.comm.io.ArrayTupleBuilder) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 8 with HyracksDataException

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

the class StreamRecordReaderFactory method createRecordReader.

@Override
public IRecordReader<? extends char[]> createRecordReader(IHyracksTaskContext ctx, int partition) throws HyracksDataException {
    try {
        StreamRecordReader streamRecordReader = (StreamRecordReader) recordReaderClazz.getConstructor().newInstance();
        streamRecordReader.configure(streamFactory.createInputStream(ctx, partition), configuration);
        return streamRecordReader;
    } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
        throw new HyracksDataException(e);
    }
}
Also used : InvocationTargetException(java.lang.reflect.InvocationTargetException) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 9 with HyracksDataException

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

the class TwitterPullRecordReader method next.

@Override
public IRawRecord<String> next() throws IOException, InterruptedException {
    if (result == null || nextTweetIndex >= result.getTweets().size()) {
        Thread.sleep(1000 * requestInterval);
        query.setSinceId(lastTweetIdReceived);
        try {
            result = twitter.search(query);
        } catch (TwitterException e) {
            throw new HyracksDataException(e);
        }
        nextTweetIndex = 0;
    }
    if (result != null && !result.getTweets().isEmpty()) {
        List<Status> tw = result.getTweets();
        Status tweet = tw.get(nextTweetIndex++);
        if (lastTweetIdReceived < tweet.getId()) {
            lastTweetIdReceived = tweet.getId();
        }
        // transform tweet obj to json
        String jsonTweet = TwitterObjectFactory.getRawJSON(tweet);
        record.set(jsonTweet);
        return record;
    } else {
        return null;
    }
}
Also used : Status(twitter4j.Status) TwitterException(twitter4j.TwitterException) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 10 with HyracksDataException

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

the class FrameSpiller method open.

public void open() throws HyracksDataException {
    try {
        this.currentWriteFile = StoragePathUtil.createFile(fileNamePrefix, fileCount++);
        this.currentReadFile = currentWriteFile;
        this.bos = new BufferedOutputStream(new FileOutputStream(currentWriteFile));
        this.bis = new BufferedInputStream(new FileInputStream(currentReadFile));
    } catch (Exception e) {
        LOGGER.fatal("Unable to create spill file", e);
        throw new HyracksDataException(e);
    }
}
Also used : BufferedInputStream(java.io.BufferedInputStream) FileOutputStream(java.io.FileOutputStream) BufferedOutputStream(java.io.BufferedOutputStream) FileInputStream(java.io.FileInputStream) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) IOException(java.io.IOException) 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