PHOENIX-1478 Can't upsert value of 127 into column of type unsigned tinyint(Biju Nair)
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/1e478218 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/1e478218 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/1e478218 Branch: refs/heads/calcite Commit: 1e47821876af8100d5b4bc4dad03168eca7f5652 Parents: b842793 Author: Rajeshbabu Chintaguntla <rajeshb...@apache.org> Authored: Wed Apr 6 19:48:53 2016 +0530 Committer: Rajeshbabu Chintaguntla <rajeshb...@apache.org> Committed: Wed Apr 6 19:48:53 2016 +0530 ---------------------------------------------------------------------- .../src/main/java/org/apache/phoenix/schema/types/PDouble.java | 4 ++-- .../src/main/java/org/apache/phoenix/schema/types/PFloat.java | 4 ++-- .../src/main/java/org/apache/phoenix/schema/types/PInteger.java | 2 +- .../src/main/java/org/apache/phoenix/schema/types/PLong.java | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/1e478218/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDouble.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDouble.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDouble.java index 95a526e..f390813 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDouble.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDouble.java @@ -175,9 +175,9 @@ public class PDouble extends PRealNumber<Double> { } else if (targetType.equals(PSmallint.INSTANCE)) { return (d >= Short.MIN_VALUE && d <= Short.MAX_VALUE); } else if (targetType.equals(PTinyint.INSTANCE)) { - return (d >= Byte.MIN_VALUE && d < Byte.MAX_VALUE); + return (d >= Byte.MIN_VALUE && d <= Byte.MAX_VALUE); } else if (targetType.equals(PUnsignedTinyint.INSTANCE)) { - return (d >= 0 && d < Byte.MAX_VALUE); + return (d >= 0 && d <= Byte.MAX_VALUE); } } return super.isCoercibleTo(targetType, value); http://git-wip-us.apache.org/repos/asf/phoenix/blob/1e478218/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PFloat.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PFloat.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PFloat.java index 75f8efa..31aa251 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PFloat.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PFloat.java @@ -173,9 +173,9 @@ public class PFloat extends PRealNumber<Float> { } else if (targetType.equals(PSmallint.INSTANCE)) { return (f >= Short.MIN_VALUE && f <= Short.MAX_VALUE); } else if (targetType.equals(PTinyint.INSTANCE)) { - return (f >= Byte.MIN_VALUE && f < Byte.MAX_VALUE); + return (f >= Byte.MIN_VALUE && f <= Byte.MAX_VALUE); } else if (targetType.equals(PUnsignedTinyint.INSTANCE)) { - return (f >= 0 && f < Byte.MAX_VALUE); + return (f >= 0 && f <= Byte.MAX_VALUE); } } return super.isCoercibleTo(targetType, value); http://git-wip-us.apache.org/repos/asf/phoenix/blob/1e478218/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PInteger.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PInteger.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PInteger.java index 3c26fd5..2a523e7 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PInteger.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PInteger.java @@ -106,7 +106,7 @@ public class PInteger extends PWholeNumber<Integer> { return (i >= Byte.MIN_VALUE && i <= Byte.MAX_VALUE); } else if (targetType.equals(PUnsignedTinyint.INSTANCE)) { i = (Integer) value; - return (i >= 0 && i < Byte.MAX_VALUE); + return (i >= 0 && i <= Byte.MAX_VALUE); } } return super.isCoercibleTo(targetType, value); http://git-wip-us.apache.org/repos/asf/phoenix/blob/1e478218/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PLong.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PLong.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PLong.java index f2a0e92..82fd8d3 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PLong.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PLong.java @@ -155,10 +155,10 @@ public class PLong extends PWholeNumber<Long> { return (l >= Short.MIN_VALUE && l <= Short.MAX_VALUE); } else if (targetType.equals(PTinyint.INSTANCE)) { l = (Long) value; - return (l >= Byte.MIN_VALUE && l < Byte.MAX_VALUE); + return (l >= Byte.MIN_VALUE && l <= Byte.MAX_VALUE); } else if (targetType.equals(PUnsignedTinyint.INSTANCE)) { l = (Long) value; - return (l >= 0 && l < Byte.MAX_VALUE); + return (l >= 0 && l <= Byte.MAX_VALUE); } } return super.isCoercibleTo(targetType, value);