[
https://issues.apache.org/jira/browse/DRILL-2560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14382681#comment-14382681
]
Daniel Barclay (Drill) commented on DRILL-2560:
-----------------------------------------------
Some notes from reviewing the JDBC specification
(jdbc4.1-fr-spec.pdf/jdbc4.2-fr-spec.pdf and Javadoc):
Section 10.1, specifying auto-committing in terms when SQL statements complete,
says:
The point at which a statement is considered to be “complete” depends on the
type of SQL statement as well as what the application does after executing it:
* For Data Manipulation Language (DML) statements such as Insert, Update,
Delete, and DDL statements, the statement is complete as soon as it has
finished executing.
* For Select statements, the statement is complete when the associated result
set is closed.
* For CallableStatement objects or for statements that return multiple
results, the statement is complete when all of the associated result sets have
been closed, and all update counts and output parameters have been retrieved.
However, that doesn't say much about how completion of a SQL statement relates
to completion of (return from) an JDBC execute... method call.
Section 13.1.2, on executing statements, says:
If the Statement object represents an SQL query returning a ResultSet object,
the method executeQuery should be used.
If the SQL is known to be a DDL statement or a DML statement returning an
update count, the method executeUpdate should be used.
If the type of the SQL statement is not known, the method execute should be
used.
It also says that some cases are enforced:
If the SQL string being executed does not return a ResultSet object, the
method executeQuery throws an SQLException"
(apparently meaning "If the SQL [statement] being executed does not return a
[result table], the method executeQuery throws an SQLException") and:
The method executeUpdate throws an SQLException if the SQL string being
executed returns a ResultSet.
> JDBC execute calls return asynchronously for DDLs
> -------------------------------------------------
>
> Key: DRILL-2560
> URL: https://issues.apache.org/jira/browse/DRILL-2560
> Project: Apache Drill
> Issue Type: Bug
> Components: Client - JDBC
> Affects Versions: 0.8.0
> Reporter: Chris Westin
> Assignee: Daniel Barclay (Drill)
>
> While working with TestViews, I noticed that JDBC's executeQuery() returns
> immediately for drop view statements. For DDLs, users' expectation would be
> that the call would return synchronously. The same would be true for
> execute(), and executeUpdate(), if used for DDLs. This behavior is pretty
> typical for RDBMSs. This avoids the user having to consume the (non-)output
> in order to wait for the statement to complete -- otherwise it will get
> cancelled when the Statement is closed.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)