diff --git a/java/client/src/main/java/io/vitess/client/Proto.java b/java/client/src/main/java/io/vitess/client/Proto.java index 781a4592e17..2f15ccb4baa 100644 --- a/java/client/src/main/java/io/vitess/client/Proto.java +++ b/java/client/src/main/java/io/vitess/client/Proto.java @@ -300,10 +300,13 @@ protected static class TypedValue { this.type = Query.Type.VARBINARY; this.value = ByteString.copyFrom((byte[]) value); } else if (value instanceof Integer || value instanceof Long || value instanceof Short - || value instanceof Byte || value instanceof BigInteger) { + || value instanceof Byte ) { // Int32, Int64, Short, Byte this.type = Query.Type.INT64; this.value = ByteString.copyFromUtf8(value.toString()); + } else if (value instanceof BigInteger) { + this.type = Query.Type.VARCHAR; + this.value = ByteString.copyFromUtf8(value.toString()); } else if (value instanceof UnsignedLong) { // Uint64 this.type = Query.Type.UINT64; diff --git a/java/client/src/test/java/io/vitess/client/BindVarTest.java b/java/client/src/test/java/io/vitess/client/BindVarTest.java index bc52b2e6fff..28bcee59f23 100644 --- a/java/client/src/test/java/io/vitess/client/BindVarTest.java +++ b/java/client/src/test/java/io/vitess/client/BindVarTest.java @@ -118,7 +118,7 @@ public static Collection testParams() { BindVariable.newBuilder().setType(Query.Type.DECIMAL) .setValue(ByteString.copyFromUtf8("0.000000000123456789123456789")).build()}, {new BigInteger("123456789123456789"), - BindVariable.newBuilder().setType(Query.Type.INT64) + BindVariable.newBuilder().setType(Query.Type.VARCHAR) .setValue(ByteString.copyFromUtf8("123456789123456789")).build()}, // List of Int {Arrays.asList(1, 2, 3),