Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-13847

Avoid unnecessary copies of collection

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 6.0.0
    • Java

    Description

      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)

      
        /**
         * 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);
        } 

      Attachments

        Issue Links

          Activity

            People

              laurent Laurent Goujon
              laurent Laurent Goujon
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 10m
                  2h 10m