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-1220) NullPointerException in PArrayDataType.toObject() when baseType is CHAR or BINARY
Date Sun, 31 Aug 2014 22:48:20 GMT

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

James Taylor commented on PHOENIX-1220:
---------------------------------------

We should throw if this is ever the case (and I hope we don't have any cases where this occurs
b/c those would all be bugs), but for CHAR and BINARY, we need the maxLength to be passed
through as the type doesn't have that information (the expression has it instead).

Would be good to adjust your getSampleValue to pass through an Integer maxLength. It'll be
ignored for other types other than CHAR and BINARY.

> NullPointerException in PArrayDataType.toObject() when baseType is CHAR or BINARY
> ---------------------------------------------------------------------------------
>
>                 Key: PHOENIX-1220
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1220
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 5.0.0
>            Reporter: Maryann Xue
>            Priority: Minor
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> We now assume that for PDataType, if isFixedLength() returns true, we can use getByteSize()
to get the byte array length of this type. But with BINARY and CHAR types, isFixedLength()
returns true while getByteSize() returns null, and that's why we would get an NPE if we write
code like:
> {code:title=PArrayDataType.createPhoenixArray()}
>         if (!baseDataType.isFixedWidth()) {
>             ...
>         } else {
>             int elemLength = (maxLength == null ? baseDataType.getByteSize() : maxLength);
>             ...
>         }
> {code}
> There are more than one occurrences of such code besides this one.



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

Mime
View raw message