Skip to content

refactor(query): rewrite equivalent function calls as casts - #20369

Open
forsaken628 wants to merge 8 commits into
databendlabs:mainfrom
forsaken628:function-call-to-cast
Open

refactor(query): rewrite equivalent function calls as casts#20369
forsaken628 wants to merge 8 commits into
databendlabs:mainfrom
forsaken628:function-call-to-cast

Conversation

@forsaken628

@forsaken628 forsaken628 commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

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

Summary

  • Resolve cast functions from the actual Expr::Cast execution path instead of inferring equivalence from function names.
  • Rewrite a function call to CastExpr only when its canonical function, parameters, argument type, and return type exactly match the resolved cast implementation.
  • Reuse the same resolved function in cast evaluation and domain inference, including nullable, decimal, Variant/JSON, and try-cast cases.

Tests

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

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):

AI assistance

  • AI usage: An AI coding agent assisted with implementation.
  • Responsible human: @forsaken628
  • The responsible human has read every line of this diff and can explain each change

This change is Reviewable

@github-actions github-actions Bot added the pr-refactor this PR changes the code base without new features or bugfix label Aug 24, 2026
@forsaken628
forsaken628 force-pushed the function-call-to-cast branch 2 times, most recently from aa75ca0 to 0b2e8be Compare September 3, 2026 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-refactor this PR changes the code base without new features or bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant