Rule Type | Label | Description |
System Template | system_template | Use the system built-in detection template and only specify template_code. The system template has built-in quality dimensions, so users do not need to specify dimension. |
Custom SQL | custom_sql | Users write custom SQL query statements to flexibly implement various detection logic. Users need to specify dimension (quality dimension) and custom_sql (SQL statement). |
Rule Level | Configuration Node | Description |
Table-level rule | table_rules | Detect the entire table, such as row quantity check and data output timeliness check. |
Field-level rule | field_rules | Detect a specific field in the table, such as null rate, duplicate values, and average values. You need to additionally specify field_name. |
Dimension Identifier | Chinese Name | Description |
completeness | Completeness | Detect whether data has missing values. |
accuracy | Accuracy | Detect whether data values are within a reasonable range. |
validity | Validity | Detect whether data formats and types are compliant. |
uniqueness | Unique | Detect whether data has duplicate values. |
consistency | Consistency | Detect whether data is consistent across different data sources or tables. |
timeliness | Timeliness | Detect whether data is produced on time. |
Template Identifier | Term | Description | trigger_condition |
table_row_count | Number of Rows | Check Whether the Total Number of Rows in the Table Is Within a Reasonable Range. | User-customized |
data_timeliness | Data Timeliness | Detect whether data is produced on time. | Fixed by the system and no manual input is required. Configure business filter conditions through filter. |
Template Identifier | Term | Description | trigger_condition |
null_count | Field Null Quantity | Count the number of null values in a field. | User-customized |
null_rate | Field Null Rate | Calculate the proportion of null values in a field. | User-customized |
not_null_count | Field Non-null Count | Count the number of non-null values in a field. | User-customized |
duplicate_count | Field Duplicate Quantity | Count the number of duplicate values in a field. | User-customized |
distinct_count | Field Distinct Count | Count the number of distinct values in a field. | User-customized |
min_value | Field Minimum Value | Obtain the minimum value of a field. | User-customized |
max_value | Field Maximum Value | Obtain the maximum value of a field. | User-customized |
sum_value | Field Sum | Calculate the sum of a field. | User-customized |
avg_value | Field Average Value | Calculate the average value of a field. | User-customized |
median_value | Field Median | Calculate the median of a field. | User-customized |
std_dev | Field Standard Deviation | Calculate the standard deviation of a field. | User-customized |
enum_range_consistency | Enumeration Range Consistency | Check whether the field value is within the valid enumeration range. | Fixed by the system and does not need to be filled in. Configure the list of valid enumeration values through params.enum_values. |
Operator | Description |
== | Equal to |
!= | Not equal to |
> | Greater than |
< | Less than |
= | Greater than or equal to |
<= | Less than or equal to |
trigger_condition: "> 100" # Triggered when the detected value is greater than 100.trigger_condition: "<= 0" # Triggered when the detected value is less than or equal to 0.trigger_condition: "== 24" # Triggered when the detected value equals 24.trigger_condition: "!= 0" # Triggered when the detected value is not equal to 0.trigger_condition: "> 0" # Triggered when the detected value is greater than 0.
Bracket | Description |
[ or ] | Includes boundary values (closed interval) |
( or ) | Excludes boundary values (open interval) |
Expression | Description | Trigger Timing |
between [0,150] | The value falls within the range of 0 to 150. | Triggered When Value Is Within the Range. |
between (0,100) | The value falls within the range of 0 to 100. | Triggered When Value Is Within the Range (Boundaries Excluded). |
between [0,100) | The value falls within the range of 0 to 100. | Triggered When Value Is Within the Range (Left Boundary Included, Right Boundary Excluded). |
between (0,100] | The value falls within the range of 0 to 100. | Triggered When Value Is Within the Range (Left Boundary Excluded, Right Boundary Included). |
not_between [0,100] | The value is not within the range of 0 to 100. | Triggered When Value Is Outside the Range. |
not_between (0,100) | The value is not within the range of 0 to 100. | Triggered When Value Is Outside the Range. |
trigger_condition: "not_between [1000,1000000]"# Triggered when the table row count is outside this range.trigger_condition: "not_between [10, 10000]"# Triggered when the field average is outside this range.trigger_condition: "not_between [1, 50]"# Triggered when the distinct count is outside this range.
Connector | Description |
AND | Triggers when all conditions are met simultaneously. |
OR | Triggers when any condition is met. |
trigger_condition: "< 100 OR > 1000000" # Triggered when the row count is too low or too high.trigger_condition: "> 100 AND < 200" # Triggered when the value is greater than 100 and less than 200.
trigger_condition: "check_value > 0"# The column name returned by SQL is check_value.trigger_condition: "null_count == 0"# The column name returned by SQL is null_count.trigger_condition: "check_value > 0 AND total_count >= 100"# Multi-Column Combined Evaluationtrigger_condition: "check_value not_between [0, 100]"# Ranges are also supported.
Template or Type | trigger_condition Configuration Method | Additional Notes |
Standard system templates (such as table_row_count, null_rate, and avg_value) | User-customized. Supports simple comparison, range, and combined conditions. | None |
data_timeliness template | No manual input is required. The trigger condition is fixed by the system. | Configure business filter logic through the filter field. |
enum_range_consistency template | No manual input is required. The trigger condition is fixed by the system. | Configure the list of valid enumeration values through params.enum_values. |
Custom SQL | User-customized. Supports all expression formats with field name prefixes. | Field names in trigger_condition must be consistent with the column names returned by SQL. |
Field | Type | Required | Description |
rule_name | string | Yes | Rule name. A descriptive name is recommended. |
rule_type | string | Yes | Rule type: system_template or custom_sql |
trigger_condition | string | Depends on the template | Trigger condition expression (fixed by the system for some templates and does not need to be entered) |
filter | string | No | Optional. Adds a WHERE filter condition. |
Field | Type | Required | Description |
template_code | string | Yes | System template identifier, queried through the DescribeRuleTemplates API |
params | object | No | Additional parameters required by some templates |
Field | Type | Required | Description |
custom_sql | string | Yes | Custom SQL query statement |
dimension | string | Yes | Quality dimension: completeness, accuracy, validity, uniqueness, consistency, timeliness |
Field | Type | Required | Description |
field_name | string | Yes | Name of the Target Detection Field |
table_rules:- rule_name: Table row count range checkrule_type: system_templatetemplate_code: table_row_counttrigger_condition: not_between [1000,1000000]filter: status != DELETED
table_rules:- rule_name: Table row count anomaly checkrule_type: system_templatetemplate_code: table_row_counttrigger_condition: < 100 OR > 1000000
table_rules:- rule_name: Data output timeliness checkrule_type: system_templatetemplate_code: data_timelinessfilter: update_time >= DATE_SUB(NOW(), INTERVAL 2 HOUR)
table_rules:- rule_name: Order amount consistency checkrule_type: custom_sqldimension: consistencycustom_sql: >SELECT ABS((SELECT SUM(order_amount) FROM order_table WHERE dt = 20260101)- (SELECT SUM(detail_amount) FROM order_detail_table WHERE dt = 20260101)) as check_value FROM dualtrigger_condition: check_value != 0
field_rules:- field_name: user_idrule_name: User ID null rate checkrule_type: system_templatetemplate_code: null_ratetrigger_condition: "> 0"
field_rules:- field_name: order_idrule_name: Order ID duplicate value checkrule_type: system_templatetemplate_code: duplicate_counttrigger_condition: "> 0"
field_rules:- field_name: order_amountrule_name: Order amount average value checkrule_type: system_templatetemplate_code: avg_valuetrigger_condition: not_between [10, 10000]
field_rules:- field_name: phone_numberrule_name: Phone number format validationrule_type: custom_sqldimension: validitycustom_sql:SELECT COUNT(*) as check_valueFROM user_info_table WHERE dt = 20260101AND phone_number IS NOT NULLAND phone_number NOT REGEXP 1[3-9][0-9]{9}trigger_condition: check_value > 0
field_rules:- field_name: genderrule_name: Gender enum value range consistency checkrule_type: system_templatetemplate_code: enum_range_consistencyparams:enum_values: M,F,Unknown
Scenario | Recommended Type |
Standard field statistics check (null rate, duplicate values, mean, and so on) | system_template |
Cross-table Data Consistency Check | custom_sql |
Complex Business Logic Validation (Format, Range, and Association Checks) | custom_sql |
Simple Table Row Quantity or Timeliness Check | system_template |
フィードバック