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

Shuai Zhang updated ARROW-9510:
-------------------------------
    Description: 
MapBuilder API is too much confusing. Everybody know Map is consist of key & 
value pairs. However, the API value_builder is actually the pairs builder. 
Instead, the item_builder, whose name is usually means the pairs builder, is 
the value builder.

{code:c++}
  /// \brief Get builder to append items
  ///
  /// Appending an item with this builder should have been preceded
  /// by appending a key with key_builder().
  ArrayBuilder* item_builder() const { return item_builder_.get(); }

  /// \brief Get builder to add Map entries as struct values.
  ///
  /// This is used instead of key_builder()/item_builder() and allows
  /// the Map to be built as a list of struct values.
  ArrayBuilder* value_builder() const { return list_builder_->value_builder(); }
{code}

I know that we may want to keep align with the value_builder semantics with 
ListBuilder, but I don't think current naming is reasonable.

  was:
MapBuilder API is too much confusing. Everybody know Map is consist of key & 
value pairs. However, the API value_builder is actually the pairs builder. 
Instead, the item_builder, whose name is usually means the pairs builder, is 
the value builder.

{code:c++}
  /// \brief Get builder to append items
  ///
  /// Appending an item with this builder should have been preceded
  /// by appending a key with key_builder().
  ArrayBuilder* item_builder() const { return item_builder_.get(); }

  /// \brief Get builder to add Map entries as struct values.
  ///
  /// This is used instead of key_builder()/item_builder() and allows
  /// the Map to be built as a list of struct values.
  ArrayBuilder* value_builder() const { return list_builder_->value_builder(); }
{code}



> [C++] MapBuilder API is TOO MUCH CONFUSING
> ------------------------------------------
>
>                 Key: ARROW-9510
>                 URL: https://issues.apache.org/jira/browse/ARROW-9510
>             Project: Apache Arrow
>          Issue Type: Bug
>    Affects Versions: 0.17.1
>            Reporter: Shuai Zhang
>            Priority: Major
>
> MapBuilder API is too much confusing. Everybody know Map is consist of key & 
> value pairs. However, the API value_builder is actually the pairs builder. 
> Instead, the item_builder, whose name is usually means the pairs builder, is 
> the value builder.
> {code:c++}
>   /// \brief Get builder to append items
>   ///
>   /// Appending an item with this builder should have been preceded
>   /// by appending a key with key_builder().
>   ArrayBuilder* item_builder() const { return item_builder_.get(); }
>   /// \brief Get builder to add Map entries as struct values.
>   ///
>   /// This is used instead of key_builder()/item_builder() and allows
>   /// the Map to be built as a list of struct values.
>   ArrayBuilder* value_builder() const { return 
> list_builder_->value_builder(); }
> {code}
> I know that we may want to keep align with the value_builder semantics with 
> ListBuilder, but I don't think current naming is reasonable.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to