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/10/20 03:33:01 UTC
[phoenix] branch 4.x updated: PHOENIX-6189
DATA_EXCEEDS_MAX_CAPACITY exception error string should contain column name
instead of actual value
This is an automated email from the ASF dual-hosted git repository.
yanxinyi pushed a commit to branch 4.x
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/4.x by this push:
new 3fc9727 PHOENIX-6189 DATA_EXCEEDS_MAX_CAPACITY exception error string should contain column name instead of actual value
3fc9727 is described below
commit 3fc9727457c6c9ec28d0a9aecd5f088b0bd6704b
Author: Xinyi Yan <xy...@salesforce.com>
AuthorDate: Thu Oct 15 16:08:37 2020 -0700
PHOENIX-6189 DATA_EXCEEDS_MAX_CAPACITY exception error string should contain column name instead of actual value
Signed-off-by: Xinyi Yan <ya...@apache.org>
---
.../org/apache/phoenix/end2end/UpsertSelectIT.java | 11 ++++++++---
.../org/apache/phoenix/compile/UpsertCompiler.java | 14 +++++---------
.../coprocessor/UngroupedAggregateRegionObserver.java | 7 +++++--
.../exception/DataExceedsCapacityException.java | 18 +++++++++++++++++-
.../phoenix/expression/DecimalAddExpression.java | 2 +-
.../phoenix/expression/DecimalDivideExpression.java | 3 ++-
.../phoenix/expression/DecimalMultiplyExpression.java | 3 ++-
.../phoenix/expression/DecimalSubtractExpression.java | 2 +-
.../expression/function/ArrayModifierFunction.java | 2 +-
.../org/apache/phoenix/index/PhoenixIndexBuilder.java | 2 +-
.../main/java/org/apache/phoenix/parse/ColumnDef.java | 7 +++----
.../java/org/apache/phoenix/schema/PTableImpl.java | 7 ++++---
.../java/org/apache/phoenix/schema/types/PBinary.java | 2 +-
.../java/org/apache/phoenix/schema/types/PChar.java | 2 +-
.../main/java/org/apache/phoenix/util/SchemaUtil.java | 3 ++-
.../java/org/apache/phoenix/schema/MutationTest.java | 19 ++++++++++++++++++-
16 files changed, 72 insertions(+), 32 deletions(-)
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
index 6f0f877..c55e9b7 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
@@ -1635,6 +1635,9 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT {
props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS,
allowServerSideMutations);
String t1 = generateUniqueName();
+ String validValue = "澴粖蟤य褻酃岤豦팑薰鄩脼ժ끦碉碉碉碉碉碉";
+ String invalidValue = "澴粖蟤य褻酃岤豦팑薰鄩脼ժ끦碉碉碉碉碉碉碉";
+ String columnTypeInfo = "VARCHAR(20)";
try (Connection conn = DriverManager.getConnection(getUrl(), props);
Statement stmt = conn.createStatement()) {
@@ -1654,7 +1657,7 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT {
Statement stmt = conn.createStatement()) {
conn.setAutoCommit(autoCommit);
stmt.execute("upsert into " + t1 + " (id, v) select id, "
- + "'澴粖蟤य褻酃岤豦팑薰鄩脼ժ끦碉碉碉碉碉碉' from " + t1 + " WHERE id = 1");
+ + "'" + validValue + "' from " + t1 + " WHERE id = 1");
conn.commit();
}
@@ -1665,18 +1668,20 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT {
assertTrue(rs.next());
assertEquals(1, rs.getLong(1));
- assertEquals("澴粖蟤य褻酃岤豦팑薰鄩脼ժ끦碉碉碉碉碉碉", rs.getString(2));
+ assertEquals(validValue, rs.getString(2));
}
try (Connection conn = DriverManager.getConnection(getUrl(), props);
Statement stmt = conn.createStatement()) {
conn.setAutoCommit(autoCommit);
stmt.execute("upsert into " + t1 + " (id, v) select id, "
- + "'澴粖蟤य褻酃岤豦팑薰鄩脼ժ끦碉碉碉碉碉碉碉' from " + t1 + " WHERE id = 1");
+ + "'" + invalidValue + "' from " + t1 + " WHERE id = 1");
conn.commit();
fail();
} catch (SQLException e) {
assertEquals(SQLExceptionCode.DATA_EXCEEDS_MAX_CAPACITY.getErrorCode(), e.getErrorCode());
+ assertFalse(e.getMessage().contains(invalidValue));
+ assertTrue(e.getMessage().contains(columnTypeInfo));
}
}
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 83c575f..67b8c50 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
@@ -45,6 +45,7 @@ import org.apache.phoenix.compile.OrderByCompiler.OrderBy;
import org.apache.phoenix.coprocessor.BaseScannerRegionObserver;
import org.apache.phoenix.coprocessor.MetaDataProtocol;
import org.apache.phoenix.coprocessor.UngroupedAggregateRegionObserver;
+import org.apache.phoenix.exception.DataExceedsCapacityException;
import org.apache.phoenix.exception.SQLExceptionCode;
import org.apache.phoenix.exception.SQLExceptionInfo;
import org.apache.phoenix.execute.AggregatePlan;
@@ -269,12 +270,8 @@ public class UpsertCompiler {
if (!column.getDataType().isSizeCompatible(ptr, value, column.getDataType(),
SortOrder.getDefault(), precision,
scale, column.getMaxLength(), column.getScale())) {
- throw new SQLExceptionInfo.Builder(
- SQLExceptionCode.DATA_EXCEEDS_MAX_CAPACITY).setColumnName(
- column.getName().getString())
- .setMessage("value=" + column.getDataType()
- .toStringLiteral(ptr, null)).build()
- .buildException();
+ throw new DataExceedsCapacityException(column.getDataType(), column.getMaxLength(),
+ column.getScale(), column.getName().getString());
}
column.getDataType().coerceBytes(ptr, value, column.getDataType(),
precision, scale, SortOrder.getDefault(),
@@ -1258,9 +1255,8 @@ public class UpsertCompiler {
if (!column.getDataType().isSizeCompatible(ptr, value, constantExpression.getDataType(),
constantExpression.getSortOrder(), constantExpression.getMaxLength(),
constantExpression.getScale(), column.getMaxLength(), column.getScale())) {
- throw new SQLExceptionInfo.Builder(
- SQLExceptionCode.DATA_EXCEEDS_MAX_CAPACITY).setColumnName(column.getName().getString())
- .setMessage("value=" + constantExpression.toString()).build().buildException();
+ throw new DataExceedsCapacityException(column.getDataType(), column.getMaxLength(),
+ column.getScale(), column.getName().getString());
}
}
column.getDataType().coerceBytes(ptr, value, constantExpression.getDataType(),
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
index 7b66364..18866f3 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
@@ -83,6 +83,7 @@ import org.apache.phoenix.cache.TenantCache;
import org.apache.phoenix.coprocessor.generated.PTableProtos;
import org.apache.phoenix.exception.DataExceedsCapacityException;
import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.exception.SQLExceptionInfo;
import org.apache.phoenix.execute.TupleProjector;
import org.apache.phoenix.expression.Expression;
import org.apache.phoenix.expression.ExpressionType;
@@ -757,8 +758,10 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver
expression.getMaxLength(), expression.getScale(),
column.getMaxLength(), column.getScale())) {
throw new DataExceedsCapacityException(
- column.getDataType(), column.getMaxLength(),
- column.getScale(), column.getName().getString(), ptr);
+ column.getDataType(),
+ column.getMaxLength(),
+ column.getScale(),
+ column.getName().getString());
}
column.getDataType().coerceBytes(ptr, null,
expression.getDataType(), expression.getMaxLength(),
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/exception/DataExceedsCapacityException.java b/phoenix-core/src/main/java/org/apache/phoenix/exception/DataExceedsCapacityException.java
index a12c8a0..89f0fe4 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/exception/DataExceedsCapacityException.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/exception/DataExceedsCapacityException.java
@@ -30,16 +30,32 @@ public class DataExceedsCapacityException extends IllegalDataException {
super(new SQLExceptionInfo.Builder(
SQLExceptionCode.DATA_EXCEEDS_MAX_CAPACITY).setMessage(message).build().buildException());
}
-
+
+ public DataExceedsCapacityException(PDataType type, Integer precision, Integer scale,
+ String columnName) {
+ super(new SQLExceptionInfo.Builder(SQLExceptionCode.DATA_EXCEEDS_MAX_CAPACITY)
+ .setMessage((columnName == null ? "" : columnName + " ")
+ + getTypeDisplayString(type, precision, scale))
+ .build().buildException());
+ }
+
+ private static String getTypeDisplayString(PDataType type, Integer precision, Integer scale) {
+ return type.toString() + "(" + precision + (scale == null ? "" : ("," + scale)) + ")";
+ }
+
+ @Deprecated
public DataExceedsCapacityException(PDataType type, Integer precision, Integer scale, String columnName, ImmutableBytesWritable value) {
super(new SQLExceptionInfo.Builder(SQLExceptionCode.DATA_EXCEEDS_MAX_CAPACITY)
.setMessage((columnName == null ? "" : columnName + " ") + getTypeDisplayString(type, precision, scale, value))
.build().buildException());
}
+
+ @Deprecated
public DataExceedsCapacityException(PDataType type, Integer precision, Integer scale) {
this(type, precision, scale, null, null);
}
+ @Deprecated
private static String getTypeDisplayString(PDataType type, Integer precision, Integer scale, ImmutableBytesWritable value) {
return type.toString() + "(" + precision + (scale == null ? "" : ("," + scale)) + ")" + (value == null || value.getLength() == 0 ? "" : (" value="+SchemaUtil.toString(type, value)));
}
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/DecimalAddExpression.java b/phoenix-core/src/main/java/org/apache/phoenix/expression/DecimalAddExpression.java
index 44c1590..efc66c3 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/expression/DecimalAddExpression.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/expression/DecimalAddExpression.java
@@ -74,7 +74,7 @@ public class DecimalAddExpression extends AddExpression {
result = NumberUtil.setDecimalWidthAndScale(result, maxLength, scale);
}
if (result == null) {
- throw new DataExceedsCapacityException(PDecimal.INSTANCE, maxLength, scale);
+ throw new DataExceedsCapacityException(PDecimal.INSTANCE, maxLength, scale, null);
}
ptr.set(PDecimal.INSTANCE.toBytes(result));
return true;
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/DecimalDivideExpression.java b/phoenix-core/src/main/java/org/apache/phoenix/expression/DecimalDivideExpression.java
index 4d09f0f..78441a6 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/expression/DecimalDivideExpression.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/expression/DecimalDivideExpression.java
@@ -64,7 +64,8 @@ public class DecimalDivideExpression extends DivideExpression {
result = NumberUtil.setDecimalWidthAndScale(result, getMaxLength(), getScale());
}
if (result == null) {
- throw new DataExceedsCapacityException(PDecimal.INSTANCE, getMaxLength(), getScale());
+ throw new DataExceedsCapacityException(
+ PDecimal.INSTANCE, getMaxLength(), getScale(), null);
}
ptr.set(PDecimal.INSTANCE.toBytes(result));
return true;
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/DecimalMultiplyExpression.java b/phoenix-core/src/main/java/org/apache/phoenix/expression/DecimalMultiplyExpression.java
index 813a0e1..536c1a8 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/expression/DecimalMultiplyExpression.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/expression/DecimalMultiplyExpression.java
@@ -64,7 +64,8 @@ public class DecimalMultiplyExpression extends MultiplyExpression {
result = NumberUtil.setDecimalWidthAndScale(result, getMaxLength(), getScale());
}
if (result == null) {
- throw new DataExceedsCapacityException(PDecimal.INSTANCE, getMaxLength(), getScale());
+ throw new DataExceedsCapacityException(
+ PDecimal.INSTANCE, getMaxLength(), getScale(), null);
}
ptr.set(PDecimal.INSTANCE.toBytes(result));
return true;
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/DecimalSubtractExpression.java b/phoenix-core/src/main/java/org/apache/phoenix/expression/DecimalSubtractExpression.java
index 9dc8816..70754fd 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/expression/DecimalSubtractExpression.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/expression/DecimalSubtractExpression.java
@@ -92,7 +92,7 @@ public class DecimalSubtractExpression extends SubtractExpression {
result = NumberUtil.setDecimalWidthAndScale(result, maxLength, scale);
}
if (result == null) {
- throw new DataExceedsCapacityException(PDecimal.INSTANCE, maxLength, scale);
+ throw new DataExceedsCapacityException(PDecimal.INSTANCE, maxLength, scale, null);
}
ptr.set(PDecimal.INSTANCE.toBytes(result));
return true;
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayModifierFunction.java b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayModifierFunction.java
index b53ca85..b69f26c 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayModifierFunction.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayModifierFunction.java
@@ -74,7 +74,7 @@ public abstract class ArrayModifierFunction extends ScalarFunction {
if (getDataType() != null && arrayExpr.getScale() != null && otherExpr.getScale() != null
&& otherExpr.getScale() > arrayExpr.getScale()) {
throw new DataExceedsCapacityException(baseDataType, arrayExpr.getMaxLength(),
- arrayExpr.getScale());
+ arrayExpr.getScale(), null);
}
init();
}
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexBuilder.java b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexBuilder.java
index 7a706bd..ca7c637 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexBuilder.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexBuilder.java
@@ -232,7 +232,7 @@ public class PhoenixIndexBuilder extends NonTxIndexBuilder {
expression.getSortOrder(), expression.getMaxLength(), expression.getScale(),
column.getMaxLength(), column.getScale())) {
throw new DataExceedsCapacityException(column.getDataType(), column.getMaxLength(),
- column.getScale());
+ column.getScale(), column.getName().getString());
}
column.getDataType().coerceBytes(ptr, value, expression.getDataType(), expression.getMaxLength(),
expression.getScale(), expression.getSortOrder(),column.getMaxLength(), column.getScale(),
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/parse/ColumnDef.java b/phoenix-core/src/main/java/org/apache/phoenix/parse/ColumnDef.java
index 0be7c16..269c2c4 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/parse/ColumnDef.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/ColumnDef.java
@@ -22,6 +22,7 @@ import java.sql.SQLException;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.phoenix.compile.ExpressionCompiler;
import org.apache.phoenix.compile.StatementContext;
+import org.apache.phoenix.exception.DataExceedsCapacityException;
import org.apache.phoenix.exception.SQLExceptionCode;
import org.apache.phoenix.exception.SQLExceptionInfo;
import org.apache.phoenix.expression.Determinism;
@@ -283,10 +284,8 @@ public class ColumnDef {
if (!targetType.isSizeCompatible(ptr, defaultValue.getValue(), sourceType,
sortOrder, defaultValue.getMaxLength(),
defaultValue.getScale(), this.getMaxLength(), this.getScale())) {
- throw new SQLExceptionInfo.Builder(
- SQLExceptionCode.DATA_EXCEEDS_MAX_CAPACITY).setColumnName(this.getColumnDefName().getColumnName())
- .setMessage("DEFAULT " + this.getExpression()).build()
- .buildException();
+ throw new DataExceedsCapacityException(this.getDataType(), this.getMaxLength(),
+ this.getScale(), this.getColumnDefName().getColumnName());
}
return true;
}
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
index dd6dccc..139f084 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
@@ -1083,7 +1083,8 @@ public class PTableImpl implements PTable {
Integer scale = column.getScale();
key.set(byteValue);
if (!type.isSizeCompatible(key, null, type, sortOrder, null, null, maxLength, scale)) {
- throw new DataExceedsCapacityException(name.getString() + "." + column.getName().getString() + " may not exceed " + maxLength + " (" + SchemaUtil.toString(type, byteValue) + ")");
+ throw new DataExceedsCapacityException(column.getDataType(), maxLength,
+ column.getScale(), column.getName().getString());
}
key.set(byteValue);
type.pad(key, maxLength, sortOrder);
@@ -1351,8 +1352,8 @@ public class PTableImpl implements PTable {
Integer scale = column.getScale();
SortOrder sortOrder = column.getSortOrder();
if (!type.isSizeCompatible(ptr, null, type, sortOrder, null, null, maxLength, scale)) {
- throw new DataExceedsCapacityException(name.getString() + "." + column.getName().getString() +
- " may not exceed " + maxLength + " (" + SchemaUtil.toString(type, byteValue) + ")");
+ throw new DataExceedsCapacityException(column.getDataType(), maxLength,
+ column.getScale(), column.getName().getString());
}
ptr.set(byteValue);
type.pad(ptr, maxLength, sortOrder);
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PBinary.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PBinary.java
index 3a9dcc7..b6d2c82 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PBinary.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PBinary.java
@@ -79,7 +79,7 @@ public class PBinary extends PBinaryBase {
return object;
}
if (length > maxLength) {
- throw new DataExceedsCapacityException(this, maxLength, null);
+ throw new DataExceedsCapacityException(this, maxLength, null, null);
}
byte[] newBytes = new byte[maxLength];
System.arraycopy(b, 0, newBytes, 0, length);
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
index fa97992..017e813 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PChar.java
@@ -73,7 +73,7 @@ public class PChar extends PDataType<String> {
return object;
}
if (s.length() > maxLength) {
- throw new DataExceedsCapacityException(this,maxLength,null);
+ throw new DataExceedsCapacityException(this, maxLength, null, null);
}
return Strings.padEnd(s, maxLength, ' ');
}
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/SchemaUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/SchemaUtil.java
index 25c409d..3f1f0bb 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/SchemaUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/SchemaUtil.java
@@ -1177,7 +1177,8 @@ public class SchemaUtil {
if (ptr.getLength() < maxLength) {
type.pad(ptr, maxLength, column.getSortOrder());
} else if (ptr.getLength() > maxLength) {
- throw new DataExceedsCapacityException(tableName + "." + column.getName().getString() + " may not exceed " + maxLength + " bytes (" + type.toObject(byteValue) + ")");
+ throw new DataExceedsCapacityException(column.getDataType(), column.getMaxLength(),
+ column.getScale(), column.getName().getString());
}
}
}
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/schema/MutationTest.java b/phoenix-core/src/test/java/org/apache/phoenix/schema/MutationTest.java
index 7f5066a..0c3262e 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/schema/MutationTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/schema/MutationTest.java
@@ -82,28 +82,41 @@ public class MutationTest extends BaseConnectionlessQueryTest {
String bvalue = "01234567890123456789";
assertEquals(20,PVarchar.INSTANCE.toBytes(bvalue).length);
String value = "澴粖蟤य褻酃岤豦팑薰鄩脼ժ끦碉碉碉碉碉";
+ String validValue = "abcd";
+ String columnTypeInfo1 = "CHAR(3)";
+ String columnTypeInto2 = "VARBINARY(20)";
+ String columnTypeInto3 = "BINARY(20)";
+ String columnTypeInto4 = "VARCHAR(20)";
+
assertTrue(value.length() <= maxLength2);
assertTrue(PVarchar.INSTANCE.toBytes(value).length > maxLength2);
conn.createStatement().execute("CREATE TABLE t1 (k1 char(" + maxLength1 + ") not null, k2 varchar(" + maxLength2 + "), "
+ "v1 varchar(" + maxLength2 + "), v2 varbinary(" + maxLength2 + "), v3 binary(" + maxLength2 + "), constraint pk primary key (k1, k2))");
conn.createStatement().execute("UPSERT INTO t1 VALUES('a','" + value + "', '" + value + "','" + bvalue + "','" + bvalue + "')");
try {
- conn.createStatement().execute("UPSERT INTO t1(k1,v1) VALUES('abcd','" + value + "')");
+ conn.createStatement().execute("UPSERT INTO t1(k1,v1) VALUES('"
+ + validValue+ "','" + value + "')");
fail();
} catch (SQLException e) {
assertEquals(SQLExceptionCode.DATA_EXCEEDS_MAX_CAPACITY.getErrorCode(),e.getErrorCode());
+ assertFalse(e.getMessage().contains(validValue));
+ assertTrue(e.getMessage().contains(columnTypeInfo1));
}
try {
conn.createStatement().execute("UPSERT INTO t1(k1,v2) VALUES('b','" + value + "')");
fail();
} catch (SQLException e) {
assertEquals(SQLExceptionCode.DATA_EXCEEDS_MAX_CAPACITY.getErrorCode(),e.getErrorCode());
+ assertFalse(e.getMessage().contains(value));
+ assertTrue(e.getMessage().contains(columnTypeInto2));
}
try {
conn.createStatement().execute("UPSERT INTO t1(k1,v3) VALUES('b','" + value + "')");
fail();
} catch (SQLException e) {
assertEquals(SQLExceptionCode.DATA_EXCEEDS_MAX_CAPACITY.getErrorCode(),e.getErrorCode());
+ assertFalse(e.getMessage().contains(value));
+ assertTrue(e.getMessage().contains(columnTypeInto3));
}
value = "澴粖蟤य褻酃岤豦팑薰鄩脼ժ끦碉碉碉碉碉碉碉碉碉";
assertTrue(value.length() > maxLength2);
@@ -112,12 +125,16 @@ public class MutationTest extends BaseConnectionlessQueryTest {
fail();
} catch (SQLException e) {
assertEquals(SQLExceptionCode.DATA_EXCEEDS_MAX_CAPACITY.getErrorCode(),e.getErrorCode());
+ assertFalse(e.getMessage().contains(value));
+ assertTrue(e.getMessage().contains(columnTypeInto4));
}
try {
conn.createStatement().execute("UPSERT INTO t1(k1,v1) VALUES('a','" + value + "')");
fail();
} catch (SQLException e) {
assertEquals(SQLExceptionCode.DATA_EXCEEDS_MAX_CAPACITY.getErrorCode(),e.getErrorCode());
+ assertFalse(e.getMessage().contains(value));
+ assertTrue(e.getMessage().contains(columnTypeInto4));
}
} finally {
conn.close();