You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/10/16 06:34:20 UTC

[jira] [Commented] (CARBONDATA-270) [Filter Optimization] double data type value comparison optimization

    [ https://issues.apache.org/jira/browse/CARBONDATA-270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15579452#comment-15579452 ] 

ASF GitHub Bot commented on CARBONDATA-270:
-------------------------------------------

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??


> [Filter Optimization] double data type value comparison optimization
> --------------------------------------------------------------------
>
>                 Key: CARBONDATA-270
>                 URL: https://issues.apache.org/jira/browse/CARBONDATA-270
>             Project: CarbonData
>          Issue Type: Improvement
>          Components: core
>            Reporter: Sujith
>            Assignee: Sujith
>            Priority: Minor
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)