phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Taylor (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PHOENIX-1967) ClassCastException when upserting an Unsigned array
Date Sat, 23 Jan 2016 22:18:39 GMT

    [ https://issues.apache.org/jira/browse/PHOENIX-1967?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15113993#comment-15113993
] 

James Taylor commented on PHOENIX-1967:
---------------------------------------

Is this already fixed, [~Dumindux]?

> ClassCastException when upserting an Unsigned array
> ---------------------------------------------------
>
>                 Key: PHOENIX-1967
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1967
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Dumindu Buddhika
>            Assignee: Dumindu Buddhika
>
> {code}
> Connection conn = DriverManager.getConnection(getUrl());
> Object[] s = new Object[]{2,3};
> conn.createStatement().execute("CREATE TABLE t ( k VARCHAR PRIMARY KEY, a UNSIGNED_INT[])");
> conn.commit();
> PreparedStatement stmt = conn.prepareStatement("UPSERT INTO t VALUES('a',?)");
> PhoenixArray array = (PhoenixArray) conn.createArrayOf("UNSIGNED_INT", s);
> stmt.setArray(1, array);
> stmt.execute();
> conn.commit();
> {code}
> Results in,
> java.lang.ClassCastException: [I cannot be cast to [Ljava.lang.Object;
> 	at org.apache.phoenix.schema.types.PUnsignedIntArray.isCoercibleTo(PUnsignedIntArray.java:83)
> 	at org.apache.phoenix.expression.LiteralExpression.newConstant(LiteralExpression.java:168)
> 	at org.apache.phoenix.expression.LiteralExpression.newConstant(LiteralExpression.java:143)
> 	at org.apache.phoenix.compile.UpsertCompiler$UpsertValuesCompiler.visit(UpsertCompiler.java:858)
> 	at org.apache.phoenix.compile.UpsertCompiler$UpsertValuesCompiler.visit(UpsertCompiler.java:842)
> 	at org.apache.phoenix.parse.BindParseNode.accept(BindParseNode.java:47)
> 	at org.apache.phoenix.compile.UpsertCompiler.compile(UpsertCompiler.java:733)
> 	at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:516)
> 	at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:507)
> 	at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:297)
> 	at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:290)
> 	at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
> 	at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:288)
> 	at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:220)
> 	at org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(PhoenixPreparedStatement.java:173)
> 	at org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(PhoenixPreparedStatement.java:178)



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

Mime
View raw message