DevammPatel opened a new pull request, #77345: URL: https://github.com/apache/airflow/pull/77345
`TrinoHook.get_conn()` passes the connection's schema to Trino as the session schema, so Trino resolves unqualified table names against it. `get_openlineage_default_schema()` didn't follow that. It returned `trino.constants.DEFAULT_SCHEMA`, which is `None` in the Trino client, so the OpenLineage SQL parser never knew which schema an unqualified table belonged to. Take a connection with catalog `tpch` (in extra) and schema `sf1`, and the query `SELECT name FROM customer`: - The `information_schema.columns` lookup filtered only on `table_name = 'customer'`, not on the schema. In `tpch` every schema (`tiny`, `sf1`, `sf100`, ...) has a `customer` table, so the lineage listed all of them as inputs, even though Trino only read `tpch.sf1.customer`. - When that lookup failed and the parser fell back to the table names in the SQL, the datasets were named `tpch.None.customer`. The method now returns the connection schema, or `None` when the connection has none. That keeps it in line with `get_conn()` and with `AthenaSQLHook`, which also uses the Trino dialect. `TrinoToGCSOperator` uses the same lineage path, so it gets the fix too. Tested locally: - Two new unit tests in `providers/trino/tests/unit/trino/hooks/test_trino.py`, one on the hook method and one running `SQLExecuteQueryOperator.get_openlineage_facets_on_start()` with an unqualified table. Both fail on `main` and pass with this change. - `uv run --project providers/trino pytest providers/trino/tests/unit`: 57 passed. - `uv run --project providers/google pytest providers/google/tests/unit/google/cloud/transfers/test_trino_to_gcs.py`: 10 passed. - mypy (2.4.1) on `providers/trino/src/airflow/providers/trino/hooks/trino.py`: no issues. - `prek` pre-commit hooks: all passed except `check-provider-yaml-valid`. That one couldn't start its Breeze container on my machine because Docker Desktop has no access to the folder holding the checkout. This change doesn't touch any `provider.yaml`. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes (Claude Code, Claude Opus 5.5) I used Claude Code to look for the bug, write the fix and tests, and draft this description. I reviewed the change and the test results. Generated-by: Claude Code (Claude Opus 5.5) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
