Yang, Tong 3f5759eed2 MRS comp-lts 2.0.38.SP20 version
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Yang, Tong <yangtong2@huawei.com>
Co-committed-by: Yang, Tong <yangtong2@huawei.com>
2023-01-19 17:08:45 +00:00

63 lines
8.5 KiB
HTML

<a name="mrs_01_1153"></a><a name="mrs_01_1153"></a>
<h1 class="topictitle1">Using Macro Definitions in Configuration Items </h1>
<div id="body8662426"><p id="mrs_01_1153__en-us_topic_0000001219029485_a103cc04584e64fa79816ad3ddd8c9c51">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. </p>
<div class="note" id="mrs_01_1153__en-us_topic_0000001219029485_nf3fb6e45022e46b4b63cc6e28ad74459"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="mrs_01_1153__en-us_topic_0000001219029485_ub893fbd3fe05498e9bd4736090781a8a"><li id="mrs_01_1153__en-us_topic_0000001219029485_l16bfea3530fc4318b527e99065ea266e">The macro definitions take effect in the job only. </li><li id="mrs_01_1153__en-us_topic_0000001219029485_lb2442c5925e647aeb431bdfbcccda2a3">Macro definitions can be imported and exported together with an import or export job. If a job uses macro definitions, the exported job includes the macro definitions. Macro definitions are imported by default when a job is imported. </li><li id="mrs_01_1153__en-us_topic_0000001219029485_le9e2dc2087724d2686c8a79e3d089e2e">For details about the <strong id="mrs_01_1153__en-us_topic_0000001219029485_b49593205492018">dateformat </strong>definition of the first parameter in the time macro dataformat, see <span class="filepath" id="mrs_01_1153__en-us_topic_0000001219029485_filepath142154092792018"><b>java.text.SimpleDateFormat.java</b></span>. The restrictions of the target system must be followed. For example, HDFS/OBS directories do not support special characters.</li></ul>
</div></div>
<div class="section" id="mrs_01_1153__en-us_topic_0000001219029485_s3a835b253bc34a609094901e9790902a"><h4 class="sectiontitle">Macro Definitions of Loader </h4><p id="mrs_01_1153__en-us_topic_0000001219029485_a6c6e8eb224b949e69e28a455a93f0eab">At present, Loader supports the following time macro definitions by default: </p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="mrs_01_1153__en-us_topic_0000001219029485_t5eca54d96b0749a0a726b887280d140d" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Common macro definitions of Loader </caption><thead align="left"><tr id="mrs_01_1153__en-us_topic_0000001219029485_r78491dd5cd2942a5847d3594b2db42a1"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.3.3.2.4.1.1"><p id="mrs_01_1153__en-us_topic_0000001219029485_acfdfdc03f2024ae989f7db12d6b3c19b">Name</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.3.3.2.4.1.2"><p id="mrs_01_1153__en-us_topic_0000001219029485_a7385b8d4cb0342caa1e6bfbdce475512">Result After the Replacement </p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.3.3.2.4.1.3"><p id="mrs_01_1153__en-us_topic_0000001219029485_ac97e39489ee64a1f8d0e2e266dba7c74">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="mrs_01_1153__en-us_topic_0000001219029485_r2a68565081e942edb4874b46967374b4"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.3.3.2.4.1.1 "><p id="mrs_01_1153__en-us_topic_0000001219029485_a2a04784e4024477a9991a9f7f0835ddf">@{dateformat("yyyy-MM-dd")}@</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.3.3.2.4.1.2 "><p id="mrs_01_1153__en-us_topic_0000001219029485_a5c61232169b444229e33ffad4dfb7b85">2016-05-17</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.3.3.2.4.1.3 "><p id="mrs_01_1153__en-us_topic_0000001219029485_a3d66f36e9f3c444992f2fd72eefdc4cd">Indicates the current date.</p>
</td>
</tr>
<tr id="mrs_01_1153__en-us_topic_0000001219029485_r02b5832587964d5aa6eee4f6eaf10bcc"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.3.3.2.4.1.1 "><p id="mrs_01_1153__en-us_topic_0000001219029485_a1bfc345fb4014e9bb4b83e85fc26dfb2">@{dateformat("yyyy-MM-dd HH:mm:ss")}@</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.3.3.2.4.1.2 "><p id="mrs_01_1153__en-us_topic_0000001219029485_ad7db26a60c344001825e26db3764dae0">2016-05-17 16:50:00</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.3.3.2.4.1.3 "><p id="mrs_01_1153__en-us_topic_0000001219029485_aeaf3945939e047b698a8262aa7b5b9c6">Indicates current date and time</p>
</td>
</tr>
<tr id="mrs_01_1153__en-us_topic_0000001219029485_r3d6edbb492274feb861ca2a860602d4a"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.3.3.2.4.1.1 "><p id="mrs_01_1153__en-us_topic_0000001219029485_ace8cb04d95384342aa5378913a2713b8">@{timestamp()}@</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.3.3.2.4.1.2 "><p id="mrs_01_1153__en-us_topic_0000001219029485_a5cad7ceba1a64dcea71cb91eebd5cb18">1463476137557</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.3.3.2.4.1.3 "><p id="mrs_01_1153__en-us_topic_0000001219029485_acb938c02ebae44d3aa4d980135494bdd">Indicates milliseconds since 1970. </p>
</td>
</tr>
<tr id="mrs_01_1153__en-us_topic_0000001219029485_r85d0b71b7b464151bef6ffa36b041b99"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.3.3.2.4.1.1 "><p id="mrs_01_1153__en-us_topic_0000001219029485_a6ccfc808d0414e3bbc26fa3aa25ef8e2">@{dateformat("yyyy-MM-dd HH:mm:ss",-7,DAYS)}@</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.3.3.2.4.1.2 "><p id="mrs_01_1153__en-us_topic_0000001219029485_a882eb02c0ec14fc3aa82402e913cb71b">2016-05-10 16:50:00</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.3.3.2.4.1.3 "><p id="mrs_01_1153__en-us_topic_0000001219029485_a99b39de6a2f343488462f705da5a5d59">Indicates the latest seven days (the present time minus seven days). </p>
<p id="mrs_01_1153__en-us_topic_0000001219029485_a9c506c57482c40cb9697fd4a1dde3e8f">The second parameter supports addition and subtraction. </p>
<p id="mrs_01_1153__en-us_topic_0000001219029485_aaf970a3f1462460db9426160d0ca6bf0">The third parameter is a time unit for calculation. According to definitions in the <span class="filepath" id="mrs_01_1153__en-us_topic_0000001219029485_faab52881d807419d808433bb7d159a7e"><b>java.util.concurrent.TimeUnit.java</b></span>, time units include DAYS, HOURS, MINUTES, and SECONDS. </p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="mrs_01_1153__en-us_topic_0000001219029485_a11b2c6c2f0c4442bb15537fc7347f2aa">In the following scenarios, parameters can be configured by using macro definitions. </p>
<ul id="mrs_01_1153__en-us_topic_0000001219029485_u7b1feac26f0f4586ad47167299af64e1"><li id="mrs_01_1153__en-us_topic_0000001219029485_ld2222bf036134734ae65d142ccdf8b73">Specifying a data directory that is named by the current date <p id="mrs_01_1153__en-us_topic_0000001219029485_a057bfdf372d541bbbdb5361b80e2b74b"><a name="mrs_01_1153__en-us_topic_0000001219029485_ld2222bf036134734ae65d142ccdf8b73"></a><a name="en-us_topic_0000001219029485_ld2222bf036134734ae65d142ccdf8b73"></a>The parameter is set to <span class="parmvalue" id="mrs_01_1153__en-us_topic_0000001219029485_p113a95dbe2d34002833c75a2bcce2501"><b>/user/data/inputdate_@{dateformat("yyyy-MM-dd")} @</b></span>. </p>
</li><li id="mrs_01_1153__en-us_topic_0000001219029485_l72de8aad135843bc9090026f8ddaf432">Querying data in the latest seven days by using SQL <pre class="screen" id="mrs_01_1153__en-us_topic_0000001219029485_s810d2bb9c2584014a64948b7025b327b">select * from table where time between '@{dateformat("yyyy-MM-dd HH:mm:ss",-7,DAYS)}@' and '@{dateformat("yyyy-MM-dd HH:mm:ss")}@'</pre>
</li><li id="mrs_01_1153__en-us_topic_0000001219029485_la58b440aa492491182159d4b76ce73ec">Specifying a table that is named by the current date <p id="mrs_01_1153__en-us_topic_0000001219029485_a58d790260c5f48db9dac9a87d2bb5e02"><a name="mrs_01_1153__en-us_topic_0000001219029485_la58b440aa492491182159d4b76ce73ec"></a><a name="en-us_topic_0000001219029485_la58b440aa492491182159d4b76ce73ec"></a>The parameter is set to <span class="parmvalue" id="mrs_01_1153__en-us_topic_0000001219029485_p77c2af2a34c24edd9df8ca4ecb7cd6e1"><b>table_@{dateformat("yyyy-MM-dd")} @parmvalue</b></span>. </p>
</li></ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_1119.html">Operator Help</a></div>
</div>
</div>