Repository navigation
Fix GROUP BY with table-prefixed columns in arithmetic expressions - #2297
Merged
Merged
Conversation
When using table-prefixed columns (e.g., a.id) in arithmetic expressions with GROUP BY, the type was being lost because the column nick resolution didn't match the group storage key. Fixed by using columnid as fallback when nick is not set in grouped context. Co-authored-by: mathiasrw <[email protected]>
Copilot
AI
changed the title
[WIP] Fix GROUP BY losing integer type issue in SQL query
Fix GROUP BY with table-prefixed columns in arithmetic expressions
Dec 2, 2025
mathiasrw
requested changes
Dec 2, 2025
Member
|
@copilot continue |
Renamed test file from test926.js to test536-B.js following the repository convention of naming tests after issue numbers. Co-authored-by: mathiasrw <[email protected]>
Contributor
Author
mathiasrw
marked this pull request as ready for review
December 2, 2025 22:57
mathiasrw
approved these changes
Dec 2, 2025
This was referenced Oct 20, 2026
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.
Description
GROUP BY stores values by column name only (
g['id']), but expressions with table prefixes attempted to access them with the full qualifier (g['a.id']), resulting inundefinedvalues. For example:Changes
src/50expression.jsColumn.toJS()to fall back tocolumnidwhennickis undefined in grouped context ('g')test/test536-B.jsOriginal prompt
<issue_description>```
create table data( id INTEGER PRIMARY KEY, grp INTEGER);
insert into data select range._ as id , range._ % 3 as grp from RANGE(0,9)as range;
select id, id +1 from data group by id;
select a.id, a.id +1, CAST(a.id AS INTEGER) +1 from data as a, data as b where a.id < b.id and a.grp = b.grp group by a.id
I will check details later.
</comment_new>
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.