[
https://issues.apache.org/jira/browse/DRILL-1065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14901321#comment-14901321
]
ASF GitHub Bot commented on DRILL-1065:
---------------------------------------
Github user sudheeshkatkam commented on a diff in the pull request:
https://github.com/apache/drill/pull/159#discussion_r40020795
--- Diff:
exec/java-exec/src/test/java/org/apache/drill/exec/server/TestOptions.java ---
@@ -46,19 +48,207 @@ public void testOptions() throws Exception{
@Test
public void checkValidationException() throws Exception {
thrownException.expect(new UserExceptionMatcher(VALIDATION));
- test(String.format("ALTER session SET `%s` = '%s';",
ExecConstants.SLICE_TARGET, "fail"));
+ test("ALTER session SET `%s` = '%s';", SLICE_TARGET, "fail");
}
@Test // DRILL-3122
public void checkChangedColumn() throws Exception {
- test(String.format("ALTER session SET `%s` = %d;",
ExecConstants.SLICE_TARGET,
+ test(String.format("ALTER session SET `%s` = %d;", SLICE_TARGET,
ExecConstants.SLICE_TARGET_DEFAULT));
testBuilder()
- .sqlQuery(String.format("SELECT status FROM sys.options WHERE name
= '%s' AND type = 'SESSION'", ExecConstants.SLICE_TARGET))
+ .sqlQuery("SELECT status FROM sys.options WHERE name = '%s' AND
type = 'SESSION'", SLICE_TARGET)
.unOrdered()
.baselineColumns("status")
.baselineValues("DEFAULT")
.build()
.run();
}
+
+ @Test
+ public void setAndResetSessionOption() throws Exception {
+ // check unchanged
+ testBuilder()
+ .sqlQuery("SELECT status FROM sys.options WHERE name = '%s' AND type
= 'SESSION'", SLICE_TARGET)
+ .unOrdered()
+ .expectsEmptyResultSet()
+ .build()
+ .run();
+
+ // change option
+ test("SET `%s` = %d;", SLICE_TARGET, 10);
+ // check changed
+ test("SELECT status, type, name FROM sys.options WHERE type =
'SESSION';");
+ testBuilder()
+ .sqlQuery("SELECT num_val FROM sys.options WHERE name = '%s' AND
type = 'SESSION'", SLICE_TARGET)
+ .unOrdered()
+ .baselineColumns("num_val")
+ .baselineValues((long) 10)
+ .build()
+ .run();
+
+ // reset option
+ test("RESET `%s`;", SLICE_TARGET);
+ // check reverted
+ testBuilder()
+ .sqlQuery("SELECT status FROM sys.options WHERE name = '%s' AND type
= 'SESSION'", SLICE_TARGET)
+ .unOrdered()
+ .expectsEmptyResultSet()
+ .build()
+ .run();
+ }
+
+ @Test
+ public void setAndResetSystemOption() throws Exception {
+ // check unchanged
+ testBuilder()
+ .sqlQuery("SELECT status FROM sys.options WHERE name = '%s' AND type
= 'SYSTEM'", ENABLE_VERBOSE_ERRORS_KEY)
+ .unOrdered()
+ .baselineColumns("status")
+ .baselineValues("DEFAULT")
+ .build()
+ .run();
+
+ // change option
+ test("ALTER system SET `%s` = %b;", ENABLE_VERBOSE_ERRORS_KEY, true);
+ // check changed
+ testBuilder()
+ .sqlQuery("SELECT bool_val FROM sys.options WHERE name = '%s' AND
type = 'SYSTEM'", ENABLE_VERBOSE_ERRORS_KEY)
+ .unOrdered()
+ .baselineColumns("bool_val")
+ .baselineValues(true)
+ .build()
+ .run();
+
+ // reset option
+ test("ALTER system RESET `%s`;", ENABLE_VERBOSE_ERRORS_KEY);
+ // check reverted
+ testBuilder()
+ .sqlQuery("SELECT status FROM sys.options WHERE name = '%s' AND type
= 'SYSTEM'", ENABLE_VERBOSE_ERRORS_KEY)
+ .unOrdered()
+ .baselineColumns("status")
+ .baselineValues("DEFAULT")
+ .build()
+ .run();
+ }
+
+ @Test
+ public void resetAllSessionOptions() throws Exception {
--- End diff --
changeSessionAndNotSystem is testing this.
Also, we cannot test resetting all system options because the unit tests
have a "before" method that changes a system option.
> Provide a reset command to reset an option to its default value
> ---------------------------------------------------------------
>
> Key: DRILL-1065
> URL: https://issues.apache.org/jira/browse/DRILL-1065
> Project: Apache Drill
> Issue Type: Improvement
> Components: Execution - Flow
> Reporter: Aman Sinha
> Assignee: Sudheesh Katkam
> Priority: Minor
> Fix For: 1.2.0
>
>
> Within a session, currently we set configuration options and it would be very
> useful to have a 'reset' command to reset the value of an option to its
> default system value:
> ALTER SESSION RESET <option name>
> If we don't want to add a new keyword for RESET, we could potentially
> overload the SET command and allow the user to set to the 'default' value.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)