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

Maryann Xue commented on PHOENIX-1220:
--------------------------------------

[~jamestaylor] Yes, you are right. I should have used another toObject in my 
testGetSampleValue(), while getSampleValue() does not call toObject() and has 
no problem with that. I'll just close this issue.

[~ram_krish] Was just reminded of another bug I had reported a while ago, 
"https://github.com/forcedotcom/phoenix/issues/682";, which may or may not be 
related. And I just checked it against the latest code, it returns null instead 
of throwing NullPointerException now. Would you mind taking a look at of this 
one? Also, seems that it had not been transferred into our apache issue list, 
so you might need to create one.

> 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)

Reply via email to