Skip to content

DuckDB.cast accept DuckDB::LogicalType.#1130

Merged
suketa merged 1 commit intomainfrom
case_accepts_logical_type
Mar 4, 2026
Merged

DuckDB.cast accept DuckDB::LogicalType.#1130
suketa merged 1 commit intomainfrom
case_accepts_logical_type

Conversation

@suketa
Copy link
Owner

@suketa suketa commented Mar 4, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Fixed type casting to properly handle logical type objects, resolving issues with integer value casting.

@coderabbitai
Copy link

coderabbitai bot commented Mar 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5119ad38-d379-4096-82d3-a5c5bbe89512

📥 Commits

Reviewing files that changed from the base of the PR and between 7e84bf5 and 60d7731.

📒 Files selected for processing (2)
  • lib/duckdb/casting.rb
  • test/duckdb_test/casting_test.rb

📝 Walkthrough

Walkthrough

The cast method in lib/duckdb/casting.rb is enhanced to unwrap DuckDB::LogicalType objects before processing, enabling proper handling when a LogicalType instance is passed as input. A corresponding test validates this new behavior for integer type casting.

Changes

Cohort / File(s) Summary
Type Unwrapping
lib/duckdb/casting.rb
Added logic to unwrap DuckDB::LogicalType objects in the cast method by extracting the underlying type before case dispatch.
LogicalType Casting Test
test/duckdb_test/casting_test.rb
Added new test method to verify that casting a string representation of an integer to DuckDB::LogicalType::INTEGER produces the correct numeric result.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

🐰 A LogicalType wrapped up tight,
We unwrap it with delight!
Cast it true, without a care,
Type normalization in the air! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and directly describes the main change: enabling DuckDB.cast to accept DuckDB::LogicalType objects, which matches the implementation adding type unwrapping and the test verification.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch case_accepts_logical_type

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.

@suketa suketa merged commit 60b20f0 into main Mar 4, 2026
38 of 41 checks passed
@suketa suketa deleted the case_accepts_logical_type branch March 4, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant