You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Khurram Faraaz (JIRA)" <ji...@apache.org> on 2017/06/05 20:02:04 UTC

[jira] [Created] (DRILL-5566) AssertionError: Internal error: invariant violated: call to wrong operator

Khurram Faraaz created DRILL-5566:
-------------------------------------

             Summary: AssertionError: Internal error: invariant violated: call to wrong operator
                 Key: DRILL-5566
                 URL: https://issues.apache.org/jira/browse/DRILL-5566
             Project: Apache Drill
          Issue Type: Bug
          Components: Execution - Flow
    Affects Versions: 1.11.0
            Reporter: Khurram Faraaz


CHARACTER_LENGTH is a non-reserved keyword as per the SQL specification. It is a monadic function that accepts exactly one operand or parameter.

{noformat}
<numeric value function> ::=
    <position expression>
  | <regex occurrences function>
  | <regex position expression>
  | <extract expression>
  | <length expression>
  ...
  ...

<length expression> ::=
    <char length expression>
  | <octet length expression>
<char length expression> ::=
  { CHAR_LENGTH | CHARACTER_LENGTH } <left paren> <character value expression>
      [ USING <char length units> ] <right paren>
...
...
<char length units> ::=
    CHARACTERS
  | OCTETS      
{noformat}

Drill reports an assertion error in drillbit.log when character_length function is used in a SQL query.
{noformat}
0: jdbc:drill:schema=dfs.tmp> select character_length(cast('hello' as varchar(10))) col1 from (values(1));
Error: SYSTEM ERROR: AssertionError: Internal error: invariant violated: call to wrong operator


[Error Id: 49198839-5a1b-4786-9257-59739b27d2a8 on centos-01.qa.lab:31010]

  (org.apache.drill.exec.work.foreman.ForemanException) Unexpected exception during fragment initialization: Internal error: invariant violated: call to wrong operator
    org.apache.drill.exec.work.foreman.Foreman.run():297
    java.util.concurrent.ThreadPoolExecutor.runWorker():1145
    java.util.concurrent.ThreadPoolExecutor$Worker.run():615
    java.lang.Thread.run():745
Caused By (java.lang.AssertionError) Internal error: invariant violated: call to wrong operator
    org.apache.calcite.util.Util.newInternal():777
    org.apache.calcite.util.Util.permAssert():885
    org.apache.calcite.sql2rel.ReflectiveConvertletTable$3.convertCall():219
    org.apache.calcite.sql2rel.SqlNodeToRexConverterImpl.convertCall():59
    org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit():4148
    org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit():3581
    org.apache.calcite.sql.SqlCall.accept():130
    org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpression():4040
    org.apache.calcite.sql2rel.StandardConvertletTable$8.convertCall():185
    org.apache.calcite.sql2rel.SqlNodeToRexConverterImpl.convertCall():59
    org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit():4148
    org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit():3581
    org.apache.calcite.sql.SqlCall.accept():130
    org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpression():4040
    org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectList():3411
    org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl():612
    org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect():568
    org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive():2773
    org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery():522
    org.apache.drill.exec.planner.sql.SqlConverter.toRel():269
    org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToRel():623
    org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.validateAndConvert():195
    org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan():164
    org.apache.drill.exec.planner.sql.DrillSqlWorker.getQueryPlan():131
    org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan():79
    org.apache.drill.exec.work.foreman.Foreman.runSQL():1050
    org.apache.drill.exec.work.foreman.Foreman.run():280
    java.util.concurrent.ThreadPoolExecutor.runWorker():1145
    java.util.concurrent.ThreadPoolExecutor$Worker.run():615
    java.lang.Thread.run():745 (state=,code=0)
{noformat}    
    
Calcite supports character_length function    
{noformat}
[root@centos-0170 csv]# ./sqlline
sqlline version 1.1.9
sqlline> !connect jdbc:calcite:model=target/test-classes/model.json admin admin
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
0: jdbc:calcite:model=target/test-classes/mod> select character_length(cast('hello' as varchar(10))) col1 from (values(1));
+------------+
|    COL1    |
+------------+
| 5          |
+------------+
1 row selected (1.379 seconds)
{noformat}

Postgres 9.3 also supports character_length function
{noformat}
postgres=# select character_length(cast('hello' as varchar(10))) col1 from (values(1)) foo;
 col1 
------
    5
(1 row)
{noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)