Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

VectorAppender fails with OversizedAllocationException when appending to empty UnionVector

オープン
#812 コメント 0 件 リアクション 3 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
java
領域
data

調査の方向性

VectorAppender.java の556行目付近のループから始め、NonNullableStructVector.java の373行目付近も含めて UnionVector.getValueCapacity() を調査します。提供されている testAppendEmptyTargetUnionVector の再現を実行し、reAlloc() の前後で容量を比較します。空の UnionVector への追加が OversizedAllocationException なしで完了し、5つすべての float 値が保持されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Type: bug
Describe the bug, including details regarding any error messages, version, and platform.

Description:
When appending a UnionVector to an empty target UnionVector, this while loop runs infinitely until the exception occurs:

org.apache.arrow.vector.util.OversizedAllocationException: Unable to expand the buffer

It seems to be a issue with the UnionVector.getValueCapacity() method. Logging the capacity before and after calling reAlloc() shows that it's always 0.
Debugging further, it seems like the value capacity of the internalStruct in the UnionVector always returns 0 because it has no children so size is 0.

 @Override
  public int getValueCapacity() {
    return Math.min(getTypeBufferValueCapacity(), internalStruct.getValueCapacity());
  }

Steps to reproduce

  @Test
  public void testAppendEmptyTargetUnionVector() {
    final int length = 5;

    try (final UnionVector target = UnionVector.empty("target", allocator);
         final UnionVector delta = UnionVector.empty("delta", allocator)) {

      // populate the delta vector
      delta.setType(0, Types.MinorType.FLOAT4);
      delta.setType(1, Types.MinorType.FLOAT4);
      delta.setType(2, Types.MinorType.FLOAT4);
      delta.setType(3, Types.MinorType.FLOAT4);
      delta.setType(4, Types.MinorType.FLOAT4);

      Float4Vector deltaFloatVector = delta.getFloat4Vector();
      deltaFloatVector.allocateNew();
      ValueVectorDataPopulator.setVector(deltaFloatVector, 1f, 2f, 3f, 4f, 5f);
      assertEquals(length, deltaFloatVector.getValueCount());
      delta.setValueCount(length);

      VectorAppender appender = new VectorAppender(target);
      delta.accept(appender, null);

      assertEquals(length, target.getValueCount());

      for (int i = 0; i < length; i++) {
        Object floatObj = target.getObject(i);
        assertTrue(floatObj instanceof Float);
        assertEquals(i+1, ((Float) floatObj).intValue());
      }
    }
  }

This issue does not occur if any value is set in the target vector before appending.

主要言語
Java
スター
95
フォーク
154
平均マージ
2日 10時間
マージ済み PR(30日)
11

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/arrow-java のほかの issue

apache/arrow-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。