[ 
https://issues.apache.org/jira/browse/PHOENIX-2983?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

James Taylor updated PHOENIX-2983:
----------------------------------
    Attachment: PHOENIX-2983_v2.patch

Thanks for the review, [~samarthjain]. Here's an updated patch which asserts 
that the source type is coercible to the target type and updates the javadoc to 
make it clear that that is required to be the case before calling this method.

> ClassCastException on auto coerce of BIGINT to DECIMAL
> ------------------------------------------------------
>
>                 Key: PHOENIX-2983
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2983
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: James Taylor
>            Assignee: James Taylor
>              Labels: SFDC
>             Fix For: 4.8.0
>
>         Attachments: PHOENIX-2983.patch, PHOENIX-2983_v2.patch
>
>
> 0: jdbc:phoenix:localhost> CREATE TABLE LONG_BUG ("NAME" VARCHAR PRIMARY KEY, 
> "AMOUNT" DECIMAL);
> No rows affected (0.247 seconds)
> 0: jdbc:phoenix:localhost> UPSERT INTO LONG_BUG ("NAME", "AMOUNT") 
> VALUES('HELLO1', -50000);
> java.lang.ClassCastException: java.lang.Long cannot be cast to 
> java.math.BigDecimal
> at 
> org.apache.phoenix.schema.types.PDecimal.isSizeCompatible(PDecimal.java:312)
> at 
> org.apache.phoenix.compile.UpsertCompiler$3.execute(UpsertCompiler.java:778)
> at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:300)
> at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:292)
> at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
> at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:290)
> at 
> org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1191)
> at sqlline.Commands.execute(Commands.java:822)
> at sqlline.Commands.sql(Commands.java:732)
> at sqlline.SqlLine.dispatch(SqlLine.java:808)
> at sqlline.SqlLine.begin(SqlLine.java:681)
> at sqlline.SqlLine.start(SqlLine.java:398)
> at sqlline.SqlLine.main(SqlLine.java:292)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to