[GitHub] incubator-carbondata pull request #336: [CARBONDATA-426] replace if else wit...

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #336: [CARBONDATA-426] replace if else wit...

qiuchenjian-2
GitHub user PallaviSingh1992 opened a pull request:

    https://github.com/apache/incubator-carbondata/pull/336

    [CARBONDATA-426] replace if else with conditional operator

    Replaced the if-else with Conditional operator.
    Reduced the number of variables used.
    Reduced the boiler plating by removing redundant conditional checks.
   
   


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/PallaviSingh1992/incubator-carbondata feature/codeReadability

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-carbondata/pull/336.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #336
   
----
commit 9e96073c9ac020d49ca031ecb04fc0697efb7476
Author: PallaviSingh1992 <[hidden email]>
Date:   2016-11-18T09:58:26Z

    replaced if else with conditional operator

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata issue #336: [CARBONDATA-426] replace if else with condi...

qiuchenjian-2
Github user sujith71955 commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/336
 
    Please rebase the code


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #336: [CARBONDATA-426] replace if else wit...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user sujith71955 commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/336#discussion_r90511807
 
    --- Diff: integration/spark/src/main/java/org/apache/carbondata/integration/spark/merger/CarbonCompactionUtil.java ---
    @@ -198,21 +183,16 @@ public static CompactionType determineCompactionType(String metaFolderPath) {
        * @return
        */
       public static boolean deleteCompactionRequiredFile(String metaFolderPath,
    -      CompactionType compactionType) {
    -    String compactionRequiredFile;
    -    if (compactionType.equals(CompactionType.MINOR_COMPACTION)) {
    -      compactionRequiredFile = metaFolderPath + CarbonCommonConstants.FILE_SEPARATOR
    -          + CarbonCommonConstants.minorCompactionRequiredFile;
    -    } else {
    -      compactionRequiredFile = metaFolderPath + CarbonCommonConstants.FILE_SEPARATOR
    -          + CarbonCommonConstants.majorCompactionRequiredFile;
    -    }
    +                                                     CompactionType compactionType) {
    +    String file = metaFolderPath + CarbonCommonConstants.FILE_SEPARATOR;
    +    String compactionRequiredFile = compactionType.equals(CompactionType.MINOR_COMPACTION) ?
    --- End diff --
   
    Enum comparison better to use ==


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #336: [CARBONDATA-426] replace if else wit...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user PallaviSingh1992 commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/336#discussion_r90590085
 
    --- Diff: integration/spark-common/src/main/java/org/apache/carbondata/spark/merger/CarbonCompactionUtil.java ---
    @@ -142,20 +142,14 @@ private static void groupCorrespodingInfoBasedOnTask(TableBlockInfo info,
        * @return
        */
       public static boolean isCompactionRequiredForTable(String metaFolderPath) {
    -    String minorCompactionStatusFile = metaFolderPath + CarbonCommonConstants.FILE_SEPARATOR
    -        + CarbonCommonConstants.minorCompactionRequiredFile;
    -
    -    String majorCompactionStatusFile = metaFolderPath + CarbonCommonConstants.FILE_SEPARATOR
    -        + CarbonCommonConstants.majorCompactionRequiredFile;
    +    String statusFile = metaFolderPath + CarbonCommonConstants.FILE_SEPARATOR;
         try {
    -      if (FileFactory.isFileExist(minorCompactionStatusFile,
    -          FileFactory.getFileType(minorCompactionStatusFile)) || FileFactory
    -          .isFileExist(majorCompactionStatusFile,
    -              FileFactory.getFileType(majorCompactionStatusFile))) {
    -        return true;
    -      }
    +      return (FileFactory.isFileExist(statusFile + CarbonCommonConstants.minorCompactionRequiredFile,
    --- End diff --
   
    I will revert back to original code


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata issue #336: [CARBONDATA-426] replace if else with condi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/336
 
    Can one of the admins verify this patch?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #336: [CARBONDATA-426] replace if else wit...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/336#discussion_r92122165
 
    --- Diff: integration/spark-common/src/main/java/org/apache/carbondata/spark/merger/CarbonCompactionUtil.java ---
    @@ -142,20 +142,15 @@ private static void groupCorrespodingInfoBasedOnTask(TableBlockInfo info,
        * @return
        */
       public static boolean isCompactionRequiredForTable(String metaFolderPath) {
    -    String minorCompactionStatusFile = metaFolderPath + CarbonCommonConstants.FILE_SEPARATOR
    -        + CarbonCommonConstants.minorCompactionRequiredFile;
    -
    -    String majorCompactionStatusFile = metaFolderPath + CarbonCommonConstants.FILE_SEPARATOR
    -        + CarbonCommonConstants.majorCompactionRequiredFile;
    +    String statusFile = metaFolderPath + CarbonCommonConstants.FILE_SEPARATOR;
         try {
    -      if (FileFactory.isFileExist(minorCompactionStatusFile,
    -          FileFactory.getFileType(minorCompactionStatusFile)) || FileFactory
    -          .isFileExist(majorCompactionStatusFile,
    -              FileFactory.getFileType(majorCompactionStatusFile))) {
    +      if (FileFactory.isFileExist(statusFile + CarbonCommonConstants.minorCompactionRequiredFile,
    +          FileFactory.getFileType(statusFile + CarbonCommonConstants.minorCompactionRequiredFile))
    --- End diff --
   
    indentation is wrong, should add two space here


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata issue #336: [CARBONDATA-426] replace if else with condi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/336
 
    Build Failed  with Spark 1.5.2, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/154/



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata issue #336: [CARBONDATA-426] replace if else with condi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/336
 
    Build Failed  with Spark 1.5.2, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/156/



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #336: [CARBONDATA-426] replace if else wit...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user PallaviSingh1992 commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/336#discussion_r92158292
 
    --- Diff: integration/spark-common/src/main/java/org/apache/carbondata/spark/merger/CarbonCompactionUtil.java ---
    @@ -142,20 +142,15 @@ private static void groupCorrespodingInfoBasedOnTask(TableBlockInfo info,
        * @return
        */
       public static boolean isCompactionRequiredForTable(String metaFolderPath) {
    -    String minorCompactionStatusFile = metaFolderPath + CarbonCommonConstants.FILE_SEPARATOR
    -        + CarbonCommonConstants.minorCompactionRequiredFile;
    -
    -    String majorCompactionStatusFile = metaFolderPath + CarbonCommonConstants.FILE_SEPARATOR
    -        + CarbonCommonConstants.majorCompactionRequiredFile;
    +    String statusFile = metaFolderPath + CarbonCommonConstants.FILE_SEPARATOR;
         try {
    -      if (FileFactory.isFileExist(minorCompactionStatusFile,
    -          FileFactory.getFileType(minorCompactionStatusFile)) || FileFactory
    -          .isFileExist(majorCompactionStatusFile,
    -              FileFactory.getFileType(majorCompactionStatusFile))) {
    +      if (FileFactory.isFileExist(statusFile + CarbonCommonConstants.minorCompactionRequiredFile,
    +          FileFactory.getFileType(statusFile + CarbonCommonConstants.minorCompactionRequiredFile))
    --- End diff --
   
    Used java-code-format-template.xml provided in the dev folder to format the code


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata issue #336: [CARBONDATA-426] replace if else with condi...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/336
 
    Build Success with Spark 1.5.2, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/157/



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #336: [CARBONDATA-426] replace if else wit...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user PallaviSingh1992 closed the pull request at:

    https://github.com/apache/incubator-carbondata/pull/336


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [hidden email] or file a JIRA ticket
with INFRA.
---