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 2014/10/19 06:16:43 UTC

[3/3] git commit: Fix QueryIT test failure

Fix QueryIT test failure


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

Branch: refs/heads/3.0
Commit: bdae7a8887d5ec882fd3f88656613ae50149229d
Parents: 3a8ea6b
Author: James Taylor <jt...@salesforce.com>
Authored: Sat Oct 18 21:22:18 2014 -0700
Committer: James Taylor <jt...@salesforce.com>
Committed: Sat Oct 18 21:22:18 2014 -0700

----------------------------------------------------------------------
 .../src/it/java/org/apache/phoenix/end2end/HashJoinIT.java      | 2 +-
 .../src/it/java/org/apache/phoenix/end2end/QueryIT.java         | 5 +++--
 .../java/org/apache/phoenix/compile/ExpressionCompiler.java     | 2 +-
 .../src/main/java/org/apache/phoenix/compile/JoinCompiler.java  | 4 ++--
 .../java/org/apache/phoenix/exception/SQLExceptionCode.java     | 1 -
 .../main/java/org/apache/phoenix/expression/CaseExpression.java | 2 +-
 .../apache/phoenix/expression/function/CoalesceFunction.java    | 2 +-
 .../src/main/java/org/apache/phoenix/schema/PDataType.java      | 2 +-
 8 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/bdae7a88/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
index e447061..3f1bfc7 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
@@ -2305,7 +2305,7 @@ public class HashJoinIT extends BaseHBaseManagedTimeIT {
             statement.executeQuery();
             fail("Should have got SQLException.");
         } catch (SQLException e) {
-            assertEquals(e.getErrorCode(), SQLExceptionCode.CANNOT_CONVERT_TYPE.getErrorCode());
+            assertEquals(e.getErrorCode(), SQLExceptionCode.TYPE_MISMATCH.getErrorCode());
         } finally {
             conn.close();
         }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bdae7a88/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryIT.java
index 7282f39..a537087 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryIT.java
@@ -55,8 +55,8 @@ import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.jdbc.PhoenixConnection;
-import org.apache.phoenix.schema.ConstraintViolationException;
 import org.apache.phoenix.schema.PDataType;
 import org.apache.phoenix.schema.SequenceNotFoundException;
 import org.apache.phoenix.util.ByteUtil;
@@ -178,7 +178,8 @@ public class QueryIT extends BaseQueryIT {
             assertTrue (rs.next());
             rs.getDate(1);
             fail();
-        } catch (ConstraintViolationException e) { // Expected
+        } catch (SQLException e) { // Expected
+            assertEquals(SQLExceptionCode.TYPE_MISMATCH.getErrorCode(),e.getErrorCode());
         } finally {
             conn.close();
         }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bdae7a88/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java
index f8f0bee..135ef01 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java
@@ -1174,7 +1174,7 @@ public class ExpressionCompiler extends UnsupportedAllParseNodeVisitor<Expressio
                 arrayElemChild = child;
                 arrayElemDataType = childType;
             } else {
-                throw new SQLExceptionInfo.Builder(SQLExceptionCode.CANNOT_CONVERT_TYPE)
+                throw new SQLExceptionInfo.Builder(SQLExceptionCode.TYPE_MISMATCH)
                         .setMessage(
                                 "Case expressions must have common type: " + arrayElemDataType
                                         + " cannot be coerced to " + childType).build().buildException();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bdae7a88/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java
index b2b31ac..f5971c3 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java
@@ -51,7 +51,6 @@ import org.apache.phoenix.parse.ComparisonParseNode;
 import org.apache.phoenix.parse.DerivedTableNode;
 import org.apache.phoenix.parse.EqualParseNode;
 import org.apache.phoenix.parse.HintNode;
-import org.apache.phoenix.parse.StatelessTraverseAllParseNodeVisitor;
 import org.apache.phoenix.parse.HintNode.Hint;
 import org.apache.phoenix.parse.JoinTableNode;
 import org.apache.phoenix.parse.JoinTableNode.JoinType;
@@ -60,6 +59,7 @@ import org.apache.phoenix.parse.OrderByNode;
 import org.apache.phoenix.parse.ParseNode;
 import org.apache.phoenix.parse.ParseNodeFactory;
 import org.apache.phoenix.parse.SelectStatement;
+import org.apache.phoenix.parse.StatelessTraverseAllParseNodeVisitor;
 import org.apache.phoenix.parse.TableName;
 import org.apache.phoenix.parse.TableNode;
 import org.apache.phoenix.parse.TableNodeVisitor;
@@ -539,7 +539,7 @@ public class JoinCompiler {
                 return lType;
             
             if (!lType.isComparableTo(rType))
-                throw new SQLExceptionInfo.Builder(SQLExceptionCode.CANNOT_CONVERT_TYPE)
+                throw new SQLExceptionInfo.Builder(SQLExceptionCode.TYPE_MISMATCH)
                     .setMessage("On-clause LHS expression and RHS expression must be comparable. LHS type: " + lType + ", RHS type: " + rType)
                     .build().buildException();
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bdae7a88/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java b/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
index b703108..571f0c7 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java
@@ -127,7 +127,6 @@ public enum SQLExceptionCode {
         }
     }),
     CANNOT_DROP_PK(506, "42817", "Primary key column may not be dropped."),
-    CANNOT_CONVERT_TYPE(507, "42846", "Cannot convert type."),
     PRIMARY_KEY_MISSING(509, "42888", "The table does not have a primary key."),
     PRIMARY_KEY_ALREADY_EXISTS(510, "42889", "The table already has a primary key."),
     ORDER_BY_NOT_IN_SELECT_DISTINCT(511, "42890", "All ORDER BY expressions must appear in SELECT DISTINCT:"),

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bdae7a88/phoenix-core/src/main/java/org/apache/phoenix/expression/CaseExpression.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/CaseExpression.java b/phoenix-core/src/main/java/org/apache/phoenix/expression/CaseExpression.java
index c3a0c0b..d4784bb 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/expression/CaseExpression.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/expression/CaseExpression.java
@@ -66,7 +66,7 @@ public class CaseExpression extends BaseCompoundExpression {
             } else if (returnType.isCoercibleTo(childType)) {
                 returnType = childType;
             } else {
-                throw new SQLExceptionInfo.Builder(SQLExceptionCode.CANNOT_CONVERT_TYPE)
+                throw new SQLExceptionInfo.Builder(SQLExceptionCode.TYPE_MISMATCH)
                     .setMessage("Case expressions must have common type: " + returnType + " cannot be coerced to " + childType)
                     .build().buildException();
             }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bdae7a88/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CoalesceFunction.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CoalesceFunction.java b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CoalesceFunction.java
index 2eef8b3..4c6d3a2 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CoalesceFunction.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/CoalesceFunction.java
@@ -66,7 +66,7 @@ public class CoalesceFunction extends ScalarFunction {
             secondChild.evaluate(null, ptr);
 
             if (!secondChild.getDataType().isCoercibleTo(firstChild.getDataType(), secondChild.getDataType().toObject(ptr))) {
-                throw new SQLExceptionInfo.Builder(SQLExceptionCode.CANNOT_CONVERT_TYPE)
+                throw new SQLExceptionInfo.Builder(SQLExceptionCode.TYPE_MISMATCH)
                     .setMessage(getName() + " expected " + firstChild.getDataType() + ", but got " + secondChild.getDataType())
                     .build().buildException();
             }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bdae7a88/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
index 4c1701c..59b1417 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PDataType.java
@@ -5755,7 +5755,7 @@ public enum PDataType {
     }
     
     private static Void throwConstraintViolationException(PDataType source, PDataType target) {
-        throw new ConstraintViolationException(new SQLExceptionInfo.Builder(SQLExceptionCode.CANNOT_CONVERT_TYPE)
+        throw new ConstraintViolationException(new SQLExceptionInfo.Builder(SQLExceptionCode.TYPE_MISMATCH)
         .setMessage(source + " cannot be coerced to " + target).build().buildException());
     }