Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-2687

TINYINT/SMALLINT's clean not-implemented-yet messages are missing or late for views

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.4.0
    • SQL Parser
    • None

    Description

      The checks to detect uses of TINYINT and SMALLINT and directly report that they are not implemented yet doesn't seem to cover view creation:

      1. Some cases report a very unclean error:

      0: jdbc:drill:zk=local> USE dfs.tmp;
      +------------+------------+
      |     ok     |  summary   |
      +------------+------------+
      | true       | Default schema changed to 'dfs.tmp' |
      +------------+------------+
      1 row selected (0.02 seconds)
      0: jdbc:drill:zk=local> CREATE OR REPLACE VIEW TempView AS SELECT CAST('1' AS SMALLINT) FROM INFORMATION_SCHEMA.CATALOGS;
      +------------+------------+
      |     ok     |  summary   |
      +------------+------------+
      | true       | View 'TempView' replaced successfully in 'dfs.tmp' schema |
      +------------+------------+
      1 row selected (0.027 seconds)
      0: jdbc:drill:zk=local> SELECT * FROM TempView;
      Exception in thread "2ae0be1b-df9a-a7f8-132e-917d4bd51eaa:frag:0:0" java.lang.RuntimeException: Error closing fragment context.
      	at org.apache.drill.exec.work.fragment.FragmentExecutor.closeOutResources(FragmentExecutor.java:224)
      	at org.apache.drill.exec.work.fragment.FragmentExecutor.run(FragmentExecutor.java:187)
      	at org.apache.drill.common.SelfCleaningRunnable.run(SelfCleaningRunnable.java:38)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.RuntimeException: cast function for type SMALLINT is not defined
      	at org.apache.drill.common.expression.fn.CastFunctions.getCastFunc(CastFunctions.java:101)
      	at org.apache.drill.exec.expr.ExpressionTreeMaterializer$MaterializeVisitor.visitCastExpression(ExpressionTreeMaterializer.java:547)
      	at org.apache.drill.exec.expr.ExpressionTreeMaterializer$MaterializeVisitor.visitCastExpression(ExpressionTreeMaterializer.java:187)
      	at org.apache.drill.common.expression.CastExpression.accept(CastExpression.java:43)
      	at org.apache.drill.exec.expr.ExpressionTreeMaterializer.materialize(ExpressionTreeMaterializer.java:103)
      	at org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.setupNewSchema(ProjectRecordBatch.java:393)
      	at org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext(AbstractSingleRecordBatch.java:78)
      	at org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext(ProjectRecordBatch.java:134)
      	at org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:142)
      	at org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:118)
      	at org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:68)
      	at org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.innerNext(ScreenCreator.java:96)
      	at org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:58)
      	at org.apache.drill.exec.work.fragment.FragmentExecutor.run(FragmentExecutor.java:163)
      	... 4 more
      Query failed: RemoteRpcException: Failure while running fragment., cast function for type SMALLINT is not defined [ f2543aac-aaef-4090-89f7-32746efa4242 on dev-linux2:31013 ]
      [ f2543aac-aaef-4090-89f7-32746efa4242 on dev-linux2:31013 ]
      
      
      Error: exception while executing query: Failure while executing query. (state=,code=0)
      0: jdbc:drill:zk=local> 
      0: jdbc:drill:zk=local> 
      

      2. Other cases report a less messy but still non-specific error:

      0: jdbc:drill:zk=local> 
      0: jdbc:drill:zk=local> USE dfs.tmp;
      +------------+------------+
      |     ok     |  summary   |
      +------------+------------+
      | true       | Default schema changed to 'dfs.tmp' |
      +------------+------------+
      1 row selected (0.036 seconds)
      0: jdbc:drill:zk=local> CREATE OR REPLACE VIEW TempView AS SELECT CAST(1 AS SMALLINT) FROM INFORMATION_SCHEMA.CATALOGS;
      +------------+------------+
      |     ok     |  summary   |
      +------------+------------+
      | true       | View 'TempView' replaced successfully in 'dfs.tmp' schema |
      +------------+------------+
      1 row selected (0.043 seconds)
      0: jdbc:drill:zk=local> SELECT * FROM TempView;
      Query failed: UnsupportedOperationException: Unable to convert the value of 1 and type SMALLINT to a Drill constant expression.
      
      Error: exception while executing query: Failure while executing query. (state=,code=0)
      0: jdbc:drill:zk=local> 
      0: jdbc:drill:zk=local> 
      0: jdbc:drill:zk=local> 
      0: jdbc:drill:zk=local> 
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dsbos Daniel Barclay
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: