ToArrowRecordBatches accumulates arrays from previous batches, producing invalid record batches
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 62/100
Línea de trabajo
El error está en ToArrowRecordBatches() en src/Microsoft.Data.Analysis/DataFrame.Arrow.cs, donde la lista arrays se declara fuera del bucle de creación de lotes y nunca se reinicia. Lee ese bucle y luego compara la reproducción con DataFrame.FromArrowRecordBatch. Está terminado cuando cada lote contiene solo sus propios arrays de columnas y el lote 1 de la reproducción se reimporta como un frame de una fila y una columna que contiene 42. La prueba que hay que ampliar está en las pruebas de Microsoft.Data.Analysis para los round-trips de Arrow.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C#
- Estrellas
- 9.4k
- Forks
- 2k
- Merge medio
- 3 d 8 h
- PR fusionados (30 d)
- 41
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de dotnet/machinelearning
-
LlamaTokenizer encodes some runs of repeated characters differently from SentencePiecePosiblemente ocupada @Laurianti la tomó hace 16 días. Abiertountriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
dotnet/machinelearning#7751 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
BertTokenizer merges words separated only by `\n`, `\t` or `\r`Posiblemente ocupada @rosebyte la tomó hace 24 días. Abiertoarea-Tokenizers green
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
dotnet/machinelearning#7724 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
Comment in example code not matching docstring for TimeSeriesCatalog.DetectSeasonality MethodAbiertoarea-TimeSeries documentation untriaged
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
dotnet/machinelearning#7205 ·
Los mantenedores suelen responder en 2 días
-
area-ONNX documentation Priority:3
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
dotnet/machinelearning#5894 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Add a .vsconfig fileAbiertoarea-Infrastructure Priority:2
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
dotnet/machinelearning#3260 · 2 comentarios · 1 reacción ·
Los mantenedores suelen responder en 2 días
Todos los issues de dotnet/machinelearning
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
dette technique priorité: basse zone: service
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
damiensabau/nexus-lobby#25 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
sebastienros/jint#4282 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 76/100
pyrevitlabs/pyRevit#3792 ·
Los mantenedores suelen responder en 1 día