Help Center/ MapReduce Service/ Component Operation Guide (LTS) (Ankara Region)/ Using Spark/ Spark FAQ/ How Do I Use Special Characters with TIMESTAMP and DATE?
Updated on 2024-11-29 GMT+08:00

How Do I Use Special Characters with TIMESTAMP and DATE?

Symptom

In open-source Spark 3.2.0 and later versions, TIMESTAMP(*) or DATE(*) is not supported. The asterisk (*) can be any of the following characters:

  • epoch
  • today
  • yesterday
  • tomorrow
  • now

By default, only the timestamp '*' or data '*' format is supported for new Spark versions. If you use the syntax of early versions to insert data into a data table, you will get the NULL value.

Solution

Set set spark.sql.convert.special.datetime=true; to use the syntax of early versions.