Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
4.3.0
-
None
-
None
-
Windows 7, Java 8
Description
The following test fails:
Test.java
@Test public void testPhoenix5() throws Exception { try (Connection con = DriverManager.getConnection( "jdbc:phoenix:cluster02,cluster03,cluster04:2181:/hbase-unsecure")) { Statement stmt = con.createStatement(); stmt.executeUpdate("drop table if exists test_tinyint"); stmt.executeUpdate( "create table test_tinyint (i tinyint not null primary key)"); stmt.executeUpdate("upsert into test_tinyint values (-1)"); con.commit(); } }
The exception is as follows:
org.apache.phoenix.schema.TypeMismatchException: ERROR 203 (22005): Type mismatch. TINYINT and TINYINT for expression: -1 in column I at org.apache.phoenix.schema.TypeMismatchException.newException(TypeMismatchException.java:53) at org.apache.phoenix.compile.UpsertCompiler$3.execute(UpsertCompiler.java:773) at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:280) at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:272) at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53) at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:270) at org.apache.phoenix.jdbc.PhoenixStatement.executeUpdate(PhoenixStatement.java:1052) at com.innowireless.gas.hbase.PhoenixTest.testPhoenix5(PhoenixTest.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
When value (-1) is replaced with (-2) or (0 - 1) or (-2 + 1), it works.