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

Micah Kornfield commented on ARROW-60:
--------------------------------------

Hi Kai,
I had a chance to think this through and wanted to know what you thought about 
the following:   I think the implementation of the builder should actually be 
pretty straightforward.  You should be able to extend ArrayBuilder 
(https://github.com/apache/arrow/blob/master/cpp/src/arrow/builder.h).
You can likely have two constructors:
1.  One that takes a list of builders and generated the type for the 
ArrayBuilder class on the fly
2.  One that takes the type (a struct) and generates the builders on the fly 
(https://github.com/apache/arrow/blob/master/cpp/src/arrow/types/construct.h 
would be useful for this.  I think it might pay to add a version of the method 
that takes a unique_ptr as an output parameter to make it easier for this 
use-case.) 

For additional methods: Add an Append method modeled after 
(https://github.com/apache/arrow/blob/master/cpp/src/arrow/types/list.h#L144).  
It would be be slightly different since you don't need to keep track of 
offsets.  It would be nice if appending a null value also appended a null to 
each of the child builders, but that would require a new virtual method 
"AppendNull" on ArrayBuilder.  I think its worth it as it would make client 
code a little bit more concise, but I think there might be some debate due to 
performance and API consistency.  

I don't think a "vectorized" append is needed yet, unless you can think of a 
use-case for one.

Have you made any progress?  How does this align with your thinking?



> C++: Struct type builder API 
> -----------------------------
>
>                 Key: ARROW-60
>                 URL: https://issues.apache.org/jira/browse/ARROW-60
>             Project: Apache Arrow
>          Issue Type: New Feature
>          Components: C++
>            Reporter: Wes McKinney
>            Assignee: Kai Zheng
>
> At the moment, we are able to represent struct metadata but not actually 
> build struct-type arrays. 



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

Reply via email to