BaselineMetrics output_bytes converts every column to ArrayData for every batch
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 72/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- rust
- Área
- performance
Línea de trabajo
Empieza en datafusion/physical-expr-common/src/metrics/baseline.rs y lee RecordOutput::record_output junto con get_record_batch_memory_size para ver cómo se registra output_bytes. Compara el enfoque propuesto de Array::get_array_memory_size con el recuento existente de búferes compartidos. Se considera terminado cuando el registro de los bytes de salida ya no convierte las columnas en ArrayData, mientras que get_record_batch_memory_size sigue disponible para contabilizar la memoria.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Is your feature request related to a problem or challenge?
Every operator's BaselineMetrics records output_bytes for every output batch through RecordOutput::record_output (datafusion/physical-expr-common/src/metrics/baseline.rs), which calls get_record_batch_memory_size. That function converts each column, and each child of a nested column, to ArrayData and inserts every buffer's address into a HashSet, so that buffers shared between columns are counted once. Exact accounting matters for memory reservations; for a per-batch metric it is a cost every query pays, and it grows with the width and nesting of the schema rather than with the data.
Measured on main (c0e872f), release build, Apple M1 Max, one batch of Int32 struct columns:
| batch | get_record_batch_memory_size |
sum of Array::get_array_memory_size |
|---|---|---|
| 35 struct columns x 20 fields, 100 rows | 21.9 µs | 1.6 µs |
| 35 struct columns x 20 fields, 4,000 rows | 15.1 µs | 1.5 µs |
| 5 struct columns x 5 fields, 4,000 rows | 0.58 µs | 0.05 µs |
That is per operator per batch. We hit it running one wide plan repeatedly (a game's world, 35 struct columns, a few thousand rows, a few hundred operators, through Sail on DataFusion 55.1): in a sampled profile, BaselineMetrics::record_poll -> get_record_batch_memory_size -> StructArray::to_data was about 12% of executing the plan, and computing the metric as below took a run from 40 ms to 34 ms.
Describe the solution you'd like
Compute output_bytes without ArrayData, for example:
fn output_bytes(batch: &RecordBatch) -> usize {
batch.columns().iter().map(|c| c.get_array_memory_size()).sum()
}
This can count a buffer shared between columns more than once (in the table above it reports 350,840 bytes against 280,000 for the 100-row batch, which shares nothing; the difference is the arrays' own structures), which seems acceptable for a metric; get_record_batch_memory_size would stay for memory accounting. Alternatively, output_bytes could be computed only when a metrics level that shows it is requested.
Describe alternatives you've considered
Making get_record_batch_memory_size itself cheaper for nested arrays (walking the arrays' buffers without building ArrayData) would help memory accounting too, but keeps the hash set per batch.
Additional context
Related: #26065 (struct literal comparisons through ArrayData in physical planning) and the planning-speed work in #19795.
- Lenguaje dominante
- Rust
- Estrellas
- 9.4k
- Forks
- 2.5k
- Merge medio
- 4 d 5 h
- PR fusionados (30 d)
- 344
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- 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 apache/datafusion
-
`array_concat` with an untyped `NULL` argument fails with "does not support type Int64"Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
apache/datafusion#26243 ·
Los mantenedores suelen responder en 1 día
-
array_min / array_max fail on a zero-row batch for non-primitive element typesPosiblemente ocupada @linuxpi la tomó hace 6 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
apache/datafusion#26072 ·
Los mantenedores suelen responder en 1 día
-
Replace manual `RowSelection` bitmap conversion with `force_mask()` after arrow-rs releasePosiblemente ocupada @isabellehuangg la tomó hace 8 días. Abiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
apache/datafusion#26030 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Lambda examples in the SQL function docs fail with the default dialectPosiblemente ocupada @Prajwal-k-tech la tomó hace 8 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
apache/datafusion#25960 ·
Los mantenedores suelen responder en 1 día
-
Spark `xxhash64` hashes the raw bits of a NaN instead of the canonical NaNPosiblemente ocupada @mrhard9090 la tomó hace 10 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
apache/datafusion#25913 ·
Los mantenedores suelen responder en 1 día
Todos los issues de apache/datafusion
Issues similares
-
proxy: SQL-over-HTTP turns empty arrays into [""] or [false], or HTTP 500 for int and float arraysAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
neondatabase/neon#12965 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
goauthentik/authentik#26867 ·
Los mantenedores suelen responder en 1 día
-
api bug macos maintainer-needed p2 triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
-
area::tern difficulty::easy good first issue kind::cleanup triage::ready
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
eclipse-zenoh/zenoh#2842 · 2 comentarios ·
Los mantenedores suelen responder en 1 día