Commit 3a872b7
[SPARK-51453][SQL] AssertTrue uses toPrettySQL instead of simpleString
### What changes were proposed in this pull request?
Make `AssertTrue` constructor use `toPrettySQL` instead of `simpleString`.
### Why are the changes needed?
Because of `simpleString` usage we end up having `ExpressionId`s in expression values (and thus in output schema) which can be queried. This is invalid because the behavior of this feature is non-deterministic (query which passes will fail with a cluster restart). Example:
```
SELECT assert_true(col <= col_2) FROM (VALUES ('2025-03-01', '2025-03-10')) t(col,col_2)
```
Output schema will be: `assert_true((col <= col_2), '(col#1214095 <= col_2#1214096)' is not true!)`
### Does this PR introduce _any_ user-facing change?
Some SQL queries are going to fail (but they would fail with every cluster reset, as explained).
### How was this patch tested?
Existing tests.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #50226 from mihailoale-db/asserttruefix.
Authored-by: mihailoale-db <mihailo.aleksic@databricks.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>1 parent 5df3721 commit 3a872b7
File tree
4 files changed
+11
-12
lines changed- sql
- catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions
- core/src/test
- resources/sql-tests
- analyzer-results
- results
- scala/org/apache/spark/sql
4 files changed
+11
-12
lines changedLines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2596 | 2596 | | |
2597 | 2597 | | |
2598 | 2598 | | |
2599 | | - | |
2600 | | - | |
| 2599 | + | |
2601 | 2600 | | |
2602 | 2601 | | |
2603 | 2602 | | |
| |||
0 commit comments