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

ASF GitHub Bot commented on ARROW-1808:
---------------------------------------

kou commented on issue #1337: ARROW-1808: [C++] Make RecordBatch, Table virtual 
interfaces for column access
URL: https://github.com/apache/arrow/pull/1337#issuecomment-345920440
 
 
   If we allow empty record batch (no columns record batch), the following 
check is needed:
   
   ```diff
   diff --git a/cpp/src/arrow/ipc/writer.cc b/cpp/src/arrow/ipc/writer.cc
   index 3c1db061..6af9bc4b 100644
   --- a/cpp/src/arrow/ipc/writer.cc
   +++ b/cpp/src/arrow/ipc/writer.cc
   @@ -139,9 +139,11 @@ class RecordBatchSerializer : public ArrayVisitor {
          buffers_.clear();
        }
    
   -    // Perform depth-first traversal of the row-batch
   -    for (int i = 0; i < batch.num_columns(); ++i) {
   -      RETURN_NOT_OK(VisitArray(*batch.column(i)));
   +    if (batch.num_rows() > 0) {
   +      // Perform depth-first traversal of the row-batch
   +      for (int i = 0; i < batch.num_columns(); ++i) {
   +        RETURN_NOT_OK(VisitArray(*batch.column(i)));
   +      }
        }
    
        // The position for the start of a buffer relative to the passed frame 
of
   ```
   
   I'm OK that we deny no columns record batch. It'll simplify our code.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> [C++] Make RecordBatch interface virtual to permit record batches that 
> lazy-materialize columns
> -----------------------------------------------------------------------------------------------
>
>                 Key: ARROW-1808
>                 URL: https://issues.apache.org/jira/browse/ARROW-1808
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++
>            Reporter: Wes McKinney
>            Assignee: Wes McKinney
>              Labels: pull-request-available
>             Fix For: 0.8.0
>
>
> This should be looked at soon to prevent having to define a different virtual 
> interface for record batches. There are places where we are using the record 
> batch constructor directly, and in some third party code (like MapD), so this 
> might be good to get done for 0.8.0



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to