apache / apache/datafusion

No way to get the schema for sliding accumulator state

Abierto
#14,701 1 comentario 2 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Rust
Estrellas
9.3k
Forks
2.4k
Merge medio
3 d 11 h
PR fusionados (30 d)
360

Descripción

The AggregateUDF trait includes a function `fn state_fields(&self, args: StateFieldsArgs) -> Result>` to get the types for the intermediate state of the aggregate. This is useful if we need to store the states, for example for multi-level aggregation.

For our use-case we also need to store the accumulator states as part of our checkpointing system. This works so long as we're using the standard accumulators, but breaks down if you want to use sliding accumulators. This is because some aggregates (for example, sum) have different state fields in sliding mode (for sum, this is additional "count" field, used to determine when we've retracted all of the data).

But there doesn't seem to be any way to determine what the state fields will be for a sliding accumulator. A couple of possible options here:

* Follow the pattern of is_distinct, which also can produce different accumulators. This is passed in to the state_fields function as a field on the StateFieldsArgs struct; we could add a similar one for is_sliding
* It seems like state_fields is really a property of the accumulator, not of the aggregate (as various aggregates may produce different accumulators depending on the options and which accumulator function is called), so it might be better to have the state_fields function on the accumulator instead of the aggregate.

We've gone ahead and implemented the first approach in our fork, but would be nice to get something in upstream that addresses this.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza leyendo la función AggregateUDF::state_fields y StateFieldsArgs; después, compara los campos de estado producidos para acumuladores estándar y deslizantes como sum. Se considera terminado cuando la API upstream pueda exponer el esquema correcto de los campos de estado del acumulador deslizante para el checkpointing, con cobertura del comportamiento relevante.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
rust
Área
backend-api-design
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.