if (streams.containsKey(inputName)) { Input.StreamInput streamInput = streams.get(inputName); FormatSpecification formatSpec = streamInput.getBodyFormatSpec(); if (formatSpec != null) { return (JavaPairRDD<K, V>) sec.fromStream(streamInput.getName(),
/** * Sets the {@link StreamEventDecoder} to be used by the InputFormat for the given type. If the * {@link Input.StreamInput} already defined a {@link StreamEventDecoder} or {@link FormatSpecification}, * this method is a no-op. * * @param configuration configuration to update * @param type type for {@link StreamEventData} to decode to * @return the same configuration map as in the argument. */ public Map<String, String> setDecoderType(Map<String, String> configuration, Type type) { if (streamInput.getBodyFormatSpec() == null && streamInput.getDecoderType() == null) { Configuration hConf = new Configuration(); hConf.clear(); AbstractStreamInputFormat.inferDecoderClass(hConf, type); configuration.putAll(ConfigurationUtil.toMap(hConf)); } return configuration; }
@Override public Map<String, String> getInputFormatConfiguration() { try { StreamConfig streamConfig = streamAdmin.getConfig(streamId); Location streamPath = StreamUtils.createGenerationLocation(streamConfig.getLocation(), StreamUtils.getGeneration(streamConfig)); Configuration hConf = new Configuration(); hConf.clear(); AbstractStreamInputFormat.setStreamId(hConf, streamId); AbstractStreamInputFormat.setTTL(hConf, streamConfig.getTTL()); AbstractStreamInputFormat.setStreamPath(hConf, streamPath.toURI()); AbstractStreamInputFormat.setTimeRange(hConf, streamInput.getStartTime(), streamInput.getEndTime()); FormatSpecification formatSpec = streamInput.getBodyFormatSpec(); if (formatSpec != null) { AbstractStreamInputFormat.setBodyFormatSpecification(hConf, formatSpec); } else { String decoderType = streamInput.getDecoderType(); if (decoderType != null) { AbstractStreamInputFormat.setDecoderClassName(hConf, decoderType); } } return ConfigurationUtil.toMap(hConf); } catch (IOException e) { throw Throwables.propagate(e); } } }