Tarun4201 opened a new pull request, #41742:
URL: https://github.com/apache/beam/pull/41742

   ## Description
   
   Closes #19331
   
   This PR introduces namespace support for PipelineOptions across the Java and 
Python SDKs, allowing options with identical names to be distinguished through 
qualified names.
   
   ### Motivation
   
   PipelineOptions with identical property names across different option 
interfaces or groups can create naming conflicts, especially when their types 
differ.
   
   This change introduces qualified option names while preserving existing 
unqualified option behaviour.
   
   ### Java SDK
   
   - Added qualified command-line option parsing (supporting 
`--<Group>.<option>`, decapitalized `--<group>.<option>`, and FQCN 
`--<pkg>.<Group>.<option>`).
   - Improved getter/setter pairing across interfaces via `Multimap` in 
`PipelineOptionsFactory` to allow disjoint interfaces to define identical 
property names without false type collisions.
   - Added ambiguity detection for conflicting unqualified options with 
informative error messages guiding the user to qualify the option.
   - Implemented group-aware candidate key resolution in 
`ProxyInvocationHandler`.
   - Preserved qualified names through Runner API translation and Jackson 
serialization/deserialization.
   
   ### Python SDK
   
   - Added qualified command-line argument registration (`--<Group>.<option>` 
and snake_case `--<group_name>.<option>`) in `_BeamArgumentParser`.
   - Implemented MRO-aware qualified option lookup in 
`PipelineOptions.__getattr__`.
   - Added group-aware setter handling in `PipelineOptions.__setattr__`.
   - Preserved qualified options through Runner API translation 
(`to_runner_api` / `from_runner_api`).
   
   ### Backward Compatibility
   
   - **Existing unqualified options**: Fully preserved. Unqualified 
command-line flags and programmatic access work unchanged.
   - **Same-name options with compatible types**: Fully preserved. Sibling 
interfaces continue to share values (`testDisjointSiblingsShareValues` passes).
   - **Same-name options with incompatible types**: Coexist cleanly when 
qualified. Independent values can be set and accessed per group.
   - **Qualified and unqualified options supplied together**: Unqualified 
options act as fallbacks; explicit qualified options override unqualified 
values without being overwritten by sibling setters.
   
   ### Tests
   
   - Java SDK (`:sdks:java:core:test`):
     `./gradlew :sdks:java:core:test --tests "org.apache.beam.sdk.options.*" 
--tests "org.apache.beam.sdk.util.construction.PipelineOptionsTranslationTest*"`
     Result: **257 passed, 0 failed, 0 skipped**.
   - Java DirectRunner (`:runners:direct-java:test`):
     `./gradlew :runners:direct-java:test --tests 
"org.apache.beam.runners.direct.DirectRunnerTest*"`
     Result: **22 passed, 0 failed, 0 skipped**.
   - Python SDK (`pytest`):
     `pytest sdks/python/apache_beam/options/pipeline_options_test.py`
     Result: **162 passed, 2 skipped, 0 failed**.
   - Code formatting & checkstyle:
     `./gradlew :sdks:java:core:spotlessCheck` (BUILD SUCCESSFUL).
   
   ### Discussion
   
   Initial design discussion was started on the Apache Beam developer mailing 
list. Feedback on compatibility, option resolution and runner integration is 
welcome.
   
   Issue: https://github.com/apache/beam/issues/19331
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to