utkarshsahay2008-cloud opened a new pull request, #77692:
URL: https://github.com/apache/airflow/pull/77692

   ### Summary
   - **Added `DataFusionEngine.get_schema_columns(table_name)` 
(`common.sql`):** Extracted structured column metadata (`[{"name": ..., "type": 
...}]`) from `self.session_context.table(table_name).schema()` directly on 
`DataFusionEngine` so downstream consumers do not have to reach into 
`session_context` internals. Preserved `DataFusionEngine.get_schema()` 
unchanged so existing string-based callers (`LLMSQLQueryOperator`, 
`LLMSchemaCompareOperator`) remain backward-compatible.
   - **Refactored `DataFusionToolset._get_schema()` (`common.ai`):** Updated 
`_get_schema()` to call `engine.get_schema_columns(table_name)` instead of 
querying `engine.session_context.table(table_name).schema()` directly, removing 
the resolved `TODO`. Included a `hasattr(engine, "get_schema_columns")` 
fallback so `common.ai` stays compatible with older released versions of 
`apache-airflow-providers-common-sql`.
   - **Added Unit Tests:**
     - `providers/common/sql/tests/unit/common/sql/datafusion/test_engine.py`: 
Added `test_get_schema_columns_success` verifying structured column name and 
type extraction.
     - `providers/common/ai/tests/unit/common/ai/toolsets/test_datafusion.py`: 
Updated `_make_mock_engine` and added 
`test_get_schema_uses_engine_get_schema_columns` and 
`test_get_schema_falls_back_when_get_schema_columns_missing` to cover both code 
paths.
   
    <!-- SPDX-License-Identifier: Apache-2.0
         https://www.apache.org/licenses/LICENSE-2.0 -->
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Gemini following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


-- 
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