Repository navigation
Commit 83db407
authored
Fix the endless loop in Join and Merge when both suffixes are the same (dotnet#7692)
Fixes dotnet#6128
`Join` and `Merge` rename a column that appears in both frames . the
existing one gets
`leftSuffix` , the new one gets `rightSuffix` , and it repeats until the
two names are
different . when both suffixes are the same string the names stay equal
after every round , so
nothing ever ends the loop and both names keep growing .
the reporter hit it by passing the join column name where the suffix
goes . michaelgsharp
already named the cause on the issue in 2022 , this is just the patch
for it .
it now throws an `ArgumentException` naming the two parameters and the
column .
the check is inside `SetSuffixForDuplicatedColumnNames` rather than up
front in `Join` and
`Merge` , because equal suffixes are fine when the two frames share no
column name . nothing
gets renamed in that case and it works today , so an up front check
would break it . i
measured that before deciding where to put it :
```
join , shared column name , same suffix hangs , all four algorithms
join , no shared column name , same suffix fine
merge , shared column name , same suffix hangs
merge , default suffixes fine
```
three tests added . the first covers all four `JoinAlgorithm` values
with `"_same"/"_same"`
and with `""/""` , then checks `"_left"/"_right"` still gives the full
column set . the second
goes the other way and pins that equal suffixes are still allowed when
nothing collides . the
third is the same thing for `Merge` .
worth saying how the without-the-fix run looks , since it is not an
ordinary failure . the
defect is an endless loop , so the tests do not go red , they never
finish . i took the fix out
and the run was still going after 150 seconds with no result , at about
92 percent cpu . with
the fix the same six tests finish in 43 ms .
`Microsoft.Data.Analysis.Tests` is 483 passing , 0 failures , 5 skipped
. the tree without this
runs 477 , so the only difference is the six new ones . build is clean
with
`EnforceCodeStyleInBuild`.
i also grepped every `.Join(` and `.Merge(` caller in `src` and `test` ,
none of them pass
equal suffixes , so the new guard cannot fire on existing code .1 parent e1e858a commit 83db407
5 files changed
Lines changed: 67 additions & 0 deletions
File tree
- src/Microsoft.Data.Analysis
- test/Microsoft.Data.Analysis.Tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
26 | 35 | | |
27 | 36 | | |
28 | 37 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
264 | 267 | | |
265 | 268 | | |
266 | 269 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
85 | 119 | | |
86 | 120 | | |
87 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1013 | 1013 | | |
1014 | 1014 | | |
1015 | 1015 | | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
1016 | 1028 | | |
1017 | 1029 | | |
1018 | 1030 | | |
| |||
0 commit comments