This repository was archived by the owner on Apr 30, 2026. It is now read-only.
Commit 2d0052a
committed
fix: dict-form by: rejects alias collisions with input columns
ray_table_add_col appends a new column without dedup'ing schema
names, and ray_table_get_col returns the FIRST matching column by
id. So when a dict-form by: reused an alias that already existed
in the input table — e.g.
(table [o G V] ...)
(select {from: t by: {o: G} s: (sum V)})
my previous commit happily added a second column named 'o, but the
group-by key scanner then returned the ORIGINAL 'o column, silently
grouping on the wrong data.
Two cases to distinguish:
1. Trivial self-alias {x: x}: the user just wants the existing
column as a group key with the same name. Skip the eval/add
step entirely and use the input column directly.
2. Any other collision {x: <anything-but-x>}: error out with
a clear domain message. Users must pick a distinct alias or
drop the shadowed input column first.
Also guards against within-dict duplicate keys ({x: A x: B}) by
tracking the names added in this loop.
Regression tests:
- shadow case raises "domain" error
- trivial self-alias {G: G} groups on G as expected
- xbar-bucket dict case still passes (no regression)
652/652 tests pass.1 parent 4f857f2 commit 2d0052a
2 files changed
Lines changed: 44 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
890 | 890 | | |
891 | 891 | | |
892 | 892 | | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
893 | 918 | | |
894 | 919 | | |
895 | 920 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5447 | 5447 | | |
5448 | 5448 | | |
5449 | 5449 | | |
| 5450 | + | |
| 5451 | + | |
| 5452 | + | |
| 5453 | + | |
| 5454 | + | |
| 5455 | + | |
| 5456 | + | |
| 5457 | + | |
| 5458 | + | |
| 5459 | + | |
| 5460 | + | |
| 5461 | + | |
| 5462 | + | |
| 5463 | + | |
| 5464 | + | |
| 5465 | + | |
| 5466 | + | |
| 5467 | + | |
| 5468 | + | |
5450 | 5469 | | |
5451 | 5470 | | |
5452 | 5471 | | |
| |||
0 commit comments