When creating or editing Loader jobs, users can use macro definitions during parameter configuration. Then the parameters can be automatically changed to corresponding macro values when a job is implemented.
At present, Loader supports the following time macro definitions by default:
Name |
Result After the Replacement |
Description |
---|---|---|
@{dateformat("yyyy-MM-dd")}@ |
2016-05-17 |
Indicates the current date. |
@{dateformat("yyyy-MM-dd HH:mm:ss")}@ |
2016-05-17 16:50:00 |
Indicates current date and time |
@{timestamp()}@ |
1463476137557 |
Indicates milliseconds since 1970. |
@{dateformat("yyyy-MM-dd HH:mm:ss",-7,DAYS)}@ |
2016-05-10 16:50:00 |
Indicates the latest seven days (the present time minus seven days). The second parameter supports addition and subtraction. The third parameter is a time unit for calculation. According to definitions in the java.util.concurrent.TimeUnit.java, time units include DAYS, HOURS, MINUTES, and SECONDS. |
In the following scenarios, parameters can be configured by using macro definitions.
The parameter is set to /user/data/inputdate_@{dateformat("yyyy-MM-dd")} @.
select * from table where time between '@{dateformat("yyyy-MM-dd HH:mm:ss",-7,DAYS)}@' and '@{dateformat("yyyy-MM-dd HH:mm:ss")}@'
The parameter is set to table_@{dateformat("yyyy-MM-dd")} @parmvalue.