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

Thomas D'Silva commented on PHOENIX-2765:
-----------------------------------------

I get an exception when I try to use setBytes. Can you try using setInt

org.apache.phoenix.schema.TypeMismatchException: ERROR 203 (22005): Type 
mismatch. SMALLINT and VARBINARY for [B@5633ed82
at 
org.apache.phoenix.schema.TypeMismatchException.newException(TypeMismatchException.java:53)
at 
org.apache.phoenix.expression.LiteralExpression.newConstant(LiteralExpression.java:192)
at 
org.apache.phoenix.expression.LiteralExpression.newConstant(LiteralExpression.java:172)
at 
org.apache.phoenix.expression.LiteralExpression.newConstant(LiteralExpression.java:159)
at 
org.apache.phoenix.compile.UpsertCompiler$UpsertValuesCompiler.visit(UpsertCompiler.java:979)
at 
org.apache.phoenix.compile.ExpressionCompiler.visit(ExpressionCompiler.java:1)
at org.apache.phoenix.parse.BindParseNode.accept(BindParseNode.java:47)
at org.apache.phoenix.compile.UpsertCompiler.compile(UpsertCompiler.java:832)
at 
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:578)
at 
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:1)
at org.apache.phoenix.jdbc.PhoenixStatement$3.call(PhoenixStatement.java:331)
at org.apache.phoenix.jdbc.PhoenixStatement$3.call(PhoenixStatement.java:1)
at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
at 
org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:325)
at 
org.apache.phoenix.jdbc.PhoenixPreparedStatement.executeUpdate(PhoenixPreparedStatement.java:199)
at 
org.apache.phoenix.end2end.DynamicColumnIT.testManyDynamicCols(DynamicColumnIT.java:302)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

> PhoenixConnection commit throws ArrayIndexOutOfBoundsException after 
> upserting multiple rows with dynamic columns
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-2765
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2765
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.6.0
>            Reporter: Clifford Ker
>            Assignee: Thomas D'Silva
>
> 1. Create a Phoenix table with dynamic columns.
> 2. Obtain a PhoenixConnection and PreparedStatement.
> 3. Use the PreparedStatement to upsert multiple records using dynamic columns.
> 4. Commit the transaction.
> 5. Phoenix will throw ArrayIndexOutOfBoundException.
> java.lang.ArrayIndexOutOfBoundsException: 14
>     at 
> org.apache.phoenix.execute.MutationState.validate(MutationState.java:384)
>     at org.apache.phoenix.execute.MutationState.commit(MutationState.java:419)
>     at 
> org.apache.phoenix.jdbc.PhoenixConnection$3.call(PhoenixConnection.java:476)
>     at 
> org.apache.phoenix.jdbc.PhoenixConnection$3.call(PhoenixConnection.java:473)
>     at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
>     at 
> org.apache.phoenix.jdbc.PhoenixConnection.commit(PhoenixConnection.java:473)
>     at 
> phoenix.connection.ProtectedPhoenixConnection.commit(ProtectedPhoenixConnection.java:41
> Pseudo Code and DML
> CREATE TABLE IF NOT EXISTS FOO_RECORD
>     (
>     KEY1 char(15) not null,
>     KEY2 char(15) not null,
>     KEY3 SMALLINT not null,
>     STATUS TINYINT not null,  
>     KEY4 varchar(30), 
>     KEY5 char(15) not null,   
>     FOO_RECORD_ID char(15),   
>     SYSMODSTAMP TIMESTAMP,    
>     "av"."_" char(1),                         -- Column family av
>     "rv"."_" char(1),                         -- Column family rv
>     "fd"."_" char(1),                         -- Column family dv
>     CONSTRAINT PK PRIMARY KEY (
>       KEY1,
>       KEY2,
>       KEY3,
>       STATUS,
>       KEY4,
>         KEY5
>     )
> ) VERSIONS=1,MULTI_TENANT=true,REPLICATION_SCOPE=1
> try {
>                 PreparedStatement preparedStmt = 
> phoenixConnection.prepareStatement(upsertStatement);
>                 for (DARecord record : daRecords) {
>                     prepareToUpserFooRecord(preparedStmt, fieldInfo, record);
>                 }
>                 preparedStmt.close();
>                 phoenixConnection.commit();
>             } finally {
>                 phoenixConnection.close();
>             }
> UPSERT INTO FOO_RECORD(
> KEY1, KEY2, KEY3, STATUS, KEY4, KEY5, SYSMODSTAMP, "fa"."FIELD1" VARCHAR, 
> "av"."FIELD2" VARCHAR, "av"."FIELD3" VARCHAR, "av"."FIELD4" VARCHAR, 
> "rv"."FIELD1" VARCHAR, "rv"."FIELD2" VARCHAR, "rv"."FIELD3" VARCHAR, 
> "rv"."FIELD4" VARCHAR, "rv"."FIELD5" VARCHAR, "rv"."FIELD6" VARCHAR, 
> "rv"."FIELD7" VARCHAR, "rv"."FIELD8" VARCHAR, "rv"."FIELD9" VARCHAR, 
> "rv"."FIELD10" VARCHAR, "rv"."FIELD11" VARCHAR, "rv"."FIELD12" VARCHAR, 
> "rv"."FIELD13" VARCHAR, "rv"."FIELD14" VARCHAR, "rv"."FIELD15" VARCHAR, 
> "fd"."FIELD1" TINYINT, "fd"."FIELD2" TINYINT, "fd"."FIELD3" TINYINT, 
> "fd"."FIELD4" TINYINT, "fd"."FIELD5" TINYINT, "fd"."FIELD6" TINYINT, 
> "fd"."FIELD7" TINYINT, "fd"."FIELD8" TINYINT, "fd"."FIELD9" TINYINT, 
> "fd"."FIELD10" TINYINT, "fd"."FIELD11" TINYINT, "fd"."FIELD12" TINYINT, 
> "fd"."FIELD13" TINYINT, "fd"."FIELD13" TINYINT, "fd"."FIELD15" TINYINT) 
> VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 
> ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)



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

Reply via email to