[VL] RANGE window frames with interval or non-integral bounds fail the query instead of falling back

Abierto
#13,201 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
52/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
clickhouse, scala, spark

Línea de trabajo

Start by reading PullOutPreProject and WindowFunctionNode.setBound, then compare the ClickHouse supportWindowExec checks with the Velox and Bolt handling described in the issue. Reproduce the date-key interval and decimal-key bound cases where the relevant backend is available. Done means these cases fall back to vanilla Spark instead of failing; the issue does not name specific test files.

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

Descripción

Backend

Velox (the window parts also apply to Bolt and ClickHouse, see below).

Bug description

Two kinds of RANGE window frames fail the query instead of falling back to vanilla Spark.

1. A date order key with an interval bound fails planning on Velox and Bolt. PullOutPreProject pre-computes RANGE frame boundaries for date keys by turning the key into an integer (datediff from epoch) and adding the bound to it. That only works for an integer bound. With an interval bound it builds Add(int, interval), which never resolves, and planning fails:

select l_commitdate,
       count(*) over (order by l_commitdate range between interval '1' month preceding and current row)
from lineitem
org.apache.spark.sql.catalyst.analysis.UnresolvedException: Invalid call to dataType on unresolved object

range between 1 preceding and current row on the same date key works.

2. A non-integral bound fails the query with NumberFormatException on ClickHouse. WindowFunctionNode.setBound reads a literal frame bound with Long.valueOf(bound.eval(null).toString()). Spark casts a RANGE bound to the order key type, so on a decimal key both 1.5 PRECEDING and 10 PRECEDING arrive as -1.50 / -10.00. The resulting NumberFormatException is not one of the exceptions validation turns into a fallback, so the query fails. ClickHouse's supportWindowExec does not check frame bounds, so a query like this reaches it:

select order_id, count(*) over (partition by category order by price
                                range between 10 preceding and 10 following)
from orders  -- price DECIMAL(18,2)

Velox and Bolt already reject non-integral sort keys before this point. The ClickHouse path was traced by reading the code; I could not run the ClickHouse backend.

Gluten version

main (2681cc9a3)

Spark version

Spark 3.5

This issue was written with the assistance of AI (Claude Opus).

Lenguaje dominante
Scala
Estrellas
1.6k
Forks
685
Merge medio
4 d 16 h
PR fusionados (30 d)
84

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/gluten

Todos los issues de apache/gluten

Issues similares

Más issues de Scala

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.