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:23 UTC
[phoenix] branch master 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 master
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/master by this push:
new 2ba0015 PHOENIX-5668: Add Full table name to the error message for constraint violation exceptions
2ba0015 is described below
commit 2ba00157878e56707a85bbbeb13ced12148c5652
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 8e7aa05..97447f2 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");
}
}
}