[
https://issues.apache.org/jira/browse/DRILL-5136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15764856#comment-15764856
]
Rob Wu commented on DRILL-5136:
-------------------------------
Yup, I’m observing the same issue with CTAS on the patched server as well.
That is correct. The current server prepare implementation is not robust enough
to handle any non-select queries for prepare. And the patch also does not
capture all uses cases such as CREATE and DROP as it only addresses the initial
observed issue regarding “show schemas.”
I agree with Robert that the server should not convert non-SELECT statements
into limit 0 nor do anything for DDL statement (such as CTAS) at prepare time.
Instead, the server may execute non-SELECT and non-DDL statements that returns
data (e.g. SHOW TABLES) at prepare time for the purpose of retrieving the
result set schema. Alternatively server may keep a hard coded schema for each
of the non-SELECT and non-DDL statements that returns results but this is
harder to maintain. These reduce the updates needed to be done on the
client/driver side when there are changes between different server versions
(enforcing loosely coupled design).
> Some SQL statements fail due to PreparedStatement
> -------------------------------------------------
>
> Key: DRILL-5136
> URL: https://issues.apache.org/jira/browse/DRILL-5136
> Project: Apache Drill
> Issue Type: Bug
> Components: Client - ODBC
> Affects Versions: 1.9.0
> Reporter: Robert Hou
> Assignee: Laurent Goujon
>
> "show schemas" does not work.
> SQL>show schemas
> 1: SQLPrepare = [MapR][Drill] (1040) Drill failed to execute the query: show
> schemas
> [30029]Query execution error. Details:[
> PARSE ERROR: Encountered "( show" at line 1, column 15.
> Was expecting one of:
> <IDENTIFIER> ...
> <QUOTED_IDENTIFIER> ...
> <BACK_QUOTED_IDENTIFIER> ...
> <BRACKET_QUOTED_IDENTIFIER> ...
> <UNICODE_QUOTED_IDENTIFIER> ...
> "LATERAL" ...
> "(" "WITH" ...
> "(" "+" ...
> "(" "-" ...
> "(" <UNSIGNED_INTEGER_LITERAL> ...
> "(" <DECIMAL_NUMERIC_LITERAL> ...
> "(" <APPROX_NUMERIC (1040) SQLSTATE=HY000
> The query profile shows this SQL statement is being executed:
> {color:blue} SELECT * FROM {color} (show schemas) {color:blue} LIMIT 0
> {color}
>
> The blue text has been added when displaying schemas
> "use schema" also does not work.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)