You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Chris Hutchinson (JIRA)" <ji...@apache.org> on 2019/02/12 19:31:00 UTC

[jira] [Updated] (ARROW-4545) [C#] Extend Append/AppendRange in BinaryArray to support building rows

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

Chris Hutchinson updated ARROW-4545:
------------------------------------
    Description: 
This is a proposal to extend BinaryArray to provide the ability to call Append/AppendRange to grow individual rows during array building, and to expose values in ArrowBuffer.Builder<T> through a property to facilitate algorithms that require introspecting the buffer data (sorting, filtering) when building an array.

*Example:*
{code:java}
var builder = new BinaryArray.Builder()
     .Append(10, false)     
     .Append(20, false)
     .Mark();
builder.Append(builder.Values[0], true);
var array = builder.Build();

// General idea:
//
// 1. Append byte (10) to current element (0)
// 2. Append byte (20) to current element (0)
// 3. Mark end of the row 
// 4. Append byte (10) to current element (1)

// Constructs a binary array with 2 elements:
//
// [0] 10, 20
// [1] 10{code}
 

This proposed change would add the concept of "current element" to the builder, which in the specification are separated by recording the value offset. Append(true) appends one or more bytes to the current element and then marks the element as completed. Append(false) appends one or more bytes to the current element; Mark is required to signal to the builder that the current element is complete.

An alternative concept could be to add a new overload for Append that accepts another builder type with the purpose of building individual list elements. This would keep symmetry with the primitive array types in that the growth functions always append a single element to the array. In the case of list types, an entire list. Essentially the additional builder type's purpose is to build a list of a specific primitive.

 

*Example:*
{code:java}
var builder = new BinaryArray.Builder()
    .Append(e => e.Append(10).Append(20))
    .Append(e => e.Append(30))
    .Build();

// Constructs a binary array with 2 elements:
//
// [0] 10, 20
// [1] 30{code}

  was:
This is a proposal to extend BinaryArray to provide the ability to call Append/AppendRange to grow individual rows during array building, and to expose values in ArrowBuffer.Builder<T> through a property to facilitate algorithms that require introspecting the buffer data (sorting, filtering) when building an array.

*Example:*
{code:java}
var builder = new BinaryArray.Builder()
     .Append(10, false)     
     .Append(20, false)
     .Mark();
builder.Append(builder.Values[0], true);
var array = builder.Build();

// General idea:
//
// 1. Append byte (10) to current element (0)
// 2. Append byte (20) to current element (0)
// 3. Mark end of the row 
// 4. Append byte (10) to current element (1)

// Constructs a binary array with 2 elements:
//
// [0] 10, 20
// [1] 10{code}
 

 

This proposed change would add the concept of "current element" to the builder, which in the specification are separated by recording the value offset. Append(true) appends one or more bytes to the current element and then marks the element as completed. Append(false) appends one or more bytes to the current element; Mark is required to signal to the builder that the current element is complete.


> [C#] Extend Append/AppendRange in BinaryArray to support building rows
> ----------------------------------------------------------------------
>
>                 Key: ARROW-4545
>                 URL: https://issues.apache.org/jira/browse/ARROW-4545
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C#
>            Reporter: Chris Hutchinson
>            Priority: Major
>             Fix For: 0.13.0
>
>
> This is a proposal to extend BinaryArray to provide the ability to call Append/AppendRange to grow individual rows during array building, and to expose values in ArrowBuffer.Builder<T> through a property to facilitate algorithms that require introspecting the buffer data (sorting, filtering) when building an array.
> *Example:*
> {code:java}
> var builder = new BinaryArray.Builder()
>      .Append(10, false)     
>      .Append(20, false)
>      .Mark();
> builder.Append(builder.Values[0], true);
> var array = builder.Build();
> // General idea:
> //
> // 1. Append byte (10) to current element (0)
> // 2. Append byte (20) to current element (0)
> // 3. Mark end of the row 
> // 4. Append byte (10) to current element (1)
> // Constructs a binary array with 2 elements:
> //
> // [0] 10, 20
> // [1] 10{code}
>  
> This proposed change would add the concept of "current element" to the builder, which in the specification are separated by recording the value offset. Append(true) appends one or more bytes to the current element and then marks the element as completed. Append(false) appends one or more bytes to the current element; Mark is required to signal to the builder that the current element is complete.
> An alternative concept could be to add a new overload for Append that accepts another builder type with the purpose of building individual list elements. This would keep symmetry with the primitive array types in that the growth functions always append a single element to the array. In the case of list types, an entire list. Essentially the additional builder type's purpose is to build a list of a specific primitive.
>  
> *Example:*
> {code:java}
> var builder = new BinaryArray.Builder()
>     .Append(e => e.Append(10).Append(20))
>     .Append(e => e.Append(30))
>     .Build();
> // Constructs a binary array with 2 elements:
> //
> // [0] 10, 20
> // [1] 30{code}



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