Skip to content

fix(query): trim numeric and boolean string casts#19809

Open
KKould wants to merge 1 commit intodatabendlabs:mainfrom
KKould:fix/duckdb-e2e-uncomment-cases
Open

fix(query): trim numeric and boolean string casts#19809
KKould wants to merge 1 commit intodatabendlabs:mainfrom
KKould:fix/duckdb-e2e-uncomment-cases

Conversation

@KKould
Copy link
Copy Markdown
Member

@KKould KKould commented May 7, 2026

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

  • Trim string inputs before numeric parsing so casts like CAST(' 1e1' AS DOUBLE) and CAST(' 1e1' AS INTEGER) succeed consistently.
  • Trim string-to-boolean inputs and accept '1' / '0' in addition to 'true' / 'false'.
  • Add Databend sqllogictest coverage in tests/sqllogictests/suites/query/functions/02_0002_function_cast.test.
  • Keep DuckDB migrated test updates out of this Databend PR; those will be proposed separately in bendtest and can depend on this PR.

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why
cargo check -p databend-common-functions
cargo build --bin databend-query --bin databend-sqllogictests
target/debug/databend-sqllogictests --run 'tests/sqllogictests/suites/query/functions/02_0002_function_cast.test' --handlers http
target/debug/databend-sqllogictests --run 'tests/sqllogictests/suites/query/functions/02_0002_function_cast.test' --handlers mysql --port 3307
UPDATE_GOLDENFILES=1 cargo test -p databend-common-functions --test it scalars::cast::test_cast -- --exact
cargo test -p databend-common-functions --test it scalars::cast::test_cast -- --exact
target/debug/databend-sqllogictests --run 'tests/sqllogictests/suites/duckdb/sql/cast/test_exponent_in_cast.test' --handlers http

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

This change is Reviewable

@github-actions github-actions Bot added the pr-bugfix this PR patches a bug in codebase label May 7, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0878089d52

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/query/functions/src/scalars/arithmetic/src/arithmetic.rs Outdated
@KKould KKould force-pushed the fix/duckdb-e2e-uncomment-cases branch from 0878089 to 9e33e8a Compare May 7, 2026 04:12
@KKould KKould self-assigned this May 7, 2026
@KKould KKould requested review from TCeason and sundy-li May 7, 2026 04:15
@KKould KKould force-pushed the fix/duckdb-e2e-uncomment-cases branch 4 times, most recently from 846442d to 95d554a Compare May 7, 2026 05:56
@KKould KKould closed this May 7, 2026
@KKould KKould reopened this May 7, 2026
@KKould KKould force-pushed the fix/duckdb-e2e-uncomment-cases branch from 95d554a to 3bf7902 Compare May 7, 2026 07:04
@KKould KKould changed the title fix(query): enable duckdb e2e compatibility cases fix(query): trim numeric and boolean string casts May 7, 2026
@KKould KKould force-pushed the fix/duckdb-e2e-uncomment-cases branch from 3bf7902 to 104ee1d Compare May 7, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix this PR patches a bug in codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant