Carter Shanklin created PHOENIX-1478:
----------------------------------------
Summary: Can't upsert value of 127 into column of type unsigned
tinyint
Key: PHOENIX-1478
URL: https://issues.apache.org/jira/browse/PHOENIX-1478
Project: Phoenix
Issue Type: Bug
Affects Versions: 4.2
Reporter: Carter Shanklin
Priority: Minor
The docs say values from 0 to 127 are valid. From sqlline I can upsert a value
of 126 but not 127. See below.
{code}
$ cat UnsignedTinyintFail.sql
drop table if exists unsigned_tinyint_test;
create table unsigned_tinyint_test (uti unsigned_tinyint primary key);
upsert into unsigned_tinyint_test values (126);
upsert into unsigned_tinyint_test values (127);
{code}
Results in:
{code}
Setting property: [isolation, TRANSACTION_READ_COMMITTED]
Setting property: [run, UnsignedTinyintFail.sql]
issuing: !connect jdbc:phoenix:localhost:2181:/hbase-unsecure none none
org.apache.phoenix.jdbc.PhoenixDriver
Connecting to jdbc:phoenix:localhost:2181:/hbase-unsecure
14/11/15 08:19:57 WARN impl.MetricsConfig: Cannot locate configuration: tried
hadoop-metrics2-phoenix.properties,hadoop-metrics2.properties
Connected to: Phoenix (version 4.2)
Driver: PhoenixEmbeddedDriver (version 4.2)
Autocommit status: true
Transaction isolation: TRANSACTION_READ_COMMITTED
Building list of tables and columns for tab-completion (set fastconnect to true
to skip)...
76/76 (100%) Done
Done
1/4 drop table if exists unsigned_tinyint_test;
No rows affected (0.015 seconds)
2/4 create table unsigned_tinyint_test (uti unsigned_tinyint primary
key);
No rows affected (0.317 seconds)
3/4 upsert into unsigned_tinyint_test values (126);
1 row affected (0.032 seconds)
4/4 upsert into unsigned_tinyint_test values (127);
Error: ERROR 203 (22005): Type mismatch. UNSIGNED_TINYINT and INTEGER for 127
(state=22005,code=203)
org.apache.phoenix.schema.TypeMismatchException: ERROR 203 (22005): Type
mismatch. UNSIGNED_TINYINT and INTEGER for 127
at
org.apache.phoenix.schema.TypeMismatchException.newException(TypeMismatchException.java:52)
at
org.apache.phoenix.expression.LiteralExpression.newConstant(LiteralExpression.java:160)
at
org.apache.phoenix.expression.LiteralExpression.newConstant(LiteralExpression.java:136)
at
org.apache.phoenix.compile.UpsertCompiler$UpsertValuesCompiler.visit(UpsertCompiler.java:854)
at
org.apache.phoenix.compile.UpsertCompiler$UpsertValuesCompiler.visit(UpsertCompiler.java:830)
at
org.apache.phoenix.parse.LiteralParseNode.accept(LiteralParseNode.java:73)
at
org.apache.phoenix.compile.UpsertCompiler.compile(UpsertCompiler.java:721)
at
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:467)
at
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:458)
at
org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:259)
at
org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:252)
at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
at
org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:250)
at
org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1037)
at sqlline.SqlLine$Commands.execute(SqlLine.java:3673)
at sqlline.SqlLine$Commands.sql(SqlLine.java:3584)
at sqlline.SqlLine.dispatch(SqlLine.java:821)
at sqlline.SqlLine.runCommands(SqlLine.java:1793)
at sqlline.SqlLine$Commands.run(SqlLine.java:4161)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sqlline.SqlLine$ReflectiveCommandHandler.execute(SqlLine.java:2810)
at sqlline.SqlLine.dispatch(SqlLine.java:817)
at sqlline.SqlLine.initArgs(SqlLine.java:657)
at sqlline.SqlLine.begin(SqlLine.java:680)
at sqlline.SqlLine.mainWithInputRedirection(SqlLine.java:441)
at sqlline.SqlLine.main(SqlLine.java:424)
Aborting command set because "force" is false and command failed: "upsert into
unsigned_tinyint_test values (127);"
Closing: org.apache.phoenix.jdbc.PhoenixConnection
sqlline version 1.1.2
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)