You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/09/01 18:33:00 UTC
[jira] [Updated] (ARROW-13847) Avoid unnecessary copies of
collection
[ https://issues.apache.org/jira/browse/ARROW-13847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
ASF GitHub Bot updated ARROW-13847:
-----------------------------------
Labels: pull-request-available (was: )
> Avoid unnecessary copies of collection
> --------------------------------------
>
> Key: ARROW-13847
> URL: https://issues.apache.org/jira/browse/ARROW-13847
> Project: Apache Arrow
> Issue Type: Improvement
> Components: Java
> Reporter: Laurent Goujon
> Assignee: Laurent Goujon
> Priority: Minor
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> There are several occurences of unnecessary copies of collections in Arrow Java code.
> One typical example is for a constructor to copy a collection provided as an argument, and then invoking {{Collections2}} method to create a immutable copy of it, like for {{Schema}} ([https://github.com/apache/arrow/blob/247a7a9bf1b7090b1bffc14bec84d188dccb52dc/java/vector/src/main/java/org/apache/arrow/vector/types/pojo/Schema.java#L113)]
> {code:java}
> /**
> * Constructor with metadata.
> */
> public Schema(Iterable<Field> fields,
> Map<String, String> metadata) {
> List<Field> fieldList = new ArrayList<>();
> for (Field field : fields) {
> fieldList.add(field);
> }
> this.fields = Collections2.immutableListCopy(fieldList);
> this.metadata = metadata == null ? Collections.emptyMap() : Collections2.immutableMapCopy(metadata);
> } {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)