You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Oleg Zinoviev (JIRA)" <ji...@apache.org> on 2018/10/31 10:57:00 UTC

[jira] [Commented] (DRILL-6722) Query from parquet with case-then and arithmetic operation returns a wrong result

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

Oleg Zinoviev commented on DRILL-6722:
--------------------------------------

[~shuifeng], thanks for your comment.

This is generated class file before ValueHolderReplacementVisitor call:
 [^JaininoJava.class] 
This is generated class file after ValueHolderReplacementVisitor call: 
[^JaininoJava2_merged.class] 

Decompiled code of doEval method:

{code:java}
 boolean var3 = false;
        boolean var4 = false;
        int var27 = this.vv1.getAccessor().get(inIndex);
        boolean var5 = false;
        int var28 = this.vv5.getAccessor().get(inIndex);
        boolean var6 = false;
        boolean var7 = false;
        if (!Double.isNaN((double)var28) && (!Double.isNaN((double)var27) || !Double.isNaN((double)var28))) {
            if (Double.isNaN((double)var27) && !Double.isNaN((double)var28)) {
                var7 = true;
            } else {
                var7 = var27 > var28;
            }
        } else {
            var7 = false;
        }

        int var26;
        if (var7) {
            var26 = var27;
        } else {
            var26 = var28;
        }

        this.vv10.getMutator().set(outIndex, var26);
        boolean var8 = false;
        boolean var9 = false;
        int var29 = var26 - var26; // << Error reason. Bug somewhere in ValueHolderReplacementVisitor.
        boolean var10 = false;
        boolean var11 = false;
        int var30 = Math.abs(var29);
        this.vv15.getMutator().set(outIndex, var30);
{code}


> Query from parquet with case-then and arithmetic operation returns a wrong result
> ---------------------------------------------------------------------------------
>
>                 Key: DRILL-6722
>                 URL: https://issues.apache.org/jira/browse/DRILL-6722
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Execution - Codegen
>    Affects Versions: 1.14.0
>            Reporter: Oleg Zinoviev
>            Priority: Major
>         Attachments: JaininoJava.class, JaininoJava2_merged.class, correct.csv, result.csv
>
>
> Steps to reproduce:
> 1) Create sample table:
> {code:sql}
> create table dfs.tmp.test as 
>   select 1 as a, 2 as b
>   union all
>   select 3 as a, 2 as b
>   union all
>   select 1 as a, 4 as b
>   union all
>   select 2 as a, 2 as b
> {code}
> 2)  Execute query:
> {code:sql}
> select
>   case when s.a > s.b then s.a else s.b end as b, 
>   abs(s.a - s.b) as d
> from dfs.tmp.test s
> {code}
> 3) Drill returns:  [^result.csv] 
> 4) Result of query without parquet:
> {code:sql}
> select 
> 	case when s.a > s.b then s.a else s.b end as b, 
> 	abs(s.a - s.b) as d
> from (
> 	select 1 as a, 2 as b
> 	union all
> 	select 3 as a, 2 as b
> 	union all
> 	select 1 as a, 4 as b
> 	union all
> 	select 2 as a, 2 as b
> ) s
> {code}
>  [^correct.csv] 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)