fix(query): refine infer filter type compatibility#19816
Merged
Conversation
0f732c0 to
b6ff278
Compare
b6ff278 to
5825d27
Compare
b41sh
approved these changes
May 9, 2026
11 tasks
sundy-li
approved these changes
May 11, 2026
Member
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Merged
via the queue into
databendlabs:main
with commit May 12, 2026
706c431
440 of 450 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/
Summary
eqfunction.safe_common_type: compute an inference-safe common type, then require both sides to cast to that type through injective/lossless-enough conversions.Null, integer-to-integer casts, integer-to-Decimal casts, Decimal widening,DatetoTimestamp, Float-to-wider-Float, exact same Map types, and recursive Array/Tuple casts when their elements/fields are also safe.BIGINT = BIGINT UNSIGNEDjoin keys.Tips
The safe common type path intentionally avoids Databend's normal
eqauto-cast andTRY_CASTrules. Those rules are valid for expression evaluation, but failed conversions can becomeNULL, so the comparison is not a safe equivalence relation for deriving transitive predicates.String and numeric equality is intentionally rejected. For example,
'01' = 1and'1' = 1can both evaluate to true, while'01' = '1'is false, so using those edges to infer'01' = '1'would be incorrect.Float equality is intentionally not used as an inference edge when it requires converting an integer or Decimal into Float. Integer/Decimal values can collapse after conversion to Float, so the conversion is not injective/lossless enough for equivalence-class inference.
Tests
Validation commands:
Type of change
This change is