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 F06A1200CAD for ; Tue, 6 Jun 2017 06:46:23 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EF703160BE1; Tue, 6 Jun 2017 04:46:23 +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 3F730160BD4 for ; Tue, 6 Jun 2017 06:46:23 +0200 (CEST) Received: (qmail 7504 invoked by uid 500); 6 Jun 2017 04:46:22 -0000 Mailing-List: contact common-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-issues@hadoop.apache.org Received: (qmail 7492 invoked by uid 99); 6 Jun 2017 04:46:21 -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; Tue, 06 Jun 2017 04:46:21 +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 60517182914 for ; Tue, 6 Jun 2017 04:46:21 +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 gpk5XbYNECpA for ; Tue, 6 Jun 2017 04:46:20 +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 B2B5B5F4EE for ; Tue, 6 Jun 2017 04:46:19 +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 EEA9FE0D85 for ; Tue, 6 Jun 2017 04:46:18 +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 4DC5D21E0F for ; Tue, 6 Jun 2017 04:46:18 +0000 (UTC) Date: Tue, 6 Jun 2017 04:46:18 +0000 (UTC) From: "Hongyuan Li (JIRA)" To: common-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (HADOOP-14470) the ternary operator in create method in class CommandWithDestination is redundant MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 06 Jun 2017 04:46:24 -0000 [ https://issues.apache.org/jira/browse/HADOOP-14470?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16= 032293#comment-16032293 ]=20 Hongyuan Li edited comment on HADOOP-14470 at 6/6/17 4:46 AM: -------------------------------------------------------------- ping [~stevel@apache.org]=E3=80=81 [~brahmareddy] =E3=80=81[~yzhangal], Cou= ld you please give me a code review? =20 was (Author: hongyuan li): ping [~stevel@apache.org]=E3=80=81 [~brahmareddy] =E3=80=81[~yzhangal], Cou= ldyou please give me a code review? =20 > the ternary operator in create method in class CommandWithDestination is= redundant > -------------------------------------------------------------------------= ---------- > > Key: HADOOP-14470 > URL: https://issues.apache.org/jira/browse/HADOOP-14470 > Project: Hadoop Common > Issue Type: Improvement > Components: common > Affects Versions: 3.0.0-alpha3 > Reporter: Hongyuan Li > Assignee: Hongyuan Li > Priority: Trivial > Attachments: HADOOP-14470-001.patch > > > in if statement=EF=BC=8Cthe lazyPersist is always true, thus the ternary= operator is redundant=EF=BC=8C > {{lazyPersist =3D=3D true}} in if statment, so {{lazyPersist ? 1 : getDef= aultReplication(item.path)}} is redundant. > related code like below, which is in {{org.apache.hadoop.fs.shell.Comma= ndWithDestination}} lineNumber : 504 : > {code:java} > FSDataOutputStream create(PathData item, boolean lazyPersist, > boolean direct) > throws IOException { > try { > if (lazyPersist) { // in if stament, lazyPersist is always true > =E2=80=A6=E2=80=A6 > return create(item.path, > FsPermission.getFileDefault().applyUMask( > FsPermission.getUMask(getConf())), > createFlags, > getConf().getInt(IO_FILE_BUFFER_SIZE_KEY, > IO_FILE_BUFFER_SIZE_DEFAULT), > lazyPersist ? 1 : getDefaultReplication(item.path= ), // *this is redundant* > getDefaultBlockSize(), > null, > null); > } else { > return create(item.path, true); > } > } finally { // might have been created but stream was interrupted > if (!direct) { > deleteOnExit(item.path); > } > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-issues-help@hadoop.apache.org