physical-plan: decoding an Unnest or Explain node with an unset field panics
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
Research direction
Start in datafusion/physical-plan/src/unnest.rs, in UnnestExec::try_from_proto, where recursion.input_column and recursion.output_column are unwrapped. Then look at datafusion/physical-plan/src/explain.rs, at stringified_plan_from_proto and ExplainExec::try_from_proto, where plan_type and plan_type_enum are unwrapped. Done means both paths return an internal_err naming the missing field, with a decode test for each case.
Written by the indexing model from the issue text.
Description
Describe the bug
Two physical plan decoders in datafusion-physical-plan panic on a field the wire leaves unset. Their neighbours return an error in the same situation.
UnnestExec::try_from_proto unwraps both columns of each recursion option:
input_column: recursion.input_column.as_ref().unwrap().into(),
output_column: recursion.output_column.as_ref().unwrap().into(),
RecursionUnnestOption.input_column and .output_column are optional messages, so a peer can leave either one unset. A few lines earlier, the same function refuses a missing options with internal_datafusion_err!:
ExplainExec::try_from_proto maps each stringified plan through stringified_plan_from_proto. That function panics when plan_type, or its plan_type_enum, is unset:
ExplainExec::try_from_proto itself refuses a missing schema with an error:
The same code is in 55.1.0, at src/unnest.rs lines 473-474 and src/explain.rs lines 355-363.
To Reproduce
Decode a PhysicalPlanNode with datafusion_proto::bytes::physical_plan_from_bytes, where the node is one of:
- an
Explainnode with aschemaand oneStringifiedPlan::default()instringified_plans, soplan_typeisNone; - an
Unnestnode with a decodableinputandschema, andoptions.recursionsholding oneRecursionUnnestOption::default(), soinput_columnisNone.
Both reach the panic without any earlier check failing. I found these by reading the decode path and have not run these exact inputs here yet. I will add the panic output once a decode test on our side has run.
Expected behavior
Return internal_err! naming the missing field, as the sibling checks do. The caller then gets Err and keeps running.
Additional context
This matters wherever a process decodes plans it did not encode itself, such as a distributed worker that receives plan stages from peers. A malformed node panics the decoding task, and under panic = "abort" it stops the whole process. A related case in datafusion-proto is #26998.
The fix is two ok_or_else calls plus a decode test for each. I can open the PR if that is welcome.
- Dominant language
- Rust
- Stars
- 9.6k
- Forks
- 2.6k
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 319
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/datafusion
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
apache/datafusion#26998 ·
Maintainers usually reply within 1 day
-
`repeat` on `LargeUtf8` aborts the process on a result size no allocation can satisfyPossibly taken @huong8373tt-beep claimed this 1 day ago. Openbug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/datafusion#26948 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
[Bug] atan2 does not normalize -0.0 the way Spark doesPossibly taken @galaxytemple claimed this 3 days ago. Openbug spark
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/datafusion#26333 ·
Maintainers usually reply within 1 day
-
Unparser turns NULL list literals into `[]` and fails on NULL struct/map literalsMay be free again A pull request for this issue was closed without being merged. Openbug help wanted unparser
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/datafusion#26316 · 1 comment ·
Maintainers usually reply within 1 day
-
Struct union type coercion takes field nullability from the wrong field when field order differsMay be free again @med9110 claimed this 19 days ago, and no pull request is open. Openbug help wanted logical-expr tech debt
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
apache/datafusion#26296 · 1 comment ·
Maintainers usually reply within 1 day
All issues in apache/datafusion
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
GiganticMinecraft/seichi-portal-backend#1651 ·
Maintainers usually reply within 1 day
-
Android visitors are offered the Linux .deb on cap.so's homepage and download pagePossibly taken @patrickballard claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
CapSoftware/Cap#3677 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day