How to get today -“1 day” date in sparksql?

后端 未结 4 576
北荒
北荒 2020-12-30 02:40

How to get current_date - 1 day in sparksql, same as cur_date()-1 in mysql.

4条回答
  •  长发绾君心
    2020-12-30 02:59

    Yes, the date_sub() function is the right for the question, anyway, there's an error in the selected answer:

    Return type: timestamp

    The return type should be date instead, date_sub() function will trim any hh:mm:ss part of the timestamp, and returns only a date.

提交回复
热议问题