Skip to content

fix(amazon): Support AWS China region endpoints in RedshiftSQLHook OpenLineage identifier parsing#65483

Merged
vincbeck merged 1 commit intoapache:mainfrom
jun09:fix/redshift-china-endpoint
Apr 20, 2026
Merged

fix(amazon): Support AWS China region endpoints in RedshiftSQLHook OpenLineage identifier parsing#65483
vincbeck merged 1 commit intoapache:mainfrom
jun09:fix/redshift-china-endpoint

Conversation

@jun09
Copy link
Copy Markdown
Contributor

@jun09 jun09 commented Apr 19, 2026

What

Fix _get_identifier_from_hostname in RedshiftSQLHook to correctly parse AWS China region endpoints (amazonaws.com.cn).

Why

AWS China regions (cn-north-1, cn-northwest-1) use a different endpoint suffix than global regions:

Region Endpoint format Parts
Global my-cluster.id.us-east-1.redshift.amazonaws.com 6
China my-cluster.id.cn-north-1.redshift.amazonaws.com.cn 7

The existing code only checks hostname.endswith("amazonaws.com") and len(parts) == 6, which fails for China endpoints. This causes the OpenLineage authority to fall back to the raw hostname instead of the expected cluster_identifier.region_name format.

Affects both provisioned clusters and Redshift Serverless workgroups in China regions.

How

Added a check for amazonaws.com.cn with len(parts) == 7, using the same parsing logic (parts[0].parts[2]) since the cluster identifier and region are at the same positions.

Testing

Added two parametrized test cases covering:

  • Provisioned cluster in cn-north-1
  • Redshift Serverless workgroup in cn-northwest-1

Verified with a real Redshift Serverless endpoint in cn-north-1:
airflow-test.029295324148.cn-north-1.redshift-serverless.amazonaws.com.cn

…enLineage identifier parsing

The _get_identifier_from_hostname method in RedshiftSQLHook only
handled global AWS endpoints (amazonaws.com) but not AWS China
region endpoints (amazonaws.com.cn). This caused the OpenLineage
authority part to fall back to the full hostname instead of
correctly parsing cluster_identifier.region_name.

Global endpoint format (6 dot-separated parts):
  my-cluster.id.us-east-1.redshift.amazonaws.com

China endpoint format (7 dot-separated parts):
  my-cluster.id.cn-north-1.redshift.amazonaws.com.cn

The same issue affects both provisioned clusters and
Redshift Serverless workgroups in cn-north-1 and cn-northwest-1.
@jun09 jun09 requested a review from o-nikolas as a code owner April 19, 2026 08:12
@boring-cyborg
Copy link
Copy Markdown

boring-cyborg Bot commented Apr 19, 2026

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
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@boring-cyborg boring-cyborg Bot added area:providers provider:amazon AWS/Amazon - related issues labels Apr 19, 2026
@vincbeck vincbeck merged commit b8deb33 into apache:main Apr 20, 2026
93 checks passed
@boring-cyborg
Copy link
Copy Markdown

boring-cyborg Bot commented Apr 20, 2026

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants