Overaggressive pruning of nested fields(?) breaks some valid queries unless parquet pushdown is disabled
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
Piste de recherche
Start with the parquet reproducer in the issue and compare behavior with both pushdown settings enabled and disabled; the regression is reported between DataFusion 53.1.0 and 54.0.0. Trace nested field pruning and predicate pushdown to find why names.common is unavailable while evaluating the filter, then add a regression test for the original query. The issue links open pull request #27259, so check its status and discussion before taking this on.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Describe the bug
Valid queries against a parquet table with certain structural characteristics now fail with an execution error: Field common not found in struct.
As noted in the issue title, my guess is that this is due to overaggressive pruning of nested fields during pushdown, but that needs some further verification.
I have worked up a minimal reproducer (below) which you can replicate with the datafusion-cli.
To Reproduce
-- Set up: an external parquet table with a few rows.
-- Apologies for the somewhat oblique construction, but certain DataFusion versions
-- rejected a simpler version with map(['en'], [english]).
COPY (
SELECT named_struct(
'primary', local_name,
'common', map([language], [english])
) AS names
FROM (VALUES ('Local', 'en', 'English'), (NULL, 'en', 'Fallback'), ('', 'en', ''))
AS input(local_name, language, english)
) TO '/tmp/datafusion-reproducer.parquet' STORED AS PARQUET;
CREATE EXTERNAL TABLE nested_names
STORED AS PARQUET
LOCATION '/tmp/datafusion-reproducer.parquet';
-- These are defaults for a while AFAIK but including for reproducibility.
SET datafusion.execution.parquet.pushdown_filters = true;
SET datafusion.optimizer.enable_leaf_expression_pushdown = true;
-- Expected:
-- +-----------------------------+
-- | nested_names.names[primary] |
-- +-----------------------------+
-- | Local |
-- | NULL |
-- +-----------------------------+
--
-- Actual:
-- Parquet error: External: External error: Error evaluating filter predicate
-- caused by
-- Execution error: Field common not found in struct
SELECT names.primary
FROM nested_names
WHERE coalesce(names.primary, names.common['en']) <> '';
SET datafusion.execution.parquet.pushdown_filters = false;
SET datafusion.optimizer.enable_leaf_expression_pushdown = false;
-- With BOTH of these settings disabled, it succeeds and returns Local and NULL.
-- It still fails if either one is true.
SELECT names.primary
FROM nested_names
WHERE coalesce(names.primary, names.common['en']) <> '';
-- Hacky SQL workaround: succeeds even with pushdown enabled.
SET datafusion.execution.parquet.pushdown_filters = true;
SET datafusion.optimizer.enable_leaf_expression_pushdown = true;
SELECT names.primary
FROM nested_names
WHERE coalesce(names.primary, map_extract(names.common, 'en')[1]) <> '';
Expected behavior
The original query should succeed as written with syntax like names.common['en'], without needing to disable predicate pushdown or SQL-level hacks.
Additional context
I haven't had a chance to do a full git bisect, but installing a few releases, I've narrowed it quite a bit. Release-wise, the bug first appeared in 54.0.0; 53.1.0 was fine, and it is still broken on main at the time of this writing.
Willingness to contribute
I would like to contribute a fix for this bug, but request guidance from the DataFusion community
- Langage dominant
- Rust
- Étoiles
- 9.6k
- Forks
- 2.6k
- Merge moyen
- 3 j 4 h
- PR mergées (30 j)
- 345
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de apache/datafusion
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
apache/datafusion#27315 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
apache/datafusion#27094 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Substrait consumer doesn't recognise `shift_left` / `shift_right` from functions_arithmetic.yamlPeut-être pris @jonasHanhan l’a pris il y a 9 jours. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
apache/datafusion#27059 ·
Les mainteneurs répondent en général sous 1 jour
-
`ProjectionExprs::project_statistics` computes approximate `Statistics::total_byte_size` ignoring column statsPeut-être pris @joseph-isaacs l’a pris il y a 10 jours. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
apache/datafusion#27050 ·
Les mainteneurs répondent en général sous 1 jour
-
physical-plan: decoding an Unnest or Explain node with an unset field panicsPeut-être pris @geoHeil l’a pris il y a 8 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
apache/datafusion#26999 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de apache/datafusion
Issues similaires
-
P3
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
HerringtonDarkholme/hd-lang#1770 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
jonathanong/no-mistakes#3332 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
swc-project/swc-next-issues#310 ·
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
swc-project/swc-ai-issues#653 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
lbjlaq/Antigravity-Manager#3937 ·
Les mainteneurs répondent en général sous 1 jour