You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by "Jinfeng Ni (JIRA)" <ji...@apache.org> on 2013/11/06 22:50:17 UTC

[jira] [Commented] (DRILL-278) Join predicate with CHAR types hit run-time error

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

Jinfeng Ni commented on DRILL-278:
----------------------------------

[Analysis] : The cause of the problem is in CodeGenerator. When MergeJoinBatch generate the code for method doCompareNextLeftKey, it directly uses the ValueHolder's value field. This works fine for type like int, big int, float, etc. But for Char type, the code processes it as VarBinaryHolder.  The CodeGenerator should generate different code to process Char type comparison.  

[Solution]:  Change the code of code generating part in MergeJoinBatch for doCompareNextLeftKey. Follow the way doCompare does the job. 

> Join predicate with CHAR types hit run-time error 
> --------------------------------------------------
>
>                 Key: DRILL-278
>                 URL: https://issues.apache.org/jira/browse/DRILL-278
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Jinfeng Ni
>            Assignee: Jinfeng Ni
>            Priority: Minor
>
> If we join two tables with = predicate on two CHAR columns, drill will fail.
> SELECT S.S_ACCTBAL, S.S_NAME, N.N_NAME
> FROM
>  ( SELECT CAST(_MAP['S_ACCTBAL'] AS numeric) AS S_ACCTBAL,
>          CAST(_MAP['S_NAME'] AS VARCHAR) AS S_NAME,
>               _MAP['S_SUPPKEY'] AS S_SUPPKEY
>    FROM "/Users/jni//work/tpc-h-parquet/supplier") S
> join
>  ( SELECT  CAST(_MAP['N_NAME'] AS VARCHAR) AS N_NAME,
>            _MAP['N_NATIONKEY'] AS N_NATIONKEY
>    FROM "/Users/jni//work/tpc-h-parquet/nation" ) N
> on S.S_NAME = N.N_NAME;
> The error is raised when compiling a generated code for the join = predicate . 
> message: "Screen received stop request sent. < SchemaChangeException:[ org.apache.drill.exec.exception.ClassTransformationException: Failure generating transformation classes for value:
> If we replace the CHAR = predicate with a BIGINT = predicate, the query will run successfully.
> SELECT S.S_ACCTBAL, S.S_NAME, N.N_NAME
> FROM
>  ( SELECT CAST(_MAP['S_ACCTBAL'] AS numeric) AS S_ACCTBAL,
>          CAST(_MAP['S_NAME'] AS VARCHAR) AS S_NAME,
>               _MAP['S_SUPPKEY'] AS S_SUPPKEY
>    FROM "/Users/jni//work/tpc-h-parquet/supplier") S
> join
>  ( SELECT  CAST(_MAP['N_NAME'] AS VARCHAR) AS N_NAME,
>            _MAP['N_NATIONKEY'] AS N_NATIONKEY
>    FROM "/Users/jni//work/tpc-h-parquet/nation" ) N
> on S.S_SUPPKEY = N.N_NATIONKEY;
> Therefore, seems the CHAR join = predicate is not working properly. 



--
This message was sent by Atlassian JIRA
(v6.1#6144)