[
https://issues.apache.org/jira/browse/PHOENIX-2207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14729982#comment-14729982
]
Samarth Jain commented on PHOENIX-2207:
---------------------------------------
I was running into problems returning the ID as Tuple in the next() method.
This is what I did:
{code}
@Override
public Tuple next() throws SQLException {
byte[] value = PInteger.INSTANCE.toBytes(id);
KeyValue keyValue = KeyValueUtil.newKeyValue(Bytes.toBytes("abcd"),
SINGLE_COLUMN_FAMILY, SINGLE_COLUMN, HConstants.LATEST_TIMESTAMP, value, 0,
value.length);
return new SingleKeyValueTuple(keyValue);
}
{code}
When I try doing rs.getInt(1) it fails with the exception:
{code}
java.sql.SQLException: ERROR 201 (22000): Illegal data. Value
-2206091586288004225 cannot be cast to Integer without changing its value
at
org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:389)
at
org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:145)
at
org.apache.phoenix.schema.types.PDataType.newIllegalDataException(PDataType.java:290)
at
org.apache.phoenix.schema.types.PLong$LongCodec.decodeInt(PLong.java:254)
at org.apache.phoenix.schema.types.PInteger.toObject(PInteger.java:81)
at org.apache.phoenix.schema.types.PInteger.toObject(PInteger.java:28)
at
org.apache.phoenix.schema.types.PDataType.toObject(PDataType.java:983)
at
org.apache.phoenix.compile.ExpressionProjector.getValue(ExpressionProjector.java:75)
at
org.apache.phoenix.jdbc.PhoenixResultSet.getInt(PhoenixResultSet.java:449)
{code}
So I am not sure if I can just return a SingleKeyValueTuple here.
My table schema is:
CREATE TABLE T (k BIGINT PRIMARY KEY, v VARCHAR) SALT_BUCKETS = 8
And the query I am executing is:
select K from T
> Load scanner caches in parallel when using stats and round robin iterator
> -------------------------------------------------------------------------
>
> Key: PHOENIX-2207
> URL: https://issues.apache.org/jira/browse/PHOENIX-2207
> Project: Phoenix
> Issue Type: Bug
> Reporter: Samarth Jain
> Assignee: Samarth Jain
> Attachments: PHOENIX-2207.patch, PHOENIX-2207_v2.patch
>
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)