We normally do not follow MySQL. Check the commercial database [like Oracle]? or the open source PostgreSQL?
Sean Owen <sro...@gmail.com> 于2019年2月15日周五 上午5:34写道: > year("1912") == 1912 makes sense; month("1912") == 1 is odd but not > wrong. On the one hand, some answer might be better than none. But > then, we are trying to match Hive semantics where the SQL standard is > silent. Is this actually defined behavior in a SQL standard, or, what > does MySQL do? > > On Fri, Feb 15, 2019 at 2:07 AM Darcy Shen <sad...@zoho.com.invalid> > wrote: > > > > 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? > > > > > > --------------------------------------------------------------------- > To unsubscribe e-mail: dev-unsubscr...@spark.apache.org > >