[ 
https://issues.apache.org/jira/browse/DRILL-2687?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Victoria Markman resolved DRILL-2687.
-------------------------------------
    Resolution: Fixed

> TINYINT/SMALLINT's clean not-implemented-yet messages are missing or late for 
> views 
> ------------------------------------------------------------------------------------
>
>                 Key: DRILL-2687
>                 URL: https://issues.apache.org/jira/browse/DRILL-2687
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: SQL Parser
>            Reporter: Daniel Barclay (Drill)
>             Fix For: 1.4.0
>
>
> 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:
> {noformat}
> 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> 
> {noformat}
> 2.  Other cases report a less messy but still non-specific error:
> {noformat}
> 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> 
> {noformat}



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

Reply via email to