Skip to content

Conversation

@zhangshenghang
Copy link
Member

Purpose of this pull request

Does this PR introduce any user-facing change?

How was this patch tested?

Check list

@github-actions github-actions bot added the e2e label Nov 26, 2025
@davidzollo davidzollo requested a review from Copilot November 26, 2025 15:26
Copilot finished reviewing on behalf of davidzollo November 26, 2025 15:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the ClickHouse connector to properly handle nullable column types when creating tables. The fix ensures that:

  1. Nullable columns are correctly wrapped with Nullable() type
  2. Primary key columns are never wrapped with Nullable() (as ClickHouse doesn't allow nullable columns in ORDER BY/PRIMARY KEY)
  3. Map and Array types are excluded from nullable wrapping (ClickHouse limitation)

Key changes:

  • Added ThreadLocal-based tracking of primary key columns during table creation
  • Enhanced columnToConnectorType to wrap nullable columns with Nullable() while respecting ClickHouse constraints
  • Added comprehensive unit tests for nullable handling and comment escaping
  • Updated integration test assertion to include stdout for better debugging

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
ClickhouseCatalogUtil.java Core fix: Added nullable type wrapping logic with primary key and complex type exclusions via ThreadLocal tracking
ClickhouseCatalogUtilTest.java Added unit tests for nullable wrapping, comment escaping, and null input handling
ClickhouseCreateTableTest.java Updated expected SQL to reflect Nullable() wrapping for non-primary-key columns
ClickhouseIT.java Enhanced test assertion to include stdout in error messages for debugging

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant