Linkis built-in time variable introduction
- Other date built-in variables are calculated relative to run_date
- Support Pattern format time and users can specify at will
- Support ±y/±M/±d/±H etc.
Pattern format comparison table:
- The variable types supported by Linkis are divided into custom variables (not to be repeated) and system built-in variables. The custom variable date supports +-.
- Among them, +- is to perform operation on the built-in parameter run_date of linkis, and then replace the pattern field before %. Non-pattern characters do not support operation replacement.
You can define parameters that need to be dynamically rendered according to your own preferences/business actual situation
variable | result |
---|---|
&{yyyy-01-01} | 2021-01-01 |
&{yyyy-01-01%-2y} | 2019-01-01 |
&{yyyy-MM-01%-2M} | 2021-02-01 |
&{yyyy-MM-dd%-2d} | 2021-03-31 |
&{yyyy MM ——- HH%-1H} | 2021 04 ——- 14 |
&{yyyyMMdd%-1d} | 20210401 |
&{yyyyMM01%-1M} | 20210301 |
&{HH%-1H} | 14 |
- Example 1: sql
WHERE dt <= DATE_FORMAT(DATE_ADD('day', -1, DATE(Date_parse('20220705', '%Y%m%d'))), '%Y%m%d')
- Example 2: shell
after rendering
aws s3 ls s3://***/ads/tmp/dws_member_active_detail_d_20210601_20211231/pt=20220705/
- Example 3: datax json
{
"setting": {
"speed": {
"channel": 1
}
},
"content": [
{
"reader": {
"name": "s3reader",
"parameter": {
"path": [
"ads/tmp/ccass_tm_announcements/20220705/"
],
"stored": "parquet",
"compression": "NONE",
"column": [
{
"index": 0,
},
{
"index": 1,
"type": "string",
"constant": "20220705"
]
}
},
"writer": {
"name": "streamwriter",
"parameter": {
"print": true
}
}
}
]
}
}
after rendering
20220705