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]
With regards,
Apache Git Services