Custom parameters are classified into built-in parameters, ${...} parameters, $[...] parameters, and constants. The values of custom parameters of each type are in specific formats. This topic compares the value formats of different types of custom parameters.

How different custom parameters are used

For example, the current date is November 1, 2021, and a node is scheduled to run at 00:00 every day. The following table describes how different customer parameters are assigned values.
Note In this example, the parameters are referenced in the pt=${datetime} format in the code.
Parameter Description Assignment Replacement result
${yyyymmdd} Obtains the data timestamp of the node. datetime=${yyyymmdd} datetime=20211031
$[yyyymmddhh24miss] Obtains the time when the node is scheduled to run, which is accurate to seconds. datetime=$[yyyymmddhh24miss] datetime=20211101000000
$bizdate Obtains the data timestamp of the node. datetime=$bizdate datetime=20211031
$cyctime Obtains the time when the node is scheduled to run, which is accurate to seconds. datetime=$cyctime datetime=20211101000000
$gmtdate Obtains the current date, which is accurate to days. datetime=$gmtdate datetime=20211101
$bizmonth Obtains the month indicated by the data timestamp of the node. datetime=$bizmonth
  • If the month indicated by the data timestamp is the current month, the value of the $bizmonth parameter is the previous month.
  • If the month indicated by the data timestamp is not the current month, the value of the $bizmonth parameter is the month indicated by the data timestamp.
In this example, the current date is November 1, 2021.
  • If the date indicated by the data timestamp is November 2, 2021, which is in the current month, the value of datetime is 202110.
  • If the date indicated by the data timestamp is October 31, 2021, which is not in the current month, the value of datetime is 202110.

Differences between ${...} and $[...] parameters

The following table describes the differences between the ${...} and $[...] parameters.
Item ${...} parameter $[...] parameter
Benchmark The value of the $bizdate parameter is used as a benchmark to run nodes.

The $bizdate parameter indicates the data timestamp. By default, the date indicated by the data timestamp is one day earlier than the current date.

The value of the $cyctime parameter is used as a benchmark to run nodes.

The $cyctime parameter indicates the time when a node is scheduled to run. For example, the value yyyy-mm-dd 00:30:00 indicates 00:30 on the current day.

Data backfill The parameter is replaced with the selected data timestamp. During data backfill, the parameter is replaced with the date that is one day after the date indicated by the selected data timestamp.

For example, 20220315 is the date indicated by the selected data timestamp for data backfill. In this case, the date indicated by the value of the $cyctime parameter is 20220316.

Time granularity The value is accurate to days.

If you want to specify a time that is N years or months ago, we recommend that you use a ${...} parameter.

The value is accurate to seconds.

If you want to specify a time that is N hours or minutes ago, we recommend that you use a $[...] parameter. For example, $[yyyymmdd-1-1/24] indicates the time that is one hour before the scheduling time of a node on the previous day.

Note ${yyyy-mm-dd-1/24} is not supported. We recommend that you use $[yyyy-mm-dd-1-1/24].
In this example, an ODPS SQL node is used, and the current time is 10:30:00 on July 20, 2021. The following table describes how to use ${...} and $[...] parameters.
Time to obtain ${...} parameter $[...] parameter
Year: 2021
  • Assignment: datetime=${yyyy}
  • Reference in code: pt=${datetime}
  • Replacement result: pt=${yyyy}=2021
  • Assignment: datetime=$[yyyy]
  • Reference in code: pt=${datetime}
  • Replacement result: pt=$[yyyy]=2021
Year: 21
  • Assignment: datetime=${yy}
  • Reference in code: pt=${datetime}
  • Replacement result: pt=${yy}=21
  • Assignment: datetime=$[yy]
  • Reference in code: pt=${datetime}
  • Replacement result: pt=$[yy]=21
Year: 2020
  • Assignment: datetime=${yyyy-1}
  • Reference in code: pt=${datetime}
  • Replacement result: pt=${yyyy-1}=2020
Not supported
Month: 07
  • Assignment: datetime=${mm}
  • Reference in code: pt=${datetime}
  • Replacement result: pt=${mm}=07
  • Assignment: datetime=$[mm]
  • Reference in code: pt=${datetime}
  • Replacement result: pt=$[mm]=07
Day: 20
  • Assignment: datetime=${dd}
  • Reference in code: pt=${datetime}
  • Replacement result: pt=${dd}=20
  • Assignment: datetime=$[dd]
  • Reference in code: pt=${datetime}
  • Replacement result: pt=$[dd]=20
Date: 2021-06-20
  • Assignment: datetime=${yyyy-mm-dd-29}
  • Reference in code: pt=${datetime}
  • Replacement result: pt=${yyyy-mm-dd-29}=2021-06-20
  • Assignment: datetime=$[add_months(yyyymmdd,-1)]
  • Reference in code: pt=${datetime}
  • Replacement result: pt=$[add_months(yyyymmdd,-1)]=2021-06-20
Date: 2021-07-19
  • Assignment: datetime=${yyyy-mm-dd}
  • Reference in code: pt=${datetime}
  • Replacement result: pt=${yyyy-mm-dd}=2021-07-19
  • Assignment: datetime=$[yyyy-mm-dd-1]
  • Reference in code: pt=${datetime}
  • Replacement result: pt=$[yyyy-mm-dd-1]=2021-07-19
Date: 2020-07-20
  • Assignment: datetime=${yyyy-mm-dd-364}
  • Reference in code: pt=${datetime}
  • Replacement result: pt=${yyyy-mm-dd-364}=2020-07-20
  • Assignment: datetime=$[add_months(yyyymmdd,-12*1)]
  • Reference in code: pt=${datetime}
  • Replacement result: pt=$[add_months(yyyymmdd,-12*1)]=2020-07-20
Time: 10:30:00 Not supported
  • Assignment: datetime=$[hh24:mi:ss]
  • Reference in code: pt=${datetime}
  • Replacement result: pt=$[hh24:mi:ss]=10:30:00
Time: 2021-07-20 10:30:00 Not supported
  • Assignment: datetime1=$[yyyy-mm-dd] datetime2=$[hh24:mi:ss]
    Note You must customize two variables datetime1 and datetime2, and separate the key-value pairs of the variables with a space.
  • Reference in code: pt=${datetime1} ${datetime2}
  • Replacement result:
    • datetime1=$[yyyy-mm-dd]=2021-07-20
    • datetime2=$[hh24:mi:ss]=10:30:00
    • pt=2021-07-20 10:30:00
Time: 2021-07-20 10:29:00 Not supported
  • Assignment: datetime1=$[yyyy-mm-dd] datetime2=$[hh24:mi:ss-1/24/60]
    Note You must customize two variables datetime1 and datetime2, and separate the key-value pairs of the variables with a space.
  • Reference in code: pt=${datetime1} ${datetime2}
  • Replacement result:
    • datetime1=$[yyyy-mm-dd]=2021-07-20
    • datetime2=$[hh24:mi:ss-1/24/60]=10:29:00
    • pt=2021-07-20 10:29:00
Time: 2021-07-20 09:30:00 Not supported
  • Assignment: datetime1=$[yyyy-mm-dd] datetime2=$[hh24:mi:ss-1/24]
    Note You must customize two variables datetime1 and datetime2, and separate the key-value pairs of the variables with a space.
  • Reference in code: pt=${datetime1} ${datetime2}
  • Replacement result:
    • datetime1=$[yyyy-mm-dd]=2021-07-20
    • datetime2=$[hh24:mi:ss-1/24]=09:30:00
    • pt=2021-07-20 09:30:00
Time:

2021071910:30:00

Not supported
  • Assignment: datetime=$[yyyymmddhh24miss-1]
  • Reference in code: pt=${datetime}
  • Replacement result:
    • datetime=$[yyyymmddhh24miss-1]=2021071910:30:00
    • pt=2021071910:30:00
Time:

20210719 10:30:00

Not supported
Important Spaces are not supported in one assignment expression. You can use two scheduling parameters and separate the assignment expressions of the two parameters with a space.
  • Assignment: datetime1=$[yyyymmdd-1] datetime2=$[hh24:mi:ss]
    Note You must customize two variables datetime1 and datetime2, and separate the key-value pairs of the variables with a space.
  • Reference in code: pt=${datetime1} ${datetime2}
  • Replacement result:
    • datetime1=$[yyyymmdd-1]=2021-07-19
    • datetime2=$[hh24:mi:ss]=10:30:00
    • pt=20210719 10:30:00