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 describes the differences between 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.
In this example, the parameters are referenced in the pt=${datetime}
format in the code.
Parameter | Description | Assignment | Replacement result |
| Obtains the data timestamp of the node. |
|
|
| Obtains the time when the node is scheduled to run, which is accurate to seconds. |
|
|
| Obtains the data timestamp of the node. |
|
|
| Obtains the time when the node is scheduled to run, which is accurate to seconds. |
|
|
| Obtains the current date, which is accurate to days. |
|
|
| Obtains the month specified by the data timestamp of the node. |
|
In this example, the current date is |
Differences between ${...} and $[...] parameters
The following table describes the differences between the ${...} and $[...] parameters.
Item | ${…} parameter | $[…] parameter |
Benchmark | The value of the The | The value of the The |
Data backfill | The parameter is replaced with the selected data timestamp. | During data backfilling, the parameter is replaced with the date that is For example, |
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, Note
|
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 |
|
|
Year: 21 |
|
|
Year: 2020 |
| Not supported |
Month: 07 |
|
|
Day: 20 |
|
|
Date: 2021-06-20 |
|
|
Date: 2021-07-19 |
|
|
Date: 2020-07-20 |
|
|
Time: 10:30:00 | Not supported |
|
Time: 2021-07-20 10:30:00 | Not supported |
|
Time: 2021-07-20 10:29:00 | Not supported |
|
Time: 2021-07-20 09:30:00 | Not supported |
|
Time: 2021071910:30:00 | Not supported |
|
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.
|