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

dzcxzl commented on ORC-1873:
-----------------------------

org.apache.orc.impl.TreeReaderFactory.BytesColumnVectorUtil#readOrcByteArrays

[https://github.com/apache/orc/blob/main/java/core/src/java/org/apache/orc/impl/TreeReaderFactory.java#L2086-L2089]

OR use flatten api
{code:java}
BytesColumnVector value = (BytesColumnVector) batch.cols[0];
value.flatten(false, batch.selected, batch.size); {code}

> I'm writing repeated string values to a string column in an ORC file using 
> Java and while reading the ORC file back, encounter a NullPointerException
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ORC-1873
>                 URL: https://issues.apache.org/jira/browse/ORC-1873
>             Project: ORC
>          Issue Type: Bug
>            Reporter: Shiva
>            Priority: Major
>         Attachments: ORCReader.java, ORCWriter.java
>
>
> When writing the same value to a specific column for every row within a 
> stripe, only the first row correctly returns the expected value. All 
> subsequent rows in that stripe return {{null}} for the same column.
> However, if two or more distinct values are written to the column within the 
> same stripe, this issue does not occur — all values are returned as expected.
>  
> Attached Reader and Writer code files.
>  
> When I am trying to read all the rows, facing below issue
> {code:java}
> Row 1  value: value
> Exception in thread "main" java.lang.NullPointerException: Cannot read the 
> array length because "bytes" is null
>     at java.base/java.lang.String.<init>(String.java:1455)
>     at com.ge.ORCReader.main(ORCReader.java:38){code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to