You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@carbondata.apache.org by sujith71955 <gi...@git.apache.org> on 2016/09/23 07:22:07 UTC

[GitHub] incubator-carbondata pull request #194: [CARBONDATA-270] Double data type va...

GitHub user sujith71955 opened a pull request:

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

    [CARBONDATA-270] Double data type value comparison optimization

    [Description] Double data type value comparison optimization,EqualsToExpression evaluation for double values first check for the equality of nan values and then the double value comparison happens, since nan comparison scenarios are rare we can push the comparison of nan after the double value comparison.
    
    Already present UT testcases can verify the feature modification impact.

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

    $ git pull https://github.com/sujith71955/incubator-carbondata master_doubleCmprOptimizations

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

    https://github.com/apache/incubator-carbondata/pull/194.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 #194
    
----
commit f6770ee14f737911071ba94252089587efb3c6d4
Author: sujith71955 <su...@gmail.com>
Date:   2016-09-23T07:07:12Z

    [Issue Number] CARBONDATA-270]
    [Description] Double data type value comparison optimization,EqualsToExpression evaluation for double values first check for the equality of nan values and then the double value comparison happens, since nan comparison scenarios are rare we can push the comparison of nan after the double value comparison.

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #194: [CARBONDATA-270] Double data type va...

Posted by ManoharVanam <gi...@git.apache.org>.
Github user ManoharVanam commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/194#discussion_r80212063
  
    --- Diff: core/src/main/java/org/apache/carbondata/scan/filter/FilterUtil.java ---
    @@ -1401,8 +1401,7 @@ public static void logError(Throwable e, boolean invalidRowsPresent) {
       public static boolean nanSafeEqualsDoubles(Double d1, Double d2) {
         Boolean xIsNan = Double.isNaN(d1);
         Boolean yIsNan = Double.isNaN(d2);
    -    if ((xIsNan && yIsNan) || (d1.doubleValue() == d2.doubleValue())) {
    -
    +    if ((d1.doubleValue() == d2.doubleValue()) || (xIsNan && yIsNan)) {
    --- End diff --
    
    I think we can use Double.compare instead of these two checks


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata issue #194: [CARBONDATA-270] Double data type value com...

Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/194
  
    retest this please


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #194: [CARBONDATA-270] Double data type va...

Posted by kumarvishal09 <gi...@git.apache.org>.
Github user kumarvishal09 commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/194#discussion_r83546209
  
    --- Diff: core/src/main/java/org/apache/carbondata/scan/filter/FilterUtil.java ---
    @@ -1426,4 +1423,25 @@ private static void getUnknownExpressionsList(Expression expression,
           getUnknownExpressionsList(child, lst);
         }
       }
    +  /**
    +   * This method will compare double values it will preserve
    +   * the -0.0 and 0.0 equality as per == ,also preserve NaN equality check as per
    +   * java.lang.Double.equals()
    +   *
    +   * @param d1 double value for equality check
    +   * @param d2 double value for equality check
    +   * @return boolean after comparing two double values.
    +   */
    +  public static int compare(Double d1, Double d2) {
    --- End diff --
    
    Move this method to DataTypeUtil as it can be used from multiple places and change the method name to compareDouble


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata issue #194: [CARBONDATA-270] Double data type value com...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

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



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #194: [CARBONDATA-270] Double data type va...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

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


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #194: [CARBONDATA-270] Double data type va...

Posted by gvramana <gi...@git.apache.org>.
Github user gvramana commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/194#discussion_r80221140
  
    --- Diff: core/src/main/java/org/apache/carbondata/scan/filter/FilterUtil.java ---
    @@ -1401,8 +1401,7 @@ public static void logError(Throwable e, boolean invalidRowsPresent) {
       public static boolean nanSafeEqualsDoubles(Double d1, Double d2) {
         Boolean xIsNan = Double.isNaN(d1);
         Boolean yIsNan = Double.isNaN(d2);
    -    if ((xIsNan && yIsNan) || (d1.doubleValue() == d2.doubleValue())) {
    -
    +    if ((d1.doubleValue() == d2.doubleValue()) || (xIsNan && yIsNan)) {
    --- End diff --
    
     Boolean xIsNan = Double.isNaN(d1); these variables are already computed, no use of moving them. Instead use ( Double.isNaN(d1) && Double.isNaN(d2))


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #194: [CARBONDATA-270] Double data type va...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/194#discussion_r90466152
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/util/DataTypeUtil.java ---
    @@ -411,4 +411,24 @@ private static String parseStringToBigDecimal(String value, CarbonDimension dime
         }
         return null;
       }
    +  /**
    +   * This method will compare double values it will preserve
    +   * the -0.0 and 0.0 equality as per == ,also preserve NaN equality check as per
    +   * java.lang.Double.equals()
    +   *
    +   * @param d1 double value for equality check
    +   * @param d2 double value for equality check
    +   * @return boolean after comparing two double values.
    +   */
    +  public static int compareDoubleWithNan(Double d1, Double d2) {
    +    if ((d1.doubleValue() == d2.doubleValue()) || (Double.isNaN(d1) && Double.isNaN(d2))) {
    +      return 0;
    +    }
    +    else if (d1 < d2) {
    --- End diff --
    
    move to previous line


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata issue #194: [CARBONDATA-270] Double data type value com...

Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/194
  
    Build Failed, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #194: [CARBONDATA-270] Double data type va...

Posted by kumarvishal09 <gi...@git.apache.org>.
Github user kumarvishal09 commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/194#discussion_r83546183
  
    --- Diff: core/src/main/java/org/apache/carbondata/scan/filter/FilterUtil.java ---
    @@ -1426,4 +1423,25 @@ private static void getUnknownExpressionsList(Expression expression,
           getUnknownExpressionsList(child, lst);
         }
       }
    +  /**
    +   * This method will compare double values it will preserve
    +   * the -0.0 and 0.0 equality as per == ,also preserve NaN equality check as per
    +   * java.lang.Double.equals()
    +   *
    +   * @param d1 double value for equality check
    +   * @param d2 double value for equality check
    +   * @return boolean after comparing two double values.
    +   */
    +  public static int compare(Double d1, Double d2) {
    +    if ((d1.doubleValue() == d2.doubleValue()) || (Double.isNaN(d1) && Double.isNaN(d2))) {
    +      return 0;
    +    }
    +    if (d1 < d2) {
    --- End diff --
    
    can't we add else if and else why three if condition is required??


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata issue #194: [CARBONDATA-270] Double data type value com...

Posted by sujith71955 <gi...@git.apache.org>.
Github user sujith71955 commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/194
  
    PR build status
    http://136.243.101.176:8080/job/ApacheCarbonManualPRBuilder/733


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata issue #194: [CARBONDATA-270] Double data type value com...

Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/194
  
    LGTM


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #194: [CARBONDATA-270] Double data type va...

Posted by sujith71955 <gi...@git.apache.org>.
Github user sujith71955 commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/194#discussion_r83546963
  
    --- Diff: core/src/main/java/org/apache/carbondata/scan/filter/FilterUtil.java ---
    @@ -1426,4 +1423,25 @@ private static void getUnknownExpressionsList(Expression expression,
           getUnknownExpressionsList(child, lst);
         }
       }
    +  /**
    +   * This method will compare double values it will preserve
    +   * the -0.0 and 0.0 equality as per == ,also preserve NaN equality check as per
    +   * java.lang.Double.equals()
    +   *
    +   * @param d1 double value for equality check
    +   * @param d2 double value for equality check
    +   * @return boolean after comparing two double values.
    +   */
    +  public static int compare(Double d1, Double d2) {
    +    if ((d1.doubleValue() == d2.doubleValue()) || (Double.isNaN(d1) && Double.isNaN(d2))) {
    +      return 0;
    +    }
    +    if (d1 < d2) {
    --- End diff --
    
    since we are returning once any condition matches i think both if or if else makes no difference in this context.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #194: [CARBONDATA-270] Double data type va...

Posted by sujith71955 <gi...@git.apache.org>.
Github user sujith71955 commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/194#discussion_r80221578
  
    --- Diff: core/src/main/java/org/apache/carbondata/scan/filter/FilterUtil.java ---
    @@ -1401,8 +1401,7 @@ public static void logError(Throwable e, boolean invalidRowsPresent) {
       public static boolean nanSafeEqualsDoubles(Double d1, Double d2) {
         Boolean xIsNan = Double.isNaN(d1);
         Boolean yIsNan = Double.isNaN(d2);
    -    if ((xIsNan && yIsNan) || (d1.doubleValue() == d2.doubleValue())) {
    -
    +    if ((d1.doubleValue() == d2.doubleValue()) || (xIsNan && yIsNan)) {
    --- End diff --
    
    yes ramana, right, i will fix it


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #194: [CARBONDATA-270] Double data type va...

Posted by sujith71955 <gi...@git.apache.org>.
Github user sujith71955 commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/194#discussion_r90505720
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/util/DataTypeUtil.java ---
    @@ -411,4 +411,24 @@ private static String parseStringToBigDecimal(String value, CarbonDimension dime
         }
         return null;
       }
    +  /**
    +   * This method will compare double values it will preserve
    +   * the -0.0 and 0.0 equality as per == ,also preserve NaN equality check as per
    +   * java.lang.Double.equals()
    +   *
    +   * @param d1 double value for equality check
    +   * @param d2 double value for equality check
    +   * @return boolean after comparing two double values.
    +   */
    +  public static int compareDoubleWithNan(Double d1, Double d2) {
    +    if ((d1.doubleValue() == d2.doubleValue()) || (Double.isNaN(d1) && Double.isNaN(d2))) {
    +      return 0;
    +    }
    +    else if (d1 < d2) {
    +      return -1;
    +    }
    +    else  {
    --- End diff --
    
    yes, i think we can remove the  unnecessary else  statement itself.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #194: [CARBONDATA-270] Double data type va...

Posted by sujith71955 <gi...@git.apache.org>.
Github user sujith71955 commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/194#discussion_r83547082
  
    --- Diff: core/src/main/java/org/apache/carbondata/scan/filter/FilterUtil.java ---
    @@ -1426,4 +1423,25 @@ private static void getUnknownExpressionsList(Expression expression,
           getUnknownExpressionsList(child, lst);
         }
       }
    +  /**
    +   * This method will compare double values it will preserve
    +   * the -0.0 and 0.0 equality as per == ,also preserve NaN equality check as per
    +   * java.lang.Double.equals()
    +   *
    +   * @param d1 double value for equality check
    +   * @param d2 double value for equality check
    +   * @return boolean after comparing two double values.
    +   */
    +  public static int compare(Double d1, Double d2) {
    +    if ((d1.doubleValue() == d2.doubleValue()) || (Double.isNaN(d1) && Double.isNaN(d2))) {
    +      return 0;
    +    }
    +    if (d1 < d2) {
    --- End diff --
    
    one condition we can save in else, its fine i will update as per your comments. Thanks for reviewing.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata issue #194: [CARBONDATA-270] Double data type value com...

Posted by kumarvishal09 <gi...@git.apache.org>.
Github user kumarvishal09 commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/194
  
    LGTM


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---