drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arina-ielchiieva <...@git.apache.org>
Subject [GitHub] drill pull request #819: DRILL-5419: Calculate return string length for lite...
Date Fri, 05 May 2017 12:30:53 GMT
Github user arina-ielchiieva commented on a diff in the pull request:

    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillOptiq.java
    @@ -512,9 +511,9 @@ public LogicalExpression visitLiteral(RexLiteral literal) {
             return ValueExpressions.getBit(((Boolean) literal.getValue()));
           case CHAR:
             if (isLiteralNull(literal)) {
    -          return createNullExpr(MinorType.VARCHAR);
    +          return createStringNullExpr(literal.getType().getPrecision());
    --- End diff --
    The length is 4, we treat it as regular string. If customer wants to treat such literals
as actual null value, then he needs to handle such case in sql code. For example, `select
case when col = 'NULL' then cast(null as varchar(10) else col end from t`. Converting 'NULL'
string to null value implicitly may not be a good idea, since we don't know how users wants
us to treat such literals. I think it's ok if user will handle such cases by himself.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message