0

I have the sequence file with key as text and value as custom data type.

But Spark streaming is unable to read data from the sequence file.

JavaPairInputDStream<Text, CustomDataType> myRDD =
        jssc.fileStream(path, Text.class, CustomDataType.class, SequenceFileInputFormat.class,
            new Function<Path, Boolean>() {
          @Override
          public Boolean call(Path v1) throws Exception {
            return Boolean.TRUE;
          }
        }, false);

Following is the syntax error from IDE.

Bound mismatch: The generic method fileStream(String, Class<K>, Class<V>, Class<F>, Function<Path,Boolean>, boolean) of type JavaStreamingContext is not applicable for the arguments (String, Class<Text>, Class<DeltaCounter>, Class<SequenceFileInputFormat>, new Function<Path,Boolean>(){}, boolean). The inferred type SequenceFileInputFormat is not a valid substitute for the bounded parameter <F extends InputFormat<K,V>>

How to read sequence file in Spark streaming?

1 Answer 1

1

You need to use a correct package in imports. You are probably importing the old org.apache.hadoop.mapred. Use this code:

import org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.