fix: preserve case in generated field path expressions#7698
Conversation
📝 WalkthroughWalkthrough
ChangesCase-sensitive column expression fix
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@rust/lance-datafusion/src/logical_expr.rs`:
- Around line 289-291: The initial column construction in Expr::Column is
cloning the first segment unnecessarily. Update the path handling in the
relevant logical expression conversion to consume parts with into_iter() (or
otherwise move the first element) so the first segment can be used without
parts[0].clone(), while keeping the later loop over the remaining segments
unchanged.
In `@rust/lance/src/index/append.rs`:
- Around line 1110-1123: The final assertion in the nearest-neighbor test is too
weak and only checks that the query succeeded; update the test around the
scanner/try_collect path to assert the expected number of returned rows instead
of just `result_rows > 0`. Use the same pattern as other append tests like
`test_append_index`, and tighten the check to confirm the `k=10` result count
from `scanner.nearest(...)` is actually returned.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 5614d26f-8559-48bb-aa40-815835fa38f9
📒 Files selected for processing (2)
rust/lance-datafusion/src/logical_expr.rsrust/lance/src/index/append.rs
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@rust/lance/src/index/append.rs`:
- Around line 1114-1119: Strengthen the assertions in the optimized-index test
after `scanner.try_into_batch()` by verifying the returned `id` column contains
`ROWS as u32 + 5`, in addition to asserting 10 rows. Follow the appended-vector
membership check used by `test_append_index` so the test confirms the appended
row is indexed and returned.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: ba322ffa-3ead-4edd-b5ef-d472b8df6243
📒 Files selected for processing (1)
rust/lance/src/index/append.rs
wjones127
left a comment
There was a problem hiding this comment.
Nice work. I appreciate the regression test.
Fixes #7697
Summary
Fix Lance-generated DataFusion field-path expressions so schema-derived column names preserve exact casing.
Previously,
field_path_to_exprused DataFusioncol(...), which lowercases unquoted identifiers. This caused generated nullable-vector filters likeVECTOR IS NOT NULLto resolve asvector, breaking case-sensitive schemas duringvector index creation / append optimization.
Changes
Expr::Column(Column::new_unqualified(...))instead ofcol(...).field_newstyle(...).Testing