-
Notifications
You must be signed in to change notification settings - Fork 12
Map projected columns for ChunkTableSource #68
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
base: main
Are you sure you want to change the base?
Conversation
fbb407c to
295a94b
Compare
295a94b to
906174e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the projection mapping logic for table UDFs by moving it from the Row structure to the DataChunk structure. This consolidates projection handling in one place, making it consistent for both row-based (FillRow) and chunk-based (FillChunk) table UDF implementations.
Key changes:
- Moved projection mapping from Row to DataChunk for centralized handling
- Updated Row methods to delegate projection logic to the underlying DataChunk
- Added projection-aware logic to DataChunk's GetValue, SetValue, and SetChunkValue methods
- Separated projection-specific tests into dedicated test functions for better coverage
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| table_udf.go | Assigns projection mapping to DataChunk instead of Row for consistent projection handling across all table UDF types |
| row.go | Removes projection field from Row struct and delegates projection logic to the underlying DataChunk |
| data_chunk.go | Adds projection field and implements projection-aware column access with automatic remapping of column indices |
| errors.go | Adds new error function for unprojected column access errors |
| table_udf_test.go | Adds dedicated tests for chunk-based and row-based projection pushdown, separates pushdownTableUDF test into standalone test function |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
906174e to
c54d508
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
data_chunk.go
Outdated
| if len(chunk.projection) == 0 { | ||
| if colIdx >= len(chunk.columns) { | ||
| return getError(errAPI, columnCountError(colIdx, len(chunk.columns))) | ||
| } |
Copilot
AI
Nov 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing bounds check for negative colIdx values when no projection is set. The code checks colIdx >= len(chunk.columns) but not colIdx < 0, which could lead to a panic. The check should be:
if colIdx < 0 || colIdx >= len(chunk.columns) {
return getError(errAPI, columnCountError(colIdx, len(chunk.columns)))
}
VGSML
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wmTJc9IK0Q Could you try to avoid using nested if and if else construction. It's looks like code can be more readable
|
@VGSML Thanks for the review, I've cleaned this up. |
VGSML
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! @taniabogatsch could you take a look at
taniabogatsch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I've left some comments and a few nits. :)
Fixes #66
This moves the projection mapping logic from Row to DataChunk and handles it consistently in one place for FillRow or FillChunk in table UDFs.