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

ToArrowRecordBatches accumulates arrays from previous batches, producing invalid record batches

オープン 初心者向け
#7,799 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

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

評価

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

調査の方向性

バグは src/Microsoft.Data.Analysis/DataFrame.Arrow.cs の ToArrowRecordBatches() にあり、arrays リストがバッチ分割ループの外で宣言されたまま、一度もリセットされていません。そのループを読んでから、再現手順を DataFrame.FromArrowRecordBatch と照らし合わせて確認してください。各バッチに自身の列配列だけが含まれ、再現手順のバッチ 1 が 42 を含む 1 行 1 列のフレームとして再インポートされれば完了です。拡張すべきテストは、Arrow のラウンドトリップに関する Microsoft.Data.Analysis のテストにあります。

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

説明

area-DataFrame bug untriaged

Description

DataFrame.ToArrowRecordBatches() accumulates arrays from previous batches. A one-column DataFrame exports its second record batch with one schema field but two arrays, including the first batch's stale array.

This invalid batch cannot be imported using DataFrame.FromArrowRecordBatch(), which throws ArgumentOutOfRangeException.

Reproduced on Microsoft.Data.Analysis 0.23.0, Apache.Arrow 14.0.2, Windows x64, .NET 10. The reproduction uses only public, high-level DataFrame APIs and is independent of Arrow string null-count bugs (https://github.com/dotnet/machinelearning/issues/7800 and https://github.com/dotnet/machinelearning/issues/7801).

Reproduction

Create a console app, add Microsoft.Data.Analysis version 0.23.0, and run:

using System;
using System.Linq;
using Microsoft.Data.Analysis;

var numbers = new Int64DataFrameColumn("numbers");
numbers.AppendMany(42, 268_304_384);
var frame = new DataFrame(numbers);
var batches = frame.ToArrowRecordBatches();

foreach (var (i, batch) in batches.Index())
{
    Console.WriteLine(
        $"Batch {i}: rows={batch.Length}; fields={batch.Schema.FieldsList.Count}; arrays={batch.Arrays.Count()}; array lengths=[{string.Join(", ", batch.Arrays.Select(array => array.Length))}]");

    try
    {
        var roundTrip = DataFrame.FromArrowRecordBatch(batch);
        Console.WriteLine($"Reimported batch {i}: rows={roundTrip.Rows.Count}; columns={roundTrip.Columns.Count}");
    }
    catch (ArgumentOutOfRangeException e)
    {
        Console.WriteLine($"Reimporting batch {i}: {e.GetType().Name}: {e.Message}");
    }
}

Requires slightly over 2 GB for the numeric buffers and validity bitmaps. The row count naturally creates two numeric buffers and forces two record batches.

Actual output
Batch 0: rows=268304383; fields=1; arrays=1; array lengths=[268304383]
Reimported batch 0: rows=268304383; columns=1
Batch 1: rows=1; fields=1; arrays=2; array lengths=[268304383, 1]
Reimporting batch 1: ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
Expected behavior

Each batch should contain exactly one array matching its single schema field. Batch 1 should contain only its one-row array, and reimport should produce a one-row, one-column DataFrame containing 42.

Cause

DataFrame.ToArrowRecordBatches() creates the arrays list outside its batching loop and continually appends each batch's arrays without resetting that list.

Each record batch should receive a fresh per-batch collection containing only the current batch's column arrays. Also ensure that continuing enumeration cannot mutate an already yielded batch.

主要言語
C#
スター
9.4k
フォーク
2k
平均マージ
3日 8時間
マージ済み PR(30日)
41

環境構築

はじめの一歩

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

dotnet/machinelearning のほかの issue

dotnet/machinelearning の issue をすべて見る

似ている issue

C# の issue をもっと見る

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

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