[
https://issues.apache.org/jira/browse/FLINK-1396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14305921#comment-14305921
]
ASF GitHub Bot commented on FLINK-1396:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/363#discussion_r24118164
--- Diff:
flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java ---
@@ -458,6 +461,67 @@ public CsvReader readCsvFile(String filePath) {
return new DataSource<X>(this, inputFormat, producedType,
Utils.getCallLocationName());
}
+
+ // ----------------------------------- Hadoop Input Format
---------------------------------------
+
+ /**
+ * Creates a {@link DataSet} from the given {@link
org.apache.hadoop.mapred.FileInputFormat}. The
+ * given inputName is set on the given job.
+ */
+ public <K,V> DataSource<Tuple2<K, V>>
readHadoopFile(org.apache.hadoop.mapred.FileInputFormat<K,V> mapredInputFormat,
Class<K> key, Class<V> value, String inputPath, JobConf job) {
+ DataSource<Tuple2<K, V>> result =
createHadoopInput(mapredInputFormat, key, value, job);
+
+ org.apache.hadoop.mapred.FileInputFormat.addInputPath(job, new
org.apache.hadoop.fs.Path(inputPath));
+
+ return result;
+ }
+
+ /**
+ * Creates a {@link DataSet} from the given {@link
org.apache.hadoop.mapred.FileInputFormat}. A
+ * {@link org.apache.hadoop.mapred.JobConf} with the given inputPath is
created.
+ */
+ public <K,V> DataSource<Tuple2<K, V>>
readHadoopFile(org.apache.hadoop.mapred.FileInputFormat<K,V> mapredInputFormat,
Class<K> key, Class<V> value, String inputPath) {
+ return readHadoopFile(mapredInputFormat, key, value, inputPath,
new JobConf());
+ }
+
+ /**
+ * Creates a {@link DataSet} from the given {@link
org.apache.hadoop.mapred.InputFormat}.
+ */
+ public <K,V> DataSource<Tuple2<K, V>>
createHadoopInput(org.apache.hadoop.mapred.InputFormat<K,V> mapredInputFormat,
Class<K> key, Class<V> value, JobConf job) {
--- End diff --
Why no "shortcut" without `JobConf`?
> Add hadoop input formats directly to the user API.
> --------------------------------------------------
>
> Key: FLINK-1396
> URL: https://issues.apache.org/jira/browse/FLINK-1396
> Project: Flink
> Issue Type: Bug
> Reporter: Robert Metzger
> Assignee: Aljoscha Krettek
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)