drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DRILL-4906) CASE Expression with constant generates class exception
Date Thu, 29 Sep 2016 16:07:20 GMT

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

ASF GitHub Bot commented on DRILL-4906:
---------------------------------------

Github user amansinha100 commented on a diff in the pull request:

    https://github.com/apache/drill/pull/598#discussion_r81173247
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillConstExecutor.java
---
    @@ -143,116 +156,176 @@ public void reduce(RexBuilder rexBuilder, List<RexNode>
constExps, List<RexNode>
             continue;
           }
     
    -        switch(materializedExpr.getMajorType().getMinorType()) {
    -          case INT:
    -            reducedValues.add(rexBuilder.makeLiteral(
    -                new BigDecimal(((IntHolder)output).value),
    -                TypeInferenceUtils.createCalciteTypeWithNullability(typeFactory, SqlTypeName.INTEGER,
newCall.getType().isNullable()),
    -                false));
    -            break;
    -          case BIGINT:
    -            reducedValues.add(rexBuilder.makeLiteral(
    -                new BigDecimal(((BigIntHolder)output).value),
    -                TypeInferenceUtils.createCalciteTypeWithNullability(typeFactory, SqlTypeName.BIGINT,
newCall.getType().isNullable()),
    -                false));
    -            break;
    -          case FLOAT4:
    -            reducedValues.add(rexBuilder.makeLiteral(
    -                new BigDecimal(((Float4Holder)output).value),
    -                TypeInferenceUtils.createCalciteTypeWithNullability(typeFactory, SqlTypeName.FLOAT,
newCall.getType().isNullable()),
    -                false));
    -            break;
    -          case FLOAT8:
    -            reducedValues.add(rexBuilder.makeLiteral(
    -                new BigDecimal(((Float8Holder)output).value),
    -                TypeInferenceUtils.createCalciteTypeWithNullability(typeFactory, SqlTypeName.DOUBLE,
newCall.getType().isNullable()),
    -                false));
    -            break;
    -          case VARCHAR:
    -            reducedValues.add(rexBuilder.makeCharLiteral(
    -                new NlsString(StringFunctionHelpers.getStringFromVarCharHolder((VarCharHolder)output),
null, null)));
    -            break;
    -          case BIT:
    -            reducedValues.add(rexBuilder.makeLiteral(
    -                ((BitHolder)output).value == 1 ? true : false,
    -                TypeInferenceUtils.createCalciteTypeWithNullability(typeFactory, SqlTypeName.BOOLEAN,
newCall.getType().isNullable()),
    -                false));
    -            break;
    -          case DATE:
    -            reducedValues.add(rexBuilder.makeLiteral(
    -                new DateTime(((DateHolder) output).value, DateTimeZone.UTC).toCalendar(null),
    -                TypeInferenceUtils.createCalciteTypeWithNullability(typeFactory, SqlTypeName.DATE,
newCall.getType().isNullable()),
    -                false));
    -            break;
    -          case DECIMAL9:
    -            reducedValues.add(rexBuilder.makeLiteral(
    -                new BigDecimal(BigInteger.valueOf(((Decimal9Holder) output).value), ((Decimal9Holder)output).scale),
    +      Function<ValueHolder, RexNode> literator = new Function<ValueHolder, RexNode>()
{
    --- End diff --
    
    Sounds good. 


> CASE Expression with constant generates class exception
> -------------------------------------------------------
>
>                 Key: DRILL-4906
>                 URL: https://issues.apache.org/jira/browse/DRILL-4906
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: SQL Parser
>    Affects Versions: 1.6.0, 1.8.0
>            Reporter: Serhii Harnyk
>            Assignee: Serhii Harnyk
>             Fix For: 1.9.0
>
>
> How to reproduce:
> select (case when (true) then 1 end) from (values(1));
> Error
> Error: SYSTEM ERROR: ClassCastException: org.apache.drill.exec.expr.holders.NullableVarCharHolder
cannot be cast to org.apache.drill.exec.expr.holders.VarCharHolder



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

Mime
View raw message