See https://issues.apache.org/jira/browse/SPARK-26885 and
https://github.com/apache/spark/blob/71170e74df5c7ec657f61154212d1dc2ba7d0613/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
stringToTimestamp, stringToDate support yyyy, as a result:
select year("1912") => 1912
select month("1912") => 1
select hour("1912") => 0
In Presto or Hive,
select year("1912") => null
select month("1912") => null
select hour("1912") => null
It is not a good idea to support yyyy for a Date/DateTime. As well as yyyy-[d]d.
What's your opinion?