Commit 890ce8d
[SPARK-49642][SQL] Remove the ANSI config suggestion in DATETIME_FIELD_OUT_OF_BOUNDS
## Summary
In Spark 4.0.0 ANSI mode is on by default. The JIRA asks to minimize suggestions that tell users to turn ANSI off. The error `DATETIME_FIELD_OUT_OF_BOUNDS` previously had a subclass `WITH_SUGGESTION` that appended "If necessary set spark.sql.ansi.enabled to false to bypass this error." This PR removes that suggestion; users can use `try_*` functions for safe behavior instead. The error now always uses `WITHOUT_SUGGESTION` (message is just the range description).
## Change
- **error-conditions.json**: Removed the `WITH_SUGGESTION` subclass from `DATETIME_FIELD_OUT_OF_BOUNDS` (kept only `WITHOUT_SUGGESTION`).
- **QueryExecutionErrors.scala**: `ansiDateTimeArgumentOutOfRange` now throws `DATETIME_FIELD_OUT_OF_BOUNDS.WITHOUT_SUGGESTION` with only `rangeMessage` (removed `ansiConfig` parameter).
- **SQL test result files** (date.sql.out, timestamp.sql.out, timestampNTZ/timestamp-ansi.sql.out, postgreSQL/date.sql.out, datetime-legacy.sql.out): Updated expected error class from `WITH_SUGGESTION` to `WITHOUT_SUGGESTION` and removed `ansiConfig` from expected messageParameters where the error is `DATETIME_FIELD_OUT_OF_BOUNDS`.
- **QueryExecutionAnsiErrorsSuite.scala**: Added a regression test for `DATETIME_FIELD_OUT_OF_BOUNDS` so the error does not suggest disabling ANSI mode.
## Tests
Added `SPARK-49642: DATETIME_FIELD_OUT_OF_BOUNDS does not suggest ANSI config` in `QueryExecutionAnsiErrorsSuite`.
Local validation:
- `./build/sbt "sql/testOnly org.apache.spark.sql.errors.QueryExecutionAnsiErrorsSuite -- -z SPARK-49642"` passed.
- `./build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite -- -z time.sql"` passed.
Fixes SPARK-49642
**JIRA assignee for credit:** deepujain
Closes #54695 from deepujain/SPARK-49642-remove-ansi-suggestion-datetime-out-of-bounds.
Authored-by: Deepak Jain <deepujain@gmail.com>
Signed-off-by: Max Gekk <max.gekk@gmail.com>1 parent bc72d93 commit 890ce8d
9 files changed
Lines changed: 37 additions & 52 deletions
File tree
- common/utils/src/main/resources/error
- sql
- catalyst/src/main/scala/org/apache/spark/sql
- catalyst/util
- errors
- core/src/test
- resources/sql-tests/results
- postgreSQL
- timestampNTZ
- scala/org/apache/spark/sql/errors
Lines changed: 0 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2128 | 2128 | | |
2129 | 2129 | | |
2130 | 2130 | | |
2131 | | - | |
2132 | | - | |
2133 | | - | |
2134 | | - | |
2135 | | - | |
2136 | 2131 | | |
2137 | 2132 | | |
2138 | 2133 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1030 | 1030 | | |
1031 | 1031 | | |
1032 | 1032 | | |
1033 | | - | |
| 1033 | + | |
1034 | 1034 | | |
1035 | 1035 | | |
1036 | 1036 | | |
| |||
1045 | 1045 | | |
1046 | 1046 | | |
1047 | 1047 | | |
1048 | | - | |
| 1048 | + | |
1049 | 1049 | | |
1050 | | - | |
| 1050 | + | |
1051 | 1051 | | |
1052 | 1052 | | |
1053 | 1053 | | |
| |||
Lines changed: 1 addition & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
| 306 | + | |
318 | 307 | | |
319 | 308 | | |
320 | 309 | | |
| |||
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | 59 | | |
61 | 60 | | |
62 | 61 | | |
| |||
69 | 68 | | |
70 | 69 | | |
71 | 70 | | |
72 | | - | |
| 71 | + | |
73 | 72 | | |
74 | 73 | | |
75 | | - | |
76 | 74 | | |
77 | 75 | | |
78 | 76 | | |
| |||
Lines changed: 5 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | 59 | | |
61 | 60 | | |
62 | 61 | | |
| |||
69 | 68 | | |
70 | 69 | | |
71 | 70 | | |
72 | | - | |
| 71 | + | |
73 | 72 | | |
74 | 73 | | |
75 | | - | |
76 | 74 | | |
77 | 75 | | |
78 | 76 | | |
| |||
1347 | 1345 | | |
1348 | 1346 | | |
1349 | 1347 | | |
1350 | | - | |
| 1348 | + | |
1351 | 1349 | | |
1352 | 1350 | | |
1353 | | - | |
1354 | 1351 | | |
1355 | 1352 | | |
1356 | 1353 | | |
| |||
1379 | 1376 | | |
1380 | 1377 | | |
1381 | 1378 | | |
1382 | | - | |
| 1379 | + | |
1383 | 1380 | | |
1384 | 1381 | | |
1385 | | - | |
1386 | 1382 | | |
1387 | 1383 | | |
1388 | 1384 | | |
| |||
1395 | 1391 | | |
1396 | 1392 | | |
1397 | 1393 | | |
1398 | | - | |
| 1394 | + | |
1399 | 1395 | | |
1400 | 1396 | | |
1401 | | - | |
1402 | 1397 | | |
1403 | 1398 | | |
1404 | 1399 | | |
| |||
Lines changed: 3 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
687 | 687 | | |
688 | 688 | | |
689 | 689 | | |
690 | | - | |
| 690 | + | |
691 | 691 | | |
692 | 692 | | |
693 | | - | |
694 | 693 | | |
695 | 694 | | |
696 | 695 | | |
| |||
703 | 702 | | |
704 | 703 | | |
705 | 704 | | |
706 | | - | |
| 705 | + | |
707 | 706 | | |
708 | 707 | | |
709 | | - | |
710 | 708 | | |
711 | 709 | | |
712 | 710 | | |
| |||
719 | 717 | | |
720 | 718 | | |
721 | 719 | | |
722 | | - | |
| 720 | + | |
723 | 721 | | |
724 | 722 | | |
725 | | - | |
726 | 723 | | |
727 | 724 | | |
728 | 725 | | |
| |||
Lines changed: 3 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
161 | 160 | | |
162 | 161 | | |
163 | 162 | | |
| |||
186 | 185 | | |
187 | 186 | | |
188 | 187 | | |
189 | | - | |
| 188 | + | |
190 | 189 | | |
191 | 190 | | |
192 | | - | |
193 | 191 | | |
194 | 192 | | |
195 | 193 | | |
| |||
202 | 200 | | |
203 | 201 | | |
204 | 202 | | |
205 | | - | |
| 203 | + | |
206 | 204 | | |
207 | 205 | | |
208 | | - | |
209 | 206 | | |
210 | 207 | | |
211 | 208 | | |
| |||
Lines changed: 3 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
161 | 160 | | |
162 | 161 | | |
163 | 162 | | |
| |||
186 | 185 | | |
187 | 186 | | |
188 | 187 | | |
189 | | - | |
| 188 | + | |
190 | 189 | | |
191 | 190 | | |
192 | | - | |
193 | 191 | | |
194 | 192 | | |
195 | 193 | | |
| |||
202 | 200 | | |
203 | 201 | | |
204 | 202 | | |
205 | | - | |
| 203 | + | |
206 | 204 | | |
207 | 205 | | |
208 | | - | |
209 | 206 | | |
210 | 207 | | |
211 | 208 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
130 | 147 | | |
131 | 148 | | |
132 | 149 | | |
| |||
0 commit comments