Adding a Batch Variable
Scenario
Batch variables are calculated by your offline analysis platform, and the platform data is generally stored in Hadoop. You can specify a batch variable table for dimension mapping, where a dimension corresponds to a batch variable table.
A dimension can have multiple batch variables.
Procedure
- Create the batch variable table.
- Log in to the RTDservice web UI as a service user and select a tenant.
- Choose Business Management > Database Tools > Database Operator.
- Set Operation to DDL and run the following statement to create the batch variable table T_RTD_BATCH_VARS_PARENT_1:
CREATE TABLE T_RTD_BATCH_VARS_PARENT_1 ( CUR_VER_FLAG tinyint DEFAULT '0' NOT NULL, KEY varchar(20 BYTES) NOT NULL, VALUE varchar(1048576 BYTES) NOT NULL, CONSTRAINT PK_T_RTD_BATCH_VARS_PARENT_1 PRIMARY KEY (KEY));
The structure of the batch variable table is as follows:
Figure 1 Table structure
Table 1 Fields in the batch variable table Field
Description
CUR_VER_FLAG
Data flag, indicating whether the data is available. The value 0 indicates that the data is available, and the value 1 indicates that the data is unavailable.
KEY
Dimension primary key.
VALUE
The value contains key-value pairs in JSON format.
NOTE:- key indicates a batch variable name and must be in lowercase.
- value indicates the value of a batch variable.
- Multiple key-value pairs can be configured.
- The system processes batch variables on the offline Hadoop platform, which decouples online data processing from offline data analysis and computing. This ensures real-time data processing and provides platform support for high-performance batch computing.
- Batch variables are not supported in filtering rules.
- Set Operation to DML and run the following statement to insert data:
For example, if a record whose batch variable name is bv_wq is inserted into the batch variable table T_RTD_BATCH_VARS_PARENT_1, the value of the batch variable is 2000 when 3 is entered.
insert into T_RTD_BATCH_VARS_PARENT_1(key ,value) values('3','{"bv_wq":"2000"}');
- Log in to the RTDservice web UI as a service user and select a tenant.
- Choose Business Management > Variable and Rule Configuration > Batch Variables.
- On the displayed page, click Add. Select a dimension from Dimension Name, and set the Name, Type, Default Value, and Description of the batch variable.
- When adding a batch variable, ensure that the batch variable name is the same as the internal keys contained in VALUE in the batch variable table created in 1. Otherwise, the batch variable calculation on the platform fails and an error message is generated.
- The prefix of the batch variable name must be bv_.
- The variable name is case insensitive and must start with a letter or underscore (_). A name can contain a maximum of 30 characters, including [A-Z], [a-z], [0-9] and _.
Figure 2 Creating a batch variable
- Click OK. The batch variable is created.
- (Optional) On the Batch Variables page, if the variable is Ready, select the variable and choose More > Online or Offline to bring the batch variable online or take it offline.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot