apache / apache/beam

[Bug]: retain_unknown_options incorrectly assumes unknown arguments are consecutive

Open
#22,434 0 comments 0 reactions 0 assignees View on GitHub
bug core P2 python
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

### What happened?

See #22422

retain_unknown_options first parses all known arguments, then parses the unknown arguments assuming they are consecutive. To illustrate this issue, let's look at this execution:

```
run_pipeline.py --unknown_arg --known_arg=foo bar
```

We first parse the known arguments, and are left with `unknown_args = ['--unknown_arg', 'bar']`. Our logic then assumes `bar` is the value for an unknown option called `unknown_arg`.

### Issue Priority

Priority: 2

### Issue Component

Component: sdk-py-core

Contributor guide

Open the contributing guide

Research direction

Locate retain_unknown_options in the Python SDK core and reproduce the example with unknown_arg and known_arg. Add coverage for nonconsecutive unknown arguments, and consider the issue done when `bar` is not incorrectly treated as the value of `unknown_arg`.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.