Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: coerce scalar for between #3327

Merged
merged 3 commits into from
Jan 3, 2025
Merged

fix: coerce scalar for between #3327

merged 3 commits into from
Jan 3, 2025

Conversation

chenkovsky
Copy link
Contributor

for example, current str > 10 will throw exception. but str BETWEEN 10 AND 20 will not throw exception.
with this PR check type coerce for between clause.

@github-actions github-actions bot added bug Something isn't working python labels Jan 2, 2025
@eddyxu eddyxu requested review from westonpace and BubbleCal January 2, 2025 15:55
Copy link
Contributor

@westonpace westonpace left a comment

Choose a reason for hiding this comment

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

Sweet! This probably also closes #3311

Feel free to ignore my review comment if it is complicated / doesn't work. I think the vast majority of BETWEEN clauses are going to be BETWEEN <literal> AND <literal> anyways.

Comment on lines 101 to 110
let low = if matches!(low.as_ref(), Expr::Literal(_)) {
Box::new(resolve_value(low.as_ref(), &inner_expr_type)?)
} else {
low.clone()
};
let high = if matches!(high.as_ref(), Expr::Literal(_)) {
Box::new(resolve_value(high.as_ref(), &inner_expr_type)?)
} else {
high.clone()
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to use something more generic like let low = coerce_expr(left.as_ref(), &inner_expr_type)?;

(note: I don't know off the top of my head if this works or not)

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 78.90%. Comparing base (2092808) to head (ec2d4f5).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
rust/lance-datafusion/src/logical_expr.rs 70.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3327      +/-   ##
==========================================
- Coverage   79.01%   78.90%   -0.11%     
==========================================
  Files         246      246              
  Lines       87628    87845     +217     
  Branches    87628    87845     +217     
==========================================
+ Hits        69238    69318      +80     
- Misses      15523    15650     +127     
- Partials     2867     2877      +10     
Flag Coverage Δ
unittests 78.90% <70.00%> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@eddyxu eddyxu merged commit f730f75 into lancedb:main Jan 3, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants