BugReport: Issues with COALESCE function
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
Línea de trabajo
Comienza cargando los datos adjuntos de tidb/tpcd.sql y ejecutando ambas consultas contra TiDB 8.3.0 para confirmar que los resultados difieren. Compara el comportamiento de NOT IN y EXCEPT y determina después si el problema corresponde a TiDB en lugar de a este repositorio de documentación; el trabajo se considerará terminado cuando haya un diagnóstico confirmado y una actualización clara de la documentación o del issue.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
BugReport: Issues with COALESCE function
version
8.3.0
Original sql
SELECT DISTINCT l_shipinstruct, l_extendedprice, l_comment
FROM lineitem
WHERE l_shipmode NOT IN (
SELECT l_commitdate
FROM lineitem
WHERE l_commitdate IS NOT NULL
) AND l_shipmode IS NOT NULL ;
return 0 row
Rewritten sql
SELECT DISTINCT l_shipinstruct, l_extendedprice, l_comment
FROM lineitem
WHERE l_shipmode IS NOT NULL
AND l_commitdate IS NOT NULL
EXCEPT
SELECT DISTINCT l_shipinstruct, l_extendedprice, l_comment
FROM lineitem
WHERE l_shipmode IN (
SELECT l_commitdate
FROM lineitem
)AND l_shipmode IS NOT NULL
AND l_commitdate IS NOT NULL;
return 5895 row
Analysis
These two queries are logically equivalent, although they are written differently.
The original query uses a NOT IN subquery to filter rows where l_shipmode is not in the set of l_commitdate (where l_commitdate is not NULL) and where l_shipmode is not NULL. Specifically, the query:
- Uses the subquery SELECT l_commitdate FROM lineitem WHERE l_commitdate IS NOT NULL to get all non-NULL values of l_commitdate.
- Excludes rows where l_shipmode is in the result set of this subquery, ensuring that l_shipmode is not in any of those l_commitdate values.
- The condition l_shipmode IS NOT NULL ensures that only rows where l_shipmode is not NULL are returned.
The rewritten query uses an EXCEPT subquery to achieve the same logic:
- The first part of the query returns all rows where both l_shipmode and l_commitdate are not NULL.
- The second part (through EXCEPT) returns all rows where l_shipmode is in the set of l_commitdate, and both l_shipmode and l_commitdate are not NULL.
- The EXCEPT operator excludes the results of the second part, effectively returning all rows where l_shipmode is not in the l_commitdate set and both columns are not NULL.
The two SQL queries are logically equivalent, but they return different results, indicating the presence of a bug.
How to repeat
The exported file for the database is in the attachment. : (https://github.com/LLuopeiqi/newtpcd/blob/main/tidb/tpcd.sql) .
- Lenguaje dominante
- Python
- Estrellas
- 616
- Forks
- 725
- Merge medio
- 1 d 6 h
- PR fusionados (30 d)
- 534
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 pingcap/docs
-
scripts/markdownlint deletes the tracked package-lock.json and modifies package.jsonPosiblemente ocupada @mjonss la tomó hoy. Abiertoarea/docs-efficiency type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Broken Link DetectedAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
Broken Link DetectedAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
Todos los issues de pingcap/docs
Issues similares
-
area:core-platform effort:S priority:P3 status:in-review type:test
Dificultad 2/5 Menos de una hora Aptitud para principiantes 80/100
randomparity/kdive#3246 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Requantification library converts m/z to mass with the hydrogen-atom mass instead of the proton massAbiertobug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
nf-core/metaboigniter#130 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
common-workflow-language/cwl-utils#477 ·
Los mantenedores suelen responder en 1 día
-
Add dependabotAbiertofeat
Dificultad 2/5 Menos de una hora Aptitud para principiantes 72/100
open-nudge/opentemplate#204 ·
Los mantenedores suelen responder en 1 día
-
github-stale-ci-pr-closer: KV state is double-wrapped, never persists, and hits the depth-32 limitPosiblemente ocupada @VascoSch92 la tomó hoy. Abiertopriority:medium ready-for-dev
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
OpenHands/extensions#781 ·
Los mantenedores suelen responder en 1 día