[ 
https://issues.apache.org/jira/browse/DRILL-6834?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16698139#comment-16698139
 ] 

ASF GitHub Bot commented on DRILL-6834:
---------------------------------------

vvysotskyi commented on a change in pull request #1549: DRILL-6834: Introduce 
option to disable result set on CTAS, create vi…
URL: https://github.com/apache/drill/pull/1549#discussion_r236069267
 
 

 ##########
 File path: 
exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java
 ##########
 @@ -403,4 +407,147 @@ public void testConvertFromInEmptyInputSql() throws 
Exception {
         .sql("SELECT CONVERT_FROM(columns[1], 'JSON') as col1 from 
cp.`empty.csv`")
         .returns("");
   }
+
+  @Test
+  public void testResultSetIsNotReturnedSet() throws Exception {
+    Statement s = null;
+    try (Connection conn = connect()) {
+      s = conn.createStatement();
+      boolean hasResult = s.execute(String.format("alter session set `%s` = 
false", ExecConstants.RETURN_RESULT_SET_FOR_DDL));
+
+      assertFalse("SET query should not return result set", hasResult);
+      assertNull("No result", s.getResultSet());
+      assertNotEquals("Update count should be >= 0", -1, s.getUpdateCount());
+    } finally {
+      if (s != null) {
+        s.execute(String.format("reset `%s`", 
ExecConstants.RETURN_RESULT_SET_FOR_DDL));
+        s.close();
+      }
+    }
+  }
+
+  @Test
+  public void testResultSetIsNotReturnedCTAS() throws Exception {
+    final String tableName = "dfs.tmp.`ctas`";
+
+    Statement s = null;
+    try (Connection conn = connect()) {
+      s = conn.createStatement();
+      s.execute(String.format("alter session set `%s` = false", 
ExecConstants.RETURN_RESULT_SET_FOR_DDL));
+
+      s.execute(String.format("CREATE TABLE %s AS SELECT * FROM 
cp.`employee.json`", tableName));
 
 Review comment:
   Please add `drop table if exists` to the `finally` block.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Introduce option to disable result set on CTAS, create view and drop 
> table/view etc. for JDBC connection
> --------------------------------------------------------------------------------------------------------
>
>                 Key: DRILL-6834
>                 URL: https://issues.apache.org/jira/browse/DRILL-6834
>             Project: Apache Drill
>          Issue Type: Improvement
>            Reporter: Bohdan Kazydub
>            Assignee: Bohdan Kazydub
>            Priority: Major
>              Labels: doc-impacting
>             Fix For: 1.15.0
>
>
> There are some tools (Unica, dBeaver, TalenD) that do not expect to obtain 
> result set on CTAS query. As a result the query gets canceled. Hive, on the 
> other hand, does not return result set for the query and these tools work 
> well.
> To improve Drill's integration with such tools a session option 
> {{`drill.exec.fetch_resultset_for_ddl`}} is introduced. If the option is 
> enabled (set to `true`) Drill's behaviour will be unchanged, i.e. all result 
> set will be returned for all queries. If the option is disabled (set to 
> `false`), CTAS, CREATE VIEW, CREATE FUNCTION, DROP TABLE, DROP VIEW, DROP 
> FUNCTION, USE schema, SET option, REFRESH METADATA TABLE etc. queries will 
> not return result set but {{updateCount}} instead.
> The option affects JDBC connections only.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to