Repository: tajo Updated Branches: refs/heads/master 4b53643d4 -> c770fe75c
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/c770fe75 Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/c770fe75 Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/c770fe75 Branch: refs/heads/master Commit: c770fe75caa44887ffb2bd17ad1d6b627f8e643e Parents: 4b53643 Author: charsyam <[email protected]> Authored: Sun Dec 6 02:16:26 2015 +0900 Committer: charsyam <[email protected]> Committed: Sun Dec 6 02:16:26 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/c770fe75/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index 6ee903b..f1afd9e 100644 --- a/CHANGES +++ b/CHANGES @@ -57,6 +57,8 @@ Release 0.12.0 - unreleased BUG FIXES + 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/c770fe75/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 5de9984..5cff2c7 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 @@ -27,6 +27,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 { @@ -55,6 +56,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/c770fe75/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 4f1b133..6bd694f 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 @@ -442,6 +442,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");
