[ https://issues.apache.org/jira/browse/PHOENIX-2983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15327749#comment-15327749 ]
Samarth Jain commented on PHOENIX-2983: --------------------------------------- [~jamestaylor] - considering one can invoke PDecimal.isSizeCompatible() before checking that the srcType is coercible to decimal or not, shouldn't we be checking the same while making the size compatibility check? At a minimum, IMHO, we should be checking whether the sourceType is one of the numeric types. Something like: {code} if (srcType instanceof PNumericType) { return true; } {code} > 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 > > > 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)