Repository: tajo Updated Branches: refs/heads/branch-0.11.1 20d850121 -> 2a1d9a04a
TAJO-1992 \set timezone in cli doesn't work because of casesensitive Closes #886 Project: http://git-wip-us.apache.org/repos/asf/tajo/repo Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/2a1d9a04 Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/2a1d9a04 Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/2a1d9a04 Branch: refs/heads/branch-0.11.1 Commit: 2a1d9a04ad126122fad97c05aba1cef897092f8c Parents: 20d8501 Author: charsyam <[email protected]> Authored: Sun Dec 6 02:16:26 2015 +0900 Committer: charsyam <[email protected]> Committed: Tue Dec 8 00:58:06 2015 +0900 ---------------------------------------------------------------------- CHANGES | 2 ++ .../apache/tajo/cli/tsql/commands/SetCommand.java | 5 +++++ .../java/org/apache/tajo/cli/tsql/TestTajoCli.java | 16 ++++++++++++++++ 3 files changed, 23 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tajo/blob/2a1d9a04/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index a73eb69..f29cb2c 100644 --- a/CHANGES +++ b/CHANGES @@ -26,6 +26,8 @@ Release 0.11.1 - unreleased TAJO-2000: BSTIndex can cause OOM. (jinho) + TAJO-1992: \set timezone in cli doesn't work because of casesensitive (DaeMyung) + TAJO-1993: Table Timezone doesn't work when Timezone is not exactly same.(DaeMyung) TAJO-2010: Parquet can not read null value. (jinho) http://git-wip-us.apache.org/repos/asf/tajo/blob/2a1d9a04/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/commands/SetCommand.java ---------------------------------------------------------------------- diff --git a/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/commands/SetCommand.java b/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/commands/SetCommand.java index 456a7a1..f9e7f6a 100644 --- a/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/commands/SetCommand.java +++ b/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/commands/SetCommand.java @@ -28,6 +28,7 @@ import java.sql.SQLException; import java.util.HashMap; import java.util.Map; +import static org.apache.tajo.SessionVars.TIMEZONE; import static org.apache.tajo.SessionVars.VariableMode; public class SetCommand extends TajoShellCommand { @@ -56,6 +57,10 @@ public class SetCommand extends TajoShellCommand { public void set(String key, String val) throws NoSuchSessionVariableException { SessionVars sessionVar; + if (TIMEZONE.name().equalsIgnoreCase(key)) { + key = TIMEZONE.name(); + } + if (SessionVars.exists(key)) { // if the variable is one of the session variables sessionVar = SessionVars.get(key); http://git-wip-us.apache.org/repos/asf/tajo/blob/2a1d9a04/tajo-core-tests/src/test/java/org/apache/tajo/cli/tsql/TestTajoCli.java ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/cli/tsql/TestTajoCli.java b/tajo-core-tests/src/test/java/org/apache/tajo/cli/tsql/TestTajoCli.java index b766c13..99b5edc 100644 --- a/tajo-core-tests/src/test/java/org/apache/tajo/cli/tsql/TestTajoCli.java +++ b/tajo-core-tests/src/test/java/org/apache/tajo/cli/tsql/TestTajoCli.java @@ -447,6 +447,22 @@ public class TestTajoCli { } @Test + public void testTimeZoneSessionVars3() throws Exception { + tajoCli.executeMetaCommand("\\set timezone GMT+1"); + tajoCli.executeMetaCommand("\\set"); + String output = new String(out.toByteArray()); + assertTrue(output.contains("'TIMEZONE'='GMT+1'")); + } + + @Test + public void testTimeZoneSessionVars4() throws Exception { + tajoCli.executeMetaCommand("\\set timeZone GMT+2"); + tajoCli.executeMetaCommand("\\set"); + String output = new String(out.toByteArray()); + assertTrue(output.contains("'TIMEZONE'='GMT+2'")); + } + + @Test public void testTimeZoneTest1() throws Exception { String tableName = "test1"; tajoCli.executeMetaCommand("\\set TIMEZONE GMT+0");
