You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Javier Luraschi (JIRA)" <ji...@apache.org> on 2018/10/22 21:58:00 UTC

[jira] [Resolved] (ARROW-3547) [R] Protect against Null crash when reading from RecordBatch

     [ https://issues.apache.org/jira/browse/ARROW-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Javier Luraschi resolved ARROW-3547.
------------------------------------
    Resolution: Fixed

Fixed by [https://github.com/apache/arrow/pull/2795]

 

> [R] Protect against Null crash when reading from RecordBatch
> ------------------------------------------------------------
>
>                 Key: ARROW-3547
>                 URL: https://issues.apache.org/jira/browse/ARROW-3547
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: R
>            Reporter: Javier Luraschi
>            Priority: Minor
>
> Reprex:
>  
> {code:java}
>   tbl <- tibble::tibble(
>     int = 1:10, dbl = as.numeric(1:10),
>     lgl = sample(c(TRUE, FALSE, NA), 10, replace = TRUE),
>     chr = letters[1:10]
>   )
>   batch <- record_batch(tbl)
>   bytes <- write_record_batch(batch, raw())
>   stream_reader <- record_batch_stream_reader(bytes)
>   batch1 <- read_record_batch(stream_reader)
>   batch2 <- read_record_batch(stream_reader)
>   
>   # Crash
>   as_tibble(batch2){code}
>  
> While users should check for Null entries by running:
>  
> {code:java}
> if(!batch2$is_null()) as_tibble(batch2)
> {code}
> It's harsh to trigger a crash, we should consider protecting all functions that use RecordBatch pointers to return NULL instead, for instance:
>  
> {code:java}
> List RecordBatch__to_dataframe(const std::shared_ptr<arrow::RecordBatch>& batch) {
>    if (batch->get() == nullptr) Rcpp::stop("Can't read from NULL record batch.")
> }{code}
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)