Commit f39e82c
[SPARK-23986][SQL] freshName can generate non-unique names
## What changes were proposed in this pull request?
We are using `CodegenContext.freshName` to get a unique name for any new variable we are adding. Unfortunately, this method currently fails to create a unique name when we request more than one instance of variables with starting name `name1` and an instance with starting name `name11`.
The PR changes the way a new name is generated by `CodegenContext.freshName` so that we generate unique names in this scenario too.
## How was this patch tested?
added UT
Author: Marco Gaido <[email protected]>
Closes apache#21080 from mgaido91/SPARK-23986.1 parent 3990daa commit f39e82c
File tree
2 files changed
+13
-8
lines changed- sql/catalyst/src
- main/scala/org/apache/spark/sql/catalyst/expressions/codegen
- test/scala/org/apache/spark/sql/catalyst/expressions
2 files changed
+13
-8
lines changedLines changed: 3 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
572 | 572 | | |
573 | 573 | | |
574 | 574 | | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
583 | 578 | | |
584 | 579 | | |
585 | 580 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
489 | 489 | | |
490 | 490 | | |
491 | 491 | | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
492 | 502 | | |
0 commit comments