beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davor Bonaci (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (BEAM-1491) HDFSFileSource should be able to read the HADOOP_CONF(YARN_CONF) environmen variable
Date Thu, 16 Feb 2017 18:02:41 GMT

    [ https://issues.apache.org/jira/browse/BEAM-1491?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15870402#comment-15870402
] 

Davor Bonaci commented on BEAM-1491:
------------------------------------

Also, [~sisk], [~peihe0@gmail.com] FYI.

> HDFSFileSource should be able to read the HADOOP_CONF(YARN_CONF) environmen variable
> ------------------------------------------------------------------------------------
>
>                 Key: BEAM-1491
>                 URL: https://issues.apache.org/jira/browse/BEAM-1491
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-java-core
>    Affects Versions: 0.5.0
>            Reporter: yangping wu
>            Assignee: Jean-Baptiste Onofré
>
> Currently, if we want to read file store on HDFS, we will do it as follow:
> {code} PCollection<KV<LongWritable, Text>> resultCollection = p.apply(HDFSFileSource.readFrom(
>                 "hdfs://hadoopserver:8020/tmp/data.txt",
>                 TextInputFormat.class, LongWritable.class, Text.class));
> {code}
> As we have seen above, we must be set {{hdfs://hadoopserver:8020}} in the file path,
and we cann't set any variables when read file, because in [HDFSFileSource.java|https://github.com/apache/beam/blob/master/sdks/java/io/hdfs/src/main/java/org/apache/beam/sdk/io/hdfs/HDFSFileSource.java#L310]
we initialize {{job}} instance as follow:
> {code}
> this.job = Job.getInstance();
> {code}
> we should initialize {{job}} instance by configure:
> {code}
> this.job = Job.getInstance(conf);
> {code}
> where {{conf}} is instance of {{Configuration}}, and we initialize {{conf}} by reading
{{HADOOP_CONF}}({{YARN_CONF}}) environmen variable,then we can read HDFS file like this:
> {code} PCollection<KV<LongWritable, Text>> resultCollection = p.apply(HDFSFileSource.readFrom(
>                 "/tmp/data.txt",
>                 TextInputFormat.class, LongWritable.class, Text.class));
> {code}
> note we don't specify {{hdfs://hadoopserver:8020}} prefix, because the program read it
from  {{HADOOP_CONF}}({{YARN_CONF}}) environmen.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message