Repository navigation
Add DataFusionEngine.get_table_schema() and deprecate get_schema() - #73466
Merged
kaxil merged 2 commits intoDec 1, 2026
Merged
Conversation
SZL741023
requested review from
Lee-W,
ashb,
gopidesupavan and
kaxil
as code owners
September 21, 2026 16:24
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
henry3260
self-requested a review
September 21, 2026 17:07
kaxil
approved these changes
Sep 21, 2026
kaxil
reviewed
Sep 21, 2026
kaxil
reviewed
Sep 21, 2026
Lee-W
reviewed
Sep 22, 2026
SZL741023
force-pushed
the
refactor_datafusion_engine_get_schema
branch
from
October 13, 2026 15:18
4eadfe1 to
9e1d908
Compare
kaxil
force-pushed
the
refactor_datafusion_engine_get_schema
branch
2 times, most recently
from
October 16, 2026 01:25
53f95b9 to
f54933c
Compare
Contributor
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
get_schema() returned a pre-formatted string. An agent's get_schema tool call needs JSON, so the DataFusion toolset bypassed the engine and read the session context directly. The two schema paths in common.ai also disagreed. The database hook path produced comma-joined "name type" pairs. The object-storage path produced a raw Arrow schema repr. One prompt could therefore describe two tables in two different shapes. Column metadata now matches DbApiHook.get_table_schema(), which callers already know how to format. Direct callers of get_schema() must now format the result themselves; the common.sql changelog shows how. Signed-off-by: Neil Lin <kuang741023@gmail.com>
kaxil
force-pushed
the
refactor_datafusion_engine_get_schema
branch
from
December 1, 2026 00:26
f54933c to
72fb484
Compare
kaxil
enabled auto-merge (squash)
December 1, 2026 01:16
get_schema() returning a list instead of a string broke callers that upgrade common-sql alone: released common.ai versions interpolate the string straight into the prompt. get_schema() keeps its string return and warns, and the structured column metadata moves to a new get_table_schema(), the name DbApiHook and IcebergHook already use for the same list[dict[str, str]] shape. Also spec the toolset's mock engine on DataFusionEngine and split the long schema-compare f-string.
1 task done
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
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.
Why
DataFusionEngine.get_schema()returns a pre-formatted string. An agent'sget_schematool call needs JSON, soDataFusionToolsetbypassed the engine and read the session context directly (a TODO left in #62850).The two schema paths in common.ai also disagreed: the database-hook path produced comma-joined
name typepairs, while the object-storage path embedded a raw Arrow schema repr, so one prompt could describe two tables in two different shapes.What changed
DataFusionEngine.get_table_schema()returnslist[dict[str, str]]withnameandtypekeys, the same name and shape asDbApiHook.get_table_schema()andIcebergHook.get_table_schema().get_schema()keeps returning the Arrow schema string and now emitsAirflowProviderDeprecationWarning.LLMSQLQueryOperatorandLLMSchemaCompareOperatorformat both schema paths with one shared helper.DataFusionToolset.get_schemareads the columns through the engine instead of walking the session context itself, and hands them straight tobuild_schema_result(). This clears the TODO AIP-99: Add DataFusionToolset #62850 left behind; the tool's own behaviour, including thename_containsfilter and the bounded summary, is unchanged.get_schema()with strings now mockget_table_schema(), and their prompt-text assertions expect thename type, ...format.Backward compatibility
No breaking change. Released common.ai versions call
get_schema()and interpolate the string into the prompt, soget_schema()keeps its return type and only warns. The common.sql changelog notes the deprecation. The common-sql bound in common.ai is marked# use next version, because common.ai now callsget_table_schema().Tests
Run locally after rebasing on
main:pytestfor common.aioperators/,toolsets/,utils/: 1962 passed, 5 skippedpytestfor common.sqldatafusion/: 129 passedprek run --from-ref upstream/main --stage pre-commit: 64 passed, 1 could not run:check-dependency-lower-boundsneedstomllib, and its cached hook env here is still Python 3.10. Run directly under 3.11 against both changedpyproject.tomlfiles it reports no issues.prek run mypy-providers --from-ref upstream/main: no issues foundSelective checks select the broader provider test suite; that is left to CI.
related: #62850
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5) following the guidelines