You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ja...@apache.org on 2015/03/17 18:46:56 UTC

[1/3] phoenix git commit: PHOENIX-1723 PTinyint.isCoercibleTo fails to test -1 with type PTinyint (Shuxiong Ye)

Repository: phoenix
Updated Branches:
  refs/heads/4.3 84767cf6d -> a7fdfa42c


PHOENIX-1723 PTinyint.isCoercibleTo fails to test -1 with type PTinyint (Shuxiong Ye)


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

Branch: refs/heads/4.3
Commit: c49f09768af2ee77934e8664f2752727defecc62
Parents: 84767cf
Author: James Taylor <jt...@salesforce.com>
Authored: Tue Mar 17 10:42:46 2015 -0700
Committer: James Taylor <jt...@salesforce.com>
Committed: Tue Mar 17 10:42:46 2015 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/phoenix/schema/types/PTinyint.java | 9 +++++----
 .../java/org/apache/phoenix/schema/types/PDataTypeTest.java | 2 ++
 2 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c49f0976/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTinyint.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTinyint.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTinyint.java
index 681b41b..0db4536 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTinyint.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTinyint.java
@@ -17,12 +17,13 @@
  */
 package org.apache.phoenix.schema.types;
 
-import com.google.common.base.Preconditions;
+import java.math.BigDecimal;
+import java.sql.Types;
+
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.schema.SortOrder;
 
-import java.math.BigDecimal;
-import java.sql.Types;
+import com.google.common.base.Preconditions;
 
 public class PTinyint extends PDataType<Byte> {
 
@@ -126,7 +127,7 @@ public class PTinyint extends PDataType<Byte> {
   @Override
   public boolean isCoercibleTo(PDataType targetType, Object value) {
     if (value != null) {
-      if (equalsAny(targetType, this, PUnsignedDouble.INSTANCE, PUnsignedFloat.INSTANCE,
+      if (equalsAny(targetType, PUnsignedDouble.INSTANCE, PUnsignedFloat.INSTANCE,
           PUnsignedLong.INSTANCE, PUnsignedInt.INSTANCE, PUnsignedSmallint.INSTANCE,
           PUnsignedTinyint.INSTANCE)) {
         byte i = (Byte) value;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c49f0976/phoenix-core/src/test/java/org/apache/phoenix/schema/types/PDataTypeTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/schema/types/PDataTypeTest.java b/phoenix-core/src/test/java/org/apache/phoenix/schema/types/PDataTypeTest.java
index b2e6e0b..85f9436 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/schema/types/PDataTypeTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/schema/types/PDataTypeTest.java
@@ -463,6 +463,8 @@ public class PDataTypeTest {
         Object doubleObj = PTinyint.INSTANCE.toObject(doubleValue, PDouble.INSTANCE);
         assertTrue(doubleObj instanceof Byte);
         assertEquals(100, ((Byte)doubleObj).byteValue());
+
+        assertTrue(PTinyint.INSTANCE.isCoercibleTo(PTinyint.INSTANCE, (byte) -1));
     }
     
     @Test


[3/3] phoenix git commit: PHOENIX-1741 PUnsignedTimestamp should define its codec (Alicia Ying Shu)

Posted by ja...@apache.org.
PHOENIX-1741 PUnsignedTimestamp should define its codec (Alicia Ying Shu)


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

Branch: refs/heads/4.3
Commit: a7fdfa42c578d6452e76816758473527dff9df94
Parents: 2c5124c
Author: James Taylor <jt...@salesforce.com>
Authored: Tue Mar 17 10:45:42 2015 -0700
Committer: James Taylor <jt...@salesforce.com>
Committed: Tue Mar 17 10:45:42 2015 -0700

----------------------------------------------------------------------
 .../java/org/apache/phoenix/schema/types/PUnsignedTimestamp.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a7fdfa42/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedTimestamp.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedTimestamp.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedTimestamp.java
index 450408f..29154b0 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedTimestamp.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedTimestamp.java
@@ -31,7 +31,7 @@ public class PUnsignedTimestamp extends PDataType<Timestamp> {
   public static final PUnsignedTimestamp INSTANCE = new PUnsignedTimestamp();
 
   private PUnsignedTimestamp() {
-    super("UNSIGNED_TIMESTAMP", 20, java.sql.Timestamp.class, null, 12);
+    super("UNSIGNED_TIMESTAMP", 20, java.sql.Timestamp.class, new PUnsignedDate.UnsignedDateCodec(), 12);
   }
 
   @Override


[2/3] phoenix git commit: PHOENIX-1739 Ensure RuntimeException nests SQLException so that proper exception gets thrown

Posted by ja...@apache.org.
PHOENIX-1739 Ensure RuntimeException nests SQLException so that proper exception gets thrown


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/2c5124cd
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/2c5124cd
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/2c5124cd

Branch: refs/heads/4.3
Commit: 2c5124cd7008a5ddcc3b03172dcb1aabc0bfbdbe
Parents: c49f097
Author: James Taylor <jt...@salesforce.com>
Authored: Mon Mar 16 20:09:12 2015 -0700
Committer: James Taylor <jt...@salesforce.com>
Committed: Tue Mar 17 10:43:13 2015 -0700

----------------------------------------------------------------------
 .../schema/ConstraintViolationException.java      | 18 +++++++++---------
 .../phoenix/schema/IllegalDataException.java      | 18 ++++++++++--------
 .../apache/phoenix/compile/QueryCompilerTest.java |  3 +--
 3 files changed, 20 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/2c5124cd/phoenix-core/src/main/java/org/apache/phoenix/schema/ConstraintViolationException.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/ConstraintViolationException.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/ConstraintViolationException.java
index 42e7053..465c050 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/ConstraintViolationException.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/ConstraintViolationException.java
@@ -17,6 +17,9 @@
  */
 package org.apache.phoenix.schema;
 
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.exception.SQLExceptionInfo;
+
 /**
  * 
  * Exception thrown when a schema constraint is violated at the
@@ -29,18 +32,15 @@ public class ConstraintViolationException extends RuntimeException {
 	private static final long serialVersionUID = 1L;
 
     public ConstraintViolationException() {
+        this((String)null);
     }
-
+    
     public ConstraintViolationException(String message) {
-        super(message);
+        super(new SQLExceptionInfo.Builder(
+                SQLExceptionCode.DATA_EXCEEDS_MAX_CAPACITY).setMessage(message).build().buildException());
     }
-
+    
     public ConstraintViolationException(Throwable cause) {
-        super(cause);
+        super(cause); // Already wrapped - don't rewrap
     }
-
-    public ConstraintViolationException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/2c5124cd/phoenix-core/src/main/java/org/apache/phoenix/schema/IllegalDataException.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/IllegalDataException.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/IllegalDataException.java
index c93e15c..0053e51 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/IllegalDataException.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/IllegalDataException.java
@@ -17,6 +17,9 @@
  */
 package org.apache.phoenix.schema;
 
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.exception.SQLExceptionInfo;
+
 /**
  * 
  * Exception thrown when an invalid or illegal data value is found
@@ -28,18 +31,17 @@ public class IllegalDataException extends ConstraintViolationException {
 	private static final long serialVersionUID = 1L;
 
     public IllegalDataException() {
+        this((String)null);
     }
-
+    
     public IllegalDataException(String message) {
-        super(message);
+        super(new SQLExceptionInfo.Builder(
+                SQLExceptionCode.ILLEGAL_DATA).setMessage(message)
+                .build().buildException());
     }
 
     public IllegalDataException(Throwable cause) {
-        super(cause);
+        super(cause);  // Already wrapped - don't rewrap
     }
-
-    public IllegalDataException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
+    
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/2c5124cd/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java b/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
index 4accd38..e17c528 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
@@ -53,7 +53,6 @@ import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.schema.AmbiguousColumnException;
 import org.apache.phoenix.schema.ColumnAlreadyExistsException;
 import org.apache.phoenix.schema.ColumnNotFoundException;
-import org.apache.phoenix.schema.ConstraintViolationException;
 import org.apache.phoenix.schema.PColumn;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.util.ByteUtil;
@@ -1414,7 +1413,7 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest {
         try {
             stmt.execute();
             fail();
-        } catch (ConstraintViolationException e) {
+        } catch (SQLException e) {
             assertTrue(e.getMessage().contains("Primary key may not be null"));
         }
     }