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 3CD06200C5D for ; Fri, 24 Mar 2017 01:00:51 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 3B43A160B95; Fri, 24 Mar 2017 00:00:51 +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 891E5160B83 for ; Fri, 24 Mar 2017 01:00:50 +0100 (CET) Received: (qmail 31763 invoked by uid 500); 24 Mar 2017 00:00:49 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 31748 invoked by uid 99); 24 Mar 2017 00:00:49 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Mar 2017 00:00:49 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id E4EA618049D for ; Fri, 24 Mar 2017 00:00:48 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id esE6OXVSO4B9 for ; Fri, 24 Mar 2017 00:00:48 +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 49F415FCBA for ; Fri, 24 Mar 2017 00:00:47 +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 6FFE1E06D0 for ; Fri, 24 Mar 2017 00:00:45 +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 BA96621DE0 for ; Fri, 24 Mar 2017 00:00:44 +0000 (UTC) Date: Fri, 24 Mar 2017 00:00:44 +0000 (UTC) From: "Andrew Wang (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HDFS-11170) Add create API in filesystem public class to support assign parameter through builder MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 24 Mar 2017 00:00:51 -0000 [ https://issues.apache.org/jira/browse/HDFS-11170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15939458#comment-15939458 ] Andrew Wang commented on HDFS-11170: ------------------------------------ Hi Sammi, thanks for the rev! bq. The reason I think is that leave the setDefaultValue right before the create call to save the unnecessary default value assignment if API caller will call the specific setter to set the value. I don't think this causes any additional assignment, since the getters are only called once (at {{build}} time), and inline the same if statements as what's in {{setDefaultValue}}. My sample code looked like this: {code} protected int getBufferSize() { if (bufferSize == null) { return fs.getConf().getInt(IO_FILE_BUFFER_SIZE_KEY, IO_FILE_BUFFER_SIZE_DEFAULT); } return bufferSize; } {code} Returning directly might also be a bit more efficient by not calling the setter (current setDefaultValue behavior). bq. From the point that unit tests as example code, would it be better to keep a distinct test function, so user can easily find it by refer to the function name? Also, I went through the test function name list of TestDistributedFileSystem, all function name carries their target clearly. Sure, it's okay to leave it as is. I agree that this is easier to find and a good standalone example. > Add create API in filesystem public class to support assign parameter through builder > ------------------------------------------------------------------------------------- > > Key: HDFS-11170 > URL: https://issues.apache.org/jira/browse/HDFS-11170 > Project: Hadoop HDFS > Issue Type: Improvement > Reporter: SammiChen > Assignee: Wei Zhou > Labels: hdfs-ec-3.0-nice-to-have > Attachments: HDFS-11170-00.patch, HDFS-11170-01.patch, HDFS-11170-02.patch, HDFS-11170-03.patch, HDFS-11170-04.patch, HDFS-11170-05.patch, HDFS-11170-06.patch, HDFS-11170-07.patch > > > FileSystem class supports multiple create functions to help user create file. Some create functions has many parameters, it's hard for user to exactly remember these parameters and their orders. This task is to add builder based create functions to help user more easily create file. -- This message was sent by Atlassian JIRA (v6.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org