hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hongyuan Li (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HADOOP-14470) the ternary operator in create method in class CommandWithDestination is redundant
Date Thu, 01 Jun 2017 13:14:04 GMT

     [ https://issues.apache.org/jira/browse/HADOOP-14470?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Hongyuan Li updated HADOOP-14470:
---------------------------------
    Description: 
in if statement,the lazyPersist  is always true, thus the ternary operator is redundant,related
code like below:
{code:java}
   FSDataOutputStream create(PathData item, boolean lazyPersist,
        boolean direct)
        throws IOException {
      try {
        if (lazyPersist) {
      ……
          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}

  was:
in if statement,the lazyPersist  is always true, thus the ternary operator is redundant,related
code like below:
{code:java}
   FSDataOutputStream create(PathData item, boolean lazyPersist,
        boolean direct)
        throws IOException {
      try {
        if (lazyPersist) {
      ……
          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}


> 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
>            Reporter: Hongyuan Li
>            Assignee: Hongyuan Li
>            Priority: Trivial
>         Attachments: HADOOP-14470-001.patch
>
>
> in if statement,the lazyPersist  is always true, thus the ternary operator is redundant,related
code like below:
> {code:java}
>    FSDataOutputStream create(PathData item, boolean lazyPersist,
>         boolean direct)
>         throws IOException {
>       try {
>         if (lazyPersist) {
>       ……
>           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


Mime
View raw message