[FLINK-40418][python] Support attribute-based column access on DataFrame - #29164
Open
beetle0915 wants to merge 1 commit into
Open
beetle0915 wants to merge 1 commit into
beetle0915 wants to merge 1 commit into
Conversation
Generated-by: OpenAI Codex (codex-cli 0.154.0-alpha.6.2)
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Implement FLINK-40418, the attribute-based column access described in FLIP-591. This allows
df.nameto return a column expression when the name is a valid Python identifier, is not a keyword, and does not conflict with an existing DataFrame attribute.The implementation follows the approach discussed and accepted on the Jira issue.
Brief change log
DataFrame.__getattr__, preserving normal Python attribute lookup and reusing the existing Table column expression API.AttributeErrorfor invalid or missing column names; guard against recursive lookup on uninitialized instances. Column lookup resolves the current schema without executing a Flink job.Verifying this change
This change adds 13 tests covering valid and missing columns, identifier rules, attribute conflicts, transformed schemas, uninitialized instances, schema errors, and execution of a filter/projection using attribute references.
Local validation on Python 3.12 and Java 17:
python -m pytest flink-python/pyflink/dataframe/tests -q: 352 passed (10 deprecation warnings).flink-python:python -m flake8 --config=tox.ini pyflink/dataframe: passed.flink-python:python -m mypy --config-file tox.ini: passed (83 source files).-a -W --keep-going: passed with no warnings.git diff --check: passed.The local validation does not include the full repository
mvn clean verify, the full end-to-end suite, or the other supported Python versions; these checks remain to be covered by CI/review.Does this pull request potentially affect one of the following parts:
@Public(Evolving): yesDocumentation
Was generative AI tooling used to co-author this PR?
Generated-by: OpenAI Codex (codex-cli 0.154.0-alpha.6.2)