K - Key type of inputV - Value type of inputpublic class StreamInputFormat<K,V> extends InputFormat<K,V>
[streamName]/[partitionName]/[bucketName].[dat|idx]
OR
[streamName]/[generation]/[partitionName]/[bucketName].[dat|idx]
Where .dat is the event data file, .idx is the accompany index file.
generation is an integer, representing the stream generation of the data under it. When a stream
is truncated, the generation increment by one. The generation 0 is a special case that there is
no generation directory.
partitionName is formatted as
[partitionStartTime].[duration]with both
partitionStartTime and duration in seconds.
bucketName is formatted as
[prefix].[seqNo]The
seqNo is a strictly increasing integer for the same prefix starting with 0.| Constructor and Description |
|---|
StreamInputFormat() |
| Modifier and Type | Method and Description |
|---|---|
RecordReader<K,V> |
createRecordReader(InputSplit split,
TaskAttemptContext context) |
protected co.cask.cdap.api.stream.StreamEventDecoder<K,V> |
createStreamEventDecoder(Configuration conf) |
protected long |
getCurrentTime() |
static Class<? extends co.cask.cdap.api.stream.StreamEventDecoder> |
getDecoderClass(Configuration conf)
Returns the
StreamEventDecoder class as specified in the job configuration. |
List<InputSplit> |
getSplits(JobContext context) |
static void |
inferDecoderClass(Configuration conf,
Type vClass)
Tries to set the
DECODER_TYPE depending upon the supplied value class |
static void |
setBodyFormatSpecification(Configuration conf,
co.cask.cdap.api.data.format.FormatSpecification formatSpecification)
Set the format specification for reading the body of stream events.
|
static void |
setDecoderClassName(Configuration conf,
String decoderClassName)
Sets the class name for the
StreamEventDecoder. |
static void |
setMaxSplitSize(Configuration conf,
long maxSplits)
Sets the maximum split size.
|
static void |
setMinSplitSize(Configuration conf,
long minSplits)
Sets the minimum split size.
|
static void |
setStreamPath(Configuration conf,
URI path)
Sets the base path to stream files.
|
static void |
setTimeRange(Configuration conf,
long startTime,
long endTime)
Sets the time range for the stream events.
|
static void |
setTTL(Configuration conf,
long ttl)
Sets the TTL for the stream events.
|
public static void setTTL(Configuration conf, long ttl)
conf - The configuration to modifyttl - TTL of the stream in milliseconds.public static void setTimeRange(Configuration conf, long startTime, long endTime)
conf - The configuration to modifystartTime - Timestamp in milliseconds of the event start time (inclusive).endTime - Timestamp in milliseconds of the event end time (exclusive).public static void setStreamPath(Configuration conf, URI path)
conf - The conf to modify.path - The file path to stream base directory.public static void setMaxSplitSize(Configuration conf, long maxSplits)
conf - The conf to modify.maxSplits - Maximum split size in bytes.public static void setMinSplitSize(Configuration conf, long minSplits)
conf - The conf to modify.minSplits - Minimum split size in bytes.public static void setDecoderClassName(Configuration conf, String decoderClassName)
StreamEventDecoder.conf - The conf to modify.decoderClassName - Class name of the decoder classpublic static Class<? extends co.cask.cdap.api.stream.StreamEventDecoder> getDecoderClass(Configuration conf)
StreamEventDecoder class as specified in the job configuration.conf - The job configurationStreamEventDecoder class or null if it is not set.public static void setBodyFormatSpecification(Configuration conf, co.cask.cdap.api.data.format.FormatSpecification formatSpecification)
conf - The job configuration.formatSpecification - Format specification for reading the body of stream events.public static void inferDecoderClass(Configuration conf, Type vClass)
DECODER_TYPE depending upon the supplied value classconf - the conf to modifyvClass - the value class Typepublic List<InputSplit> getSplits(JobContext context) throws IOException, InterruptedException
getSplits in class InputFormat<K,V>IOExceptionInterruptedExceptionpublic RecordReader<K,V> createRecordReader(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException
createRecordReader in class InputFormat<K,V>IOExceptionInterruptedExceptionprotected long getCurrentTime()
protected co.cask.cdap.api.stream.StreamEventDecoder<K,V> createStreamEventDecoder(Configuration conf)
Copyright © 2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.