You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by ji...@apache.org on 2015/01/06 07:47:40 UTC

[1/2] tajo git commit: TAJO-1180: digitValue should throw Exception when char is not in valid range. (DaeMyung Kang via hyunsik)

Repository: tajo
Updated Branches:
  refs/heads/index_support 6a8ac97de -> 121d9fd49


TAJO-1180: digitValue should throw Exception when char is not in valid range. (DaeMyung Kang via hyunsik)

Closes #246


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/203a146b
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/203a146b
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/203a146b

Branch: refs/heads/index_support
Commit: 203a146b278a88853054bb6bd9ad7699e7268b8a
Parents: cb9793b
Author: Hyunsik Choi <hy...@apache.org>
Authored: Tue Jan 6 06:21:20 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Tue Jan 6 06:21:35 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |  3 ++
 .../apache/tajo/datum/protobuf/TextUtils.java   |  4 +-
 .../tajo/datum/protobuf/TestTextUtils.java      | 52 ++++++++++++++++++++
 3 files changed, 58 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/203a146b/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 8a4ffe1..6e7a3c6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -137,6 +137,9 @@ Release 0.9.1 - unreleased
 
   BUG FIXES
 
+    TAJO-1180: digitValue should throw Exception when char is not in 
+    valid range. (DaeMyung Kang via hyunsik)
+
     TAJO-1276: Link to tsql guide 404s in tajo cli. (Jakob Homan via jihoon)
 
     TAJO-1275: Optimizer pushs down non-equi filter as theta join qualifier.

http://git-wip-us.apache.org/repos/asf/tajo/blob/203a146b/tajo-common/src/main/java/org/apache/tajo/datum/protobuf/TextUtils.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/datum/protobuf/TextUtils.java b/tajo-common/src/main/java/org/apache/tajo/datum/protobuf/TextUtils.java
index 8eaff79..ecffd32 100644
--- a/tajo-common/src/main/java/org/apache/tajo/datum/protobuf/TextUtils.java
+++ b/tajo-common/src/main/java/org/apache/tajo/datum/protobuf/TextUtils.java
@@ -114,8 +114,10 @@ public class TextUtils {
         return c - '0';
       } else if ('a' <= c && c <= 'z') {
         return c - 'a' + 10;
-      } else {
+      } else if ('A' <= c && c <= 'Z') {
         return c - 'A' + 10;
+      } else {
+        throw new IllegalArgumentException("Expected \"0-9\" or \"a-z, A-Z\".");
       }
     }
     

http://git-wip-us.apache.org/repos/asf/tajo/blob/203a146b/tajo-common/src/test/java/org/apache/tajo/datum/protobuf/TestTextUtils.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/datum/protobuf/TestTextUtils.java b/tajo-common/src/test/java/org/apache/tajo/datum/protobuf/TestTextUtils.java
new file mode 100644
index 0000000..5efd027
--- /dev/null
+++ b/tajo-common/src/test/java/org/apache/tajo/datum/protobuf/TestTextUtils.java
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.datum.protobuf;
+
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+public class TestTextUtils {
+
+  @Test
+  public void testDigitValueSuccess() {
+      assertEquals(TextUtils.digitValue('0'), 0);
+      assertEquals(TextUtils.digitValue('a'), 10);
+      assertEquals(TextUtils.digitValue('A'), 10);
+      assertEquals(TextUtils.digitValue('f'), 15);
+      assertEquals(TextUtils.digitValue('F'), 15);
+      assertEquals(TextUtils.digitValue('z'), 35);
+      assertEquals(TextUtils.digitValue('Z'), 35);
+  }
+
+  @Test
+  public void testDigitValueError() throws IllegalArgumentException {
+      boolean ret = true;
+      try {
+        TextUtils.digitValue('!');
+      } catch(IllegalArgumentException e) {
+        ret = false;
+      }
+
+      assertFalse(ret);
+  }
+}


[2/2] tajo git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into index_support

Posted by ji...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into index_support


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/121d9fd4
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/121d9fd4
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/121d9fd4

Branch: refs/heads/index_support
Commit: 121d9fd4927d4c59f3d92467bd736abbd5fa88c9
Parents: 6a8ac97 203a146
Author: Jihoon Son <ji...@apache.org>
Authored: Tue Jan 6 15:46:59 2015 +0900
Committer: Jihoon Son <ji...@apache.org>
Committed: Tue Jan 6 15:46:59 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |  3 ++
 .../apache/tajo/datum/protobuf/TextUtils.java   |  4 +-
 .../tajo/datum/protobuf/TestTextUtils.java      | 52 ++++++++++++++++++++
 3 files changed, 58 insertions(+), 1 deletion(-)
----------------------------------------------------------------------