Skip to content

fix(sql): support unsigned ASOF join keys#19603

Open
sundy-li wants to merge 2 commits intodatabendlabs:mainfrom
sundy-li:issue-19570-20260324-1953
Open

fix(sql): support unsigned ASOF join keys#19603
sundy-li wants to merge 2 commits intodatabendlabs:mainfrom
sundy-li:issue-19570-20260324-1953

Conversation

@sundy-li
Copy link
Member

@sundy-li sundy-li commented Mar 24, 2026

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

Summary

  • extend ASOF join boundary generation to support unsigned integer join keys
  • replace ASOF boundary unwrap() calls with BadDataValueType propagation so unsupported types return an error instead of panicking
  • add an expression-level regression test plus an unsigned ASOF sqllogictest case

Fixes #19570

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Validation:

  • cargo test -p databend-common-expression --test it test_integer_infinity_boundaries
  • cargo clippy -p databend-common-sql --lib --tests -- -D warnings

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 Mar 24, 2026
@sundy-li sundy-li added the agent-reviewable Ready for agent review label Mar 24, 2026
Copy link

@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: b940b91509

ℹ️ 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".

Copy link
Member Author

@sundy-li sundy-li left a comment

Choose a reason for hiding this comment

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

Found a blocking issue in the unsigned ASOF sentinel handling. Using the type-domain max/min as infinity() / ninfinity() makes the rewrite drop valid boundary matches (>= at MAX and <= at MIN). See the inline comment for a concrete example.

Copy link
Member Author

@sundy-li sundy-li left a comment

Choose a reason for hiding this comment

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

Focused verification passed, but the new unsigned sentinels still make ASOF results wrong at the legal type boundaries. rewrite_asof() uses infinity()/ninfinity() as the LEAD default and then applies strict < / > bounds, so rows at UInt*_MAX or UInt*_MIN cannot match the terminal or initial interval even though they should. This means unsigned ASOF joins are still incorrect for valid key values and need a different unbounded strategy or dedicated operator before this lands.

@sundy-li sundy-li added the agent-changed Changed by agent label Mar 24, 2026
@sundy-li sundy-li removed the agent-changed Changed by agent label Mar 24, 2026
@github-actions
Copy link
Contributor

🤖 CI Job Analysis

Workflow: 23517289205

📊 Summary

  • Total Jobs: 86
  • Failed Jobs: 4
  • Retryable: 0
  • Code Issues: 4

NO RETRY NEEDED

All failures appear to be code/test issues requiring manual fixes.

🔍 Job Details

  • linux / sqllogic / cluster (duckdb, 4c, hybrid): Not retryable (Code/Test)
  • linux / sqllogic / cluster (duckdb, 4c, http): Not retryable (Code/Test)
  • linux / sqllogic / standalone (duckdb, 4c, http): Not retryable (Code/Test)
  • linux / sqllogic / standalone (duckdb, 4c, hybrid): Not retryable (Code/Test)

🤖 About

Automated analysis using job annotations to distinguish infrastructure issues (auto-retried) from code/test issues (manual fixes needed).

@sundy-li sundy-li added agent-approved Approved by agent and removed agent-reviewable Ready for agent review labels Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-approved Approved by agent pr-bugfix this PR patches a bug in codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ASOF Join panics on UInt8 type — unwrap on unsupported type

1 participant