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

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


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

commit ef82f6ca558a2ac6a955041439a8af4ad272e454
Author: Neha <neha.gu...@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 <x...@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");
                 }
             }
         }

Reply via email to