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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

Akash R Nilugal (Jira)

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

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

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.


> [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)