1. [SPARK-37067][SQL] Use ZoneId.of() to handle timezone string in (details)
Commit c3f6132167a31dfd858887017bd41eda15a17ce8 by wenchen
[SPARK-37067][SQL] Use ZoneId.of() to handle timezone string in DatetimeUtils

### What changes were proposed in this pull request?
Use `ZoneId.of()` to handle timezone string in `DatetimeUtils.stringToTimestamp()`
instead of manually splitting it into hours and minutes.

### Why are the changes needed?
In current implementation. we will split the timezone string into hours and minutes.
But if there is no colon in the timezone, the full digits will be treated as hours, then
we couldn't get the correct value.
For example:
`2021-10-11T03:58:03.000+0700` will return null, but "+0700" is actually correct
format that accepted by `ZoneId.of()`

### Does this PR introduce _any_ user-facing change?
bugfix. this allows Spark to accept a more valid timezone format.

### How was this patch tested?
newly added UT

Closes #34338 from linhongliu-db/SPARK-37067.

Authored-by: Linhong Liu <>
Signed-off-by: Wenchen Fan <>
The file was modifiedsql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVSuite.scala (diff)
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala (diff)
The file was modifiedsql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/DateTimeUtilsSuite.scala (diff)
The file was modifiedsql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json/JsonSuite.scala (diff)