Skip to content

fix(ibis): fix ClickHouse Decimal/Numeric and Nullable Type Mapping#1423

Merged
goldmedal merged 1 commit intoCanner:mainfrom
MarceloNunesAlves:main
Feb 13, 2026
Merged

fix(ibis): fix ClickHouse Decimal/Numeric and Nullable Type Mapping#1423
goldmedal merged 1 commit intoCanner:mainfrom
MarceloNunesAlves:main

Conversation

@MarceloNunesAlves
Copy link
Copy Markdown
Contributor

@MarceloNunesAlves MarceloNunesAlves commented Feb 12, 2026

This PR addresses an issue in the ClickHouse data source connector where Decimal, Numeric, and Nullable data types were not being correctly mapped to Wren Engine's internal types.

Previously, the type mapping relied on exact string matches. When ClickHouse returned parameterized types like Decimal(15,2), the lookup in CLICKHOUSE_TYPE_MAPPING would fail, resulting in an UNKNOWN type and a warning log.

Changes

  • Parameterized Type Handling: Updated the ClickHouse type adapter to strip precision and scale parameters (e.g., converting Decimal(18,4) to decimal) before performing the dictionary lookup.
  • **Support for Numeric**: Added numeric as a valid alias for decimal in the ClickHouse type mapping.
  • Nullable Support: Added logic to handle the Nullable(T) wrapper by extracting the inner type T before mapping.
  • Updated Mapping Table: Expanded CLICKHOUSE_TYPE_MAPPING to ensure all variations of decimal and numeric types are captured.

Problem Flow (Example)

  1. ClickHouse returns: Nullable(Decimal(15,2))
  2. Normalization:
  • Unwraps NullableDecimal(15,2)
  • Removes parameters → decimal
  1. Dictionary Lookup: Successfully finds decimal in CLICKHOUSE_TYPE_MAPPING.
  2. Result: Correctly mapped to Wren DECIMAL type. ✅

Checklist

  • I have confirmed that this change complies with the project's contribution guidelines.
  • I have added tests to cover these type mapping scenarios.
  • All existing tests passed.

Summary by CodeRabbit

Improvements

  • Enhanced ClickHouse data source compatibility with improved type mapping for numeric and decimal data types
  • Improved handling of nullable column types to ensure accurate data representation and compatibility
  • Increased robustness when working with diverse ClickHouse database schemas

@github-actions github-actions bot added ibis python Pull requests that update Python code labels Feb 12, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

Added support for numeric column types in ClickHouse type mapping. Extended the type transformation logic to recognize decimal and numeric prefixes, handle Nullable type wrappers, and map them to corresponding RustWrenEngineColumnType values.

Changes

Cohort / File(s) Summary
ClickHouse Type Mapping Enhancement
ibis-server/app/model/metadata/clickhouse.py
Added "numeric" type to CLICKHOUSE_TYPE_MAPPING constant. Enhanced _transform_column_type function to detect and unwrap Nullable types recursively, and handle decimal/numeric type prefixes for direct column type mapping.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A numeric bloom in ClickHouse lands,
Where Nullable types fall into our hands,
Decimals unwrapped, mappings aligned,
New column types beautifully designed! ✨

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main
Title check ✅ Passed The title 'fix(ClickHouse Decimal/Numeric and Nullable Type Mapping' accurately describes the main changes: it addresses type mapping issues for Decimal, Numeric, and Nullable types in ClickHouse.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@goldmedal goldmedal changed the title Fix ClickHouse Decimal/Numeric and Nullable Type Mapping fix(ibis): fix ClickHouse Decimal/Numeric and Nullable Type Mapping Feb 13, 2026
Copy link
Copy Markdown
Contributor

@goldmedal goldmedal left a comment

Choose a reason for hiding this comment

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

Thanks @MarceloNunesAlves. Makes sense to me 👍

@goldmedal goldmedal merged commit 19a143b into Canner:main Feb 13, 2026
6 of 8 checks passed
nhaluc1005 pushed a commit to nhaluc1005/text2sql-practice that referenced this pull request Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ibis python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants