You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ya...@apache.org on 2020/01/10 22:56:54 UTC

[phoenix] branch 4.x-HBase-1.4 updated: PHOENIX-5668: Add Full table name to the error message for constraint violation exceptions

This is an automated email from the ASF dual-hosted git repository.

yanxinyi pushed a commit to branch 4.x-HBase-1.4
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/4.x-HBase-1.4 by this push:
     new d89ee52  PHOENIX-5668: Add Full table name to the error message for constraint violation exceptions
d89ee52 is described below

commit d89ee52f6988349b4e6bd096cd6e759a5416f2f2
Author: Neha <ne...@salesforce.com>
AuthorDate: Wed Jan 8 19:16:06 2020 -0800

    PHOENIX-5668: Add Full table name to the error message for constraint violation exceptions
    
    Signed-off-by: Xinyi Yan <xy...@salesforce.com>
---
 .../it/java/org/apache/phoenix/end2end/DefaultColumnValueIT.java    | 2 ++
 .../src/main/java/org/apache/phoenix/compile/UpsertCompiler.java    | 6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DefaultColumnValueIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DefaultColumnValueIT.java
index 59b15d8..815e894 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DefaultColumnValueIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DefaultColumnValueIT.java
@@ -393,6 +393,7 @@ public class DefaultColumnValueIT extends ParallelStatsDisabledIT {
             fail();
         } catch (SQLException e) {
             assertEquals(SQLExceptionCode.CONSTRAINT_VIOLATION.getErrorCode(), e.getErrorCode());
+            assertTrue(e.getMessage().contains(table));
         }
 
         dml = "UPSERT INTO " + table + " VALUES (1, 2)";
@@ -401,6 +402,7 @@ public class DefaultColumnValueIT extends ParallelStatsDisabledIT {
             fail();
         } catch (SQLException e) {
             assertEquals(SQLExceptionCode.CONSTRAINT_VIOLATION.getErrorCode(), e.getErrorCode());
+            assertTrue(e.getMessage().contains(table));
         }
 
         dml = "UPSERT INTO " + table + " VALUES (1, 2, 3)";
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
index 38da86c..93135aa 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
@@ -523,7 +523,8 @@ public class UpsertCompiler {
             for (i = posOffset; i < table.getColumns().size(); i++) {
                 PColumn column = table.getColumns().get(i);
                 if (!columnsBeingSet.get(i) && !column.isNullable() && column.getExpressionStr() == null) {
-                    throw new ConstraintViolationException(SchemaUtil.getColumnDisplayName(column) + " may not be null");
+                    throw new ConstraintViolationException(table.getName().getString() + "."
+                            + SchemaUtil.getColumnDisplayName(column) + " may not be null");
                 }
             }
         }
@@ -621,7 +622,8 @@ public class UpsertCompiler {
             for (int i = posOffset + nValuesToSet; i < table.getColumns().size(); i++) {
                 PColumn column = table.getColumns().get(i);
                 if (!column.isNullable() && column.getExpressionStr() == null) {
-                    throw new ConstraintViolationException(SchemaUtil.getColumnDisplayName(column) + " may not be null");
+                    throw new ConstraintViolationException(table.getName().getString() + "."
+                            + SchemaUtil.getColumnDisplayName(column) + " may not be null");
                 }
             }
         }