Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 714A0200C1C for ; Wed, 15 Feb 2017 09:08:46 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 6FF5B160B46; Wed, 15 Feb 2017 08:08:46 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BC1C1160B5E for ; Wed, 15 Feb 2017 09:08:45 +0100 (CET) Received: (qmail 35712 invoked by uid 500); 15 Feb 2017 08:08:45 -0000 Mailing-List: contact commits-help@beam.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@beam.apache.org Delivered-To: mailing list commits@beam.apache.org Received: (qmail 35702 invoked by uid 99); 15 Feb 2017 08:08:45 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Feb 2017 08:08:44 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 95830C04E3 for ; Wed, 15 Feb 2017 08:08:44 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.999 X-Spam-Level: X-Spam-Status: No, score=-1.999 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id C575pxp1hyrw for ; Wed, 15 Feb 2017 08:08:44 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 6F9C85FB49 for ; Wed, 15 Feb 2017 08:08:43 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 234CEE0485 for ; Wed, 15 Feb 2017 08:08:42 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id B25DC2411F for ; Wed, 15 Feb 2017 08:08:41 +0000 (UTC) Date: Wed, 15 Feb 2017 08:08:41 +0000 (UTC) From: "yangping wu (JIRA)" To: commits@beam.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (BEAM-1491) HDFSFileSource should be able to read the HADOOP_CONF(YARN_CONF) environmen variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 15 Feb 2017 08:08:46 -0000 yangping wu created BEAM-1491: --------------------------------- Summary: 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: Davor Bonaci Currently, if we want to read file store on HDFS, we will do it as follow: {code} PCollection> 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> 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)