Scalar subquery in a VALUES row fails with "Internal error: ScalarSubqueryExpr evaluated before the subquery was executed"
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 25/100
Línea de trabajo
Start by reading LogicalPlan::Values and MemorySourceConfig::try_new_as_values, then trace how ScalarSubqueryExpr is evaluated by ScalarSubqueryExec. Add regression coverage for the three SQL examples, including the expected (1, 5) result and inserted row. A linked pull request is already open, so this work is underway.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
A VALUES clause whose rows contain an uncorrelated scalar subquery fails during physical planning with an internal error:
Internal error: ScalarSubqueryExpr evaluated before the subquery was executed. This issue was likely caused by a bug in DataFusion's code.
LogicalPlan::Values is processed by MemorySourceConfig::try_new_as_values, which attempts to evaluate every row expression while the physical plan is built. Under physical scalar subquery execution, an uncorrelated scalar subquery is represented as a ScalarSubqueryExpr, which expects execution-time evaluation inside ScalarSubqueryExec. Because the subquery has not yet run at planning time, evaluation fails with an internal error.
To Reproduce
VALUES ((SELECT 1), 5);
SELECT * FROM (VALUES ((SELECT min(x) FROM (VALUES (1), (2)) AS v(x)), 5)) AS t(a, b);
CREATE TABLE v (a BIGINT, b BIGINT);
INSERT INTO v VALUES ((SELECT 1), 5);
Expected behavior
The first two SELECT queries should return (1, 5). The INSERT statement should insert one row (1, 5) into table v.
Additional context
Reproduced on main at commit bc86321 (57.0.0-dev) and with datafusion-python 55.0.0. Found using an automated grammar-based SQL fuzzer.
Willingness to contribute
I plan to contribute a fix for this bug independently
- Lenguaje dominante
- Rust
- Estrellas
- 9.6k
- Forks
- 2.6k
- Merge medio
- 3 d 4 h
- PR fusionados (30 d)
- 345
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
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/datafusion#27315 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
apache/datafusion#27094 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Substrait consumer doesn't recognise `shift_left` / `shift_right` from functions_arithmetic.yamlPosiblemente ocupada @jonasHanhan la tomó hace 9 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
apache/datafusion#27059 ·
Los mantenedores suelen responder en 1 día
-
`ProjectionExprs::project_statistics` computes approximate `Statistics::total_byte_size` ignoring column statsPosiblemente ocupada @joseph-isaacs la tomó hace 9 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/datafusion#27050 ·
Los mantenedores suelen responder en 1 día
-
physical-plan: decoding an Unnest or Explain node with an unset field panicsPosiblemente ocupada @geoHeil la tomó hace 8 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
apache/datafusion#26999 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de apache/datafusion
Issues similares
-
area:schema documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
ElectronicWave/Elemental#252 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
dekobon/big-code-analysis#1887 ·
Los mantenedores suelen responder en 1 día
-
Shell中文符号输入异常Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día