[
https://issues.apache.org/jira/browse/PHOENIX-3210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15437756#comment-15437756
]
James Taylor commented on PHOENIX-3210:
---------------------------------------
[~prakul] - want to take a crack at this one? I suspect it's line 320 in
PDecimal.isSizeCompatible():
{code}
if (value != null) {
BigDecimal v = (BigDecimal) value;
{code}
Instead, we shouldn't assume that value is a BigDecimal, but change it to this:
{code}
if (value != null) {
BigDecimal v = toObject(value, srcType);
{code}
Need to come up with a test that repros this. Try this:
{code}
CREATE TABLE T(K INTEGER PRIMARY KEY, V DECIMAL(8,2));
UPSERT INTO T VALUES(1,2.3);
{code}
> Exception trying to cast Double to BigDecimal in UpsertCompiler
> ---------------------------------------------------------------
>
> Key: PHOENIX-3210
> URL: https://issues.apache.org/jira/browse/PHOENIX-3210
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.7.0
> Reporter: Shehzaad Nakhoda
> Labels: SFDC
> Fix For: 4.9.0, 4.8.1
>
>
> We have an UPSERT statement that is resulting in this stack trace.
> Unfortunately I can't get a hold of the actual Upsert statement since we
> don't log it.
> Cause0: java.lang.ClassCastException: java.lang.Double cannot be cast to
> java.math.BigDecimal
> Cause0-StackTrace:
> at
> org.apache.phoenix.schema.types.PDecimal.isSizeCompatible(PDecimal.java:312)
> at
> org.apache.phoenix.compile.UpsertCompiler$3.execute(UpsertCompiler.java:887)
> at
> org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:335)
> at
> org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:323)
> at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:321)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.executeUpdate(PhoenixStatement.java:1274)
> at
> phoenix.connection.ProtectedPhoenixStatement.executeUpdate(ProtectedPhoenixStatement.java:127)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)