Global table quality rule

Updated at:

Dataphin lets you create quality rules to validate data tables, making quality monitoring simpler. This topic explains how to configure quality rules for global data tables.

Prerequisites

You must add a monitored object before you can configure quality rules. For instructions, see Add a monitored object or .

Permissions

  • Super administrators, quality administrators, and users with a custom global role granting the quality rule-management permission can configure scheduling, alerts, exception archive tables, scoring weights, and runtime configurations for quality rules.

  • Quality owners can configure scheduling, alerts, exception archive tables, scoring weights, and runtime configurations for quality rules on the monitored objects they own.

  • Quality owners and standard users also require synchronous read permissions on the data source that contains the global data table. To apply for these permissions, see Apply for data source permissions.

  • The supported operation permissions vary by object. For more information, see Quality rule operation permissions.

Validation rule

When a quality rule validates a table, if a weak rule is triggered, the system sends an alert so you can promptly find and resolve the anomaly. If a strong rule is triggered, the system sends an alert and automatically stops the job to prevent dirty data from flowing downstream.

Dry run and run

A dry run and a run differ in their execution method and result handling. A dry run is a simulated execution to verify a quality rule's logic; its results are not included in the quality report. In contrast, a run is an actual execution that checks a quality rule at a specified time and outputs its results to the quality report.

Quality rule configuration

  1. On the Dataphin home page, in the top navigation bar, choose Governance > Data Quality.

  2. In the left-side navigation pane, click Quality Rules. On the Global Data Table page, click the name of the target object to open the Quality Rule Details page.

  3. On the Quality Rule Details page, click New Quality Rule.

  4. In the New Quality Rule dialog box, configure the parameters.

    Parameter

    Description

    Basic information

    Rule name

    Enter a custom name for the quality rule. The name can contain up to 256 characters.

    Rule strength

    The options are weak rule and strong rule.

    • Weak rule: If you select weak rule, an alert is triggered when the validation result is anomalous, but downstream tasks are not blocked.

    • Strong rule: If you select strong rule, an alert is triggered when the validation result is anomalous. If downstream tasks exist (for example, in code check scheduling or task-triggered scheduling), the tasks are blocked to prevent the propagation of dirty data. If no downstream tasks exist (for example, in periodic quality scheduling), only an alert is triggered.

    Description

    Enter a custom description for the quality rule. The description can contain up to 128 characters.

    Configuration method

    • Create from template: Quickly create a quality rule by using a generic system template or a custom business template.

      • System template: The built-in parameters are configurable. This option is suitable for creating general-purpose rules.

      • Custom template: The parameters are preset and require no configuration. This option is for creating rules that contain business logic.

    • Custom SQL: Use SQL to define custom quality monitoring rules. This option is suitable for flexible and complex scenarios.

    Rule template

    From the drop-down list, select a rule template. Options are integrity, uniqueness, timeliness, validity, consistency, stability, and custom SQL.

    • Integrity: Includes checks for field null values and field empty strings.

    • Uniqueness: Includes checks for field uniqueness, field group count, and field duplicate value count.

    • Timeliness: Includes comparisons of time functions, time fields in a single table, and time fields between two tables.

    • Validity: Includes checks for field format, field length, and field value range, as well as code table reference comparisons and data standard code table reference comparisons. The data standard comparison requires the Data Standards module.

    • Consistency: Includes comparisons of field values in a single table, field aggregate values in a single table, business logic for a single field, field values between two tables, field aggregate values and business logic between two tables, and field aggregate values between two cross-source tables.

    • Stability: Includes checks for table stability, table fluctuation, field stability, and field fluctuation.

    • Custom SQL: Includes checks for custom aggregate metrics and custom data details.

    For more information, see Template Type Description.

    Rule type

    The rule type is determined by the template and is used for description and filtering.

    Monitoring granularity

    You can configure this parameter when the configuration method is custom SQL. You can monitor the full table or a specific field.

    Template configuration

    Template information

    When you select a quality rule template, its configuration information appears. To modify the configuration, see Quality Rule Templates.

    Rule configuration

    Rule configuration

    The rule configuration depends on the selected rule template. For more information, see Data Table Parameter Configuration.

    • Validation table data filtering: This option is disabled by default. If you enable it, you can configure filter conditions, partition filtering, or standard data filtering for the validation table. The filter conditions are appended directly to the validation SQL. If the validation table requires partition filtering, we recommend that you configure a partition expression in the scheduling configuration. After configuration, the quality report uses the validation partition as the minimum viewing granularity.

    • When the rule template is Consistency/Two-table field aggregate value comparison or Consistency/Cross-source two-table field aggregate value comparison, you can enable Comparison table data filtering to configure filter conditions, partition filtering, or standard data filtering for the comparison table. The filter conditions are appended directly to the validation SQL.

    Grouped statistics configuration

    Grouped statistics

    This option is available for custom data detail validation rules when grouped statistics are enabled in the validation result configuration. This option groups and counts the validation results of the current rule. If an applicable rule includes the current rule, this switch is enabled and locked by default but can be changed in the validation result configuration. Otherwise, you can enable it manually.

    Grouped statistics SQL

    This option is available after you enable grouped statistics. Write SQL to count the total and anomalous rows for each group, grouped by a specified field. You can click Generate SQL Draft to create a draft based on the total row count SQL and anomalous row count SQL that you entered. Review the statistical logic and then save.

    Note
    • The query scope of the grouped statistics SQL must match the data range of the total row count SQL. The anomaly conditions must match those of the anomalous row count SQL.

    • A draft can be generated only when either the total row count SQL or the anomalous row count SQL is entered.

    Validation configuration

    Rule validation

    • After validating a data quality rule, the system compares the result with the anomaly check configuration. If the result is anomalous, the validation fails and triggers subsequent actions such as alerts.

    • The available metrics for anomaly checks depend on the template and your configuration. Multiple AND/OR conditions are supported, but we recommend using fewer than three conditions in most cases.

    For more information, see Validation Configuration Description.

    Archive configuration

    Anomaly archiving

    This feature is disabled by default. If enabled, anomalous data is archived to a file or table. After a quality validation, you can download and analyze the archived anomalous data.

    • Archive mode supports Archive anomalous fields only and Archive complete records.

      • Archive anomalous fields only: Archives only the distinct values of the monitored field. This is suitable when a single field is sufficient to identify the anomalous data.

      • Archive Full Record: Archives the entire record containing the anomalous data. This is suitable for cases where the full record is required to locate the anomalous data. Note: Because archiving the full record significantly increases the volume of archived data, we recommend that you archive only anomalous fields under normal circumstances.

    • Archive location supports Default file server and Custom anomaly archive table. If you have not created an anomaly archive table, click Manage Anomaly Archive Tables to create one. For more information, see Add an anomaly archive table.

      • Default file server: The system file server configured during Dataphin deployment. You can download the anomalous data from the Validation Records - Validation Details page, or access the default file server directly to obtain the data. When using the default file server, a maximum of 100 anomalous records are archived per validation, making it suitable for scenarios with small data volumes.

      • Custom anomaly archive table: If you need to store more anomalous data or consolidate it from different validation runs for comparative analysis, we recommend that you specify a custom archive table. Each quality rule run can record up to 10,000 anomalous data entries. In addition to downloading data from a single run on the validation records page, you can access the archive table directly and customize its lifecycle for greater flexibility.

        Note
        • You can download a consolidated set of anomalous data from all rules in the current run, up to a maximum of 10,000 entries. To view more data, we recommend archiving it to a specified anomaly archive table and accessing the table directly.

        • The anomaly archive table must meet specific format requirements to prevent write errors. For more information, see Add an anomaly archive table.

        • If the computing engine is Transwarp TDH 6.x or Transwarp TDH 9.3.x and you select a custom anomaly archive table, you can select Display field descriptions in anomaly data header. If selected, the downloaded anomaly data table fields will include comment information.

    Business attribute configuration

    Attribute information

    The input rules for business attributes depend on the quality rule attribute configuration. For example, if the jurisdictional department attribute is configured as a multi-select enumerated type with values "Big Data Dept", "Business Dept", and "Tech Dept", then this attribute will appear as a multi-select drop-down list with those options when you create a quality rule.

    If the rule owner attribute is configured as a custom input with a maximum length of 256 characters, you can enter up to 256 characters for this attribute.

    If the input method for an attribute field is Range, configure it as follows:

    Range: Typically used for continuous numerical or date ranges. You can select one of the following operators: >, >=, <, and <=. For more attribute configurations, see Create and manage quality rule attributes.

    Scheduling attribute configuration

    Scheduling method

    You can select an existing schedule. If you have not decided on a scheduling method, you can configure it after creating the quality rule. To create a new schedule, see Create a schedule.

    Quality score configuration

    Scoring method

    Dataphin supports two scoring methods: Quality validation status and Data qualification ratio.

    • Quality validation status: Scores are based on the validation status of the most recent successful run of the rule. A successful validation receives 100 points, and a failed one receives 0 points.

    • Data qualification ratio: The score is the percentage of valid data (pass rate) from the most recent successful run. For example, if the data format validity is 80%, the quality score is 80.

    The available scoring method varies by rule template. The following templates only support the Quality validation status method:

    • In the Uniqueness category: field group count check and field duplicate value count check.

    • In the Consistency category: single-table field aggregate value comparison and cross-source two-table field aggregate value comparison.

    • The Stability category.

    • In the Custom SQL category: custom aggregate metric check.

    Quality score weight

    The quality score weight determines the rule's contribution to the overall quality score of the monitored object. Select an integer from 1 to 10.

  5. Click OK to finish configuring the rule.

    You can click Preview SQL to compare the current configuration with the last saved version and review SQL changes.

    Note
    • SQL Preview is unavailable because the required information is incomplete.

    • The left pane shows the SQL preview from the last saved configuration. This pane is empty if the configuration has never been saved. The right pane shows the SQL preview for the current configuration.

Rule list

The rule configuration list page displays your configured data table rules and lets you perform operations such as view, edit, trial run, run, and delete.

image

Area

Description

① Filter and search area

Quickly search by object or rule name.

Filter by rule type, rule template, rule strength, trial run status, and effective status.

Note

If a business attribute is configured as searchable or filterable and is enabled, you can use it to search or filter.

② List area

This area displays information about the configured rules, including Object type/name, Rule name/ID, Trial run status, Effective status, Rule type, Rule template, Rule strength, Schedule type, Related knowledge base document, and Last updated by/time. Click the image icon next to the Refresh button to select the columns to display.

  • Effective status: We recommend that you perform a trial run before enabling a rule. Enable rules only after they pass the trial run to avoid blocking online tasks with faulty rules.

    • When enabled, the rule runs automatically according to its schedule.

    • When disabled, the rule does not run automatically, but you can still run it manually.

  • Related knowledge base document: Click View Details to see information about the knowledge base associated with the rule, including table name, validation object, rule, and document details. You can also search, view, edit, and delete knowledge base documents. For more information, see View the Knowledge Base.

③ Operations area

You can perform the following operations: View, Clone, Edit, Trial Run, Run, Schedule Configuration, Associate Knowledge Base Document, Quality Score Configuration, and Delete.

  • View: Displays the rule configuration details.

  • Clone: Creates a copy of the rule.

  • Edit: After you edit a rule, you must perform a new trial run. For referenced data table rules, you can only modify the rule name and strength.

  • Trial Run: Run a trial of the rule by using an Existing schedule or a Custom validation scope. After the trial run, click the image icon to view the trial run log.

  • Run: Run the rule by using an Existing schedule or a Custom validation scope. After the run, you can view the validation results in Validation Records.

  • Schedule Configuration: In the dialog box, you can filter by schedule type or search for a schedule by its name. You can also edit the schedule.

  • Associate knowledge base document: After a rule is associated with a knowledge base, you can view the association in Quality Rules and the governance workspace. You can select a knowledge base document that is not already associated. To create one, see Create and manage a knowledge base.

  • Quality Score Configuration: Modify the scoring method and quality score weight of the quality rule.

    Important

    The quality score weight of a rule is used to calculate the overall quality score of the monitored object. Modifying it will affect the quality scoring results. Proceed with caution.

  • Delete: Deletes the quality rule object and all its associated rules. This action cannot be undone. Proceed with caution.

④ Bulk operations area

You can perform the following bulk operations: Trial Run, Run, Configure Schedule, Enable, Disable, Modify Business Attributes, Associate Knowledge Base Document, Quality Score Configuration, Export Rules, and Delete.

  • Trial Run: Run a trial on multiple rules in bulk by using an Existing schedule or a Custom validation scope. After the trial run, click the image icon to view the trial run log.

  • Run: Run multiple rules in bulk by using an Existing schedule or a Custom validation scope. After the run, you can view the validation results in Validation Records.

    Note

    When running rules in bulk, we recommend selecting tables that use the same partition. The partition information is passed directly to the execution engine. Mismatched partitions may cause errors.

  • Configure Schedule: In the dialog box, you can filter by schedule type or search for a schedule by its name. You can also edit schedules and configure them for quality rules in bulk. You can only modify selected rules that are editable on the quality rules list page.

  • Enable: Enables the selected rules, which then run automatically according to their schedules. This action applies only to editable rules.

  • Disable: After you disable the effective status for multiple rules in bulk, the selected rules do not run automatically but can be run manually. You can only disable selected rules that are editable on the quality rules list page.

  • Modify Business Attributes: You can modify business attributes in bulk if the corresponding field is a single-select or multi-select type.

    • For multi-select fields, you can append or change attribute values.

    • For single-select fields, you can directly change the attribute value.

  • Associate knowledge base document: After a rule is associated with a knowledge base, you can view the association in Quality Rules and the governance workspace. You can configure a knowledge base for multiple monitored objects in bulk. To create one, see Create and manage a knowledge base.

  • Quality Score Configuration: Modify the scoring method and quality score weight for quality rules in bulk.

    Important

    The quality score weight of a rule is used to calculate the overall quality score of the monitored object. Modifying it will affect the quality scoring results. Proceed with caution.

  • Export Rules: Export the selected custom SQL quality rules under the current monitored object that you have permission to view.

  • Delete: Delete quality rule objects in bulk. This action cannot be undone. You can only delete rules for which you have edit permissions. Proceed with caution.

Create schedule

Note
  • When configuring a schedule for a rule, you can quickly reuse an existing schedule. A table can have a maximum of 20 scheduled rules.

  • You can configure a maximum of 10 schedules for a single rule.

  • Schedules with identical configurations are automatically deduplicated.

  • The verification scope is passed as a filter condition to the quality check, controlling the data range for each run. This scope serves as the basic unit for downstream components, such as quality reports, and defines the minimum viewing granularity.

  1. On the Quality Rule Details page, click the Schedule Configuration tab, and then click Create Schedule to open the Create Schedule dialog box.

  2. In the Create Schedule dialog box, configure the parameters.

    Parameter

    Description

    Schedule name

    Enter a custom name for the schedule. The name must not exceed 64 characters.

    Schedule type

    Supported types are time-based schedule and task-driven schedule.

    • Time-based schedule: Runs periodic quality checks on data at specified times. This type is suitable for scenarios where data is generated at fixed intervals.

      scheduling cycle: Executing a quality rule consumes computing resources. To ensure that production tasks run smoothly, avoid running multiple quality rules concurrently. The scheduling cycle can be set to Day, Week, Month, Hour, or Minute.

      If the system time zone (the time zone in your user center) differs from the schedule's time zone (configured in Management Center > System Settings > Basic Settings), the rule is executed based on the system time zone.

    • Task-driven schedule: Runs a configured quality rule before or after a specified task runs successfully. You can select tasks of the following engine types as triggers: SQL, Offline Pipeline, Python, Shell, Virtual, Dlink, Spark_jar, Hive_MR, and database SQL nodes. This type is suitable for scenarios where table modification tasks are fixed.

      Note
      • You can only select a production task as the trigger. If a strong rule is configured for the schedule, a quality check failure may affect online tasks. Proceed with caution.

      • Supported engine types: MaxCompute, E-MapReduce 3.X, E-MapReduce 5.x, CDH 5.X, CDH 6.X, FusionInsight 8.X, AsiaInfo DP 5.3, Cloudera Data Platform 7.x, Lindorm (computing engine), Transwarp TDH 6.x, and Transwarp TDH 9.3.x.

      • Trigger condition: Select when to trigger the quality check. Options are: Trigger After All Tasks Succeed, Trigger After Each Task Succeeds, and Trigger Before Each Task Runs.

      • Triggering task: Users with the following roles can select a task node in a production project as the trigger. You can also search for a task by its output name.

        • Users with the following roles can select task nodes in a production project: a project administrator of a Prod or Basic project; the O&M system role in a Prod project; the developer system role in a Basic project; or a custom project role with Project Quality Management-Quality Rule Management permissions.

        • A user with a custom global role that has the Quality Rule-Manage permission can select task nodes in any production project.

        Note

        When you configure the trigger to run after all jobs have run successfully, select jobs that have the same scheduling cycle to prevent delayed rule execution and delayed output of quality check results due to different scheduling cycles.

    Scheduling conditions

    This feature is disabled by default. When enabled, the system executes the quality rule only if the scheduling conditions are met; otherwise, the run is skipped.

    • Business date/execution date: If the schedule type is time-based schedule (which does not support execution date) or task-driven schedule, you can configure date-based conditions. You can select a General Calendar or a Custom Calendar. For information on how to create a custom calendar, see Create Public Calendar.

      • If you select General Calendar, you can set conditions based on Month, Day of the week, or Date. For example:

        image

      • If you select Custom Calendar, you can set conditions based on Date Type or Tag. For example:

        image

    • Instance type: If the schedule type is task-driven schedule, you can configure the instance type. The options are scheduled instance, backfill instance, and manual instance. For example:

      image

    Note
    • You must configure at least one condition. To add a condition, click + Add Rule.

    • You can configure a maximum of 10 scheduling conditions.

    • You can set the logical relationship between conditions to AND or OR.

    Partition expression

    Enter a partition expression, such as ds='${yyyyMMdd}', or select and modify a built-in expression to speed up configuration. For more information about available expressions, see Built-in Partition Expression Types.

    Note
    • If you need to validate multiple conditions, you can use and or or to combine them, such as province="Zhejiang" and ds<=${yyyyMMdd}.

    • If a filter condition is also configured in the quality rule, the system combines it with the partition expression using an AND operator, applying both to filter the data.

    • The partition expression supports a full table scan.

      Note: Avoid a full table scan by configuring a partition expression. A full table scan consumes significant computing resources and is not supported by all data sources.

    Verification scope budget

    Defaults to the current business date.

  3. Click OK to complete the schedule configuration.

Schedule configuration list

After a schedule is created, you can view, edit, clone, or delete it from the schedule configuration list.

image.png

Area

Description

① Filter and search area

Search for schedules by name.

Filter the list by schedule type: time-based schedule or task-driven schedule.

② List area

Displays the Schedule name, Schedule type, Last updated by, and Last updated time for each schedule in the list.

③ Actions area

You can edit, clone, or delete a schedule.

  • Edit: Modify the schedule configuration.

    Important

    Any changes are synchronized to all quality rules that reference this schedule. Proceed with caution.

  • Clone: Quickly duplicate a schedule's configuration.

  • Delete: You cannot delete a schedule if a quality rule references it.

Alert configuration

You can assign different alert methods to rules to create distinct alerts. For example, you can assign phone call alerts to strong rules and SMS alerts to weak rules. If a rule triggers multiple alert configurations, you can set a policy to determine which one takes effect.

Note

You can create up to 20 alert configurations for a single monitored object.

  1. On the Quality Rule Details page, click the Alert Configuration tab, and then click New Alert Configuration to open the New Alert Configuration dialog box.

  2. In the New Alert Configuration dialog box, configure the parameters.

    Parameter

    Description

    Scope

    Select All Rules, All Strong Rules, All Weak Rules, or Custom.

    Note
    • For a single monitored object, you can create one alert configuration for each of the following scopes: All Rules, All Strong Rules, and All Weak Rules. New rules automatically match the corresponding configuration based on their strength. To change one of these configurations, edit the existing one.

    • For a custom scope, you can select up to 200 rules from all rules that are configured for the current monitored object.

    Alert configuration name

    The alert configuration name must be unique per monitored object and have a maximum length of 256 characters.

    Alert recipient

    Configure alert recipients and alert methods. You must select at least one alert recipient and one alert method.

    • Alert Recipient: You can select from three types of alert recipients: custom, on-call schedule, and quality owner.

      You can configure up to 5 custom alert recipients and up to 3 on-call schedules.

    • Alert method: Available methods include Phone, Email, SMS, DingTalk, Lark, WeCom, and Custom Channel. You can manage these methods in Configure Channel Settings.

  3. Click OK to save the alert configuration.

Alert configuration list

After creating alert configurations, you can sort, edit, and delete them in the alert configuration list.

image.png

No.

Description

① Sorting

Configure the policy to apply when a quality rule matches multiple configurations:

  • First Matched Rule Takes Effect: When you select this policy, only the first alert configuration that matches a rule takes effect, and all other configurations are ignored. This policy allows you to sort the configured alerts. Click Sort Rules. You can drag the image.png icon before an alert configuration name to sort it or use the icons in the Actions column to move it. The icons from left to right are Move to Top and Move to Bottom. After you change the order, click the Finish Sorting button to complete the sorting.

    image.png

  • All alert configurations take effect: All configurations in the list apply to the quality rules within the current monitored object.

    For example, if you configure multiple alert configurations and all of them take effect, the system aggregates alerts by alert method, alert recipient, and quality rule. In particular, if the alert recipient is the same person and the alert methods are custom and quality owner, alert messages are aggregated based on the aggregation policy.

    Note
    • On-call schedules do not support alert aggregation.

    • If a quality owner includes a user group, alert notifications are automatically sent to all members in the group.

② List

The list displays the name, effective scope, alert recipients, and alert methods for each alert configuration.

Effective scope: For custom alerts, you can view the names of the configured objects and rules. If a rule is deleted, you can no longer view the object name. We recommend that you update the alert configuration.

image.png

③ Operations

You can edit and delete alert configurations.

  • Edit: Modify an alert configuration. If you change the alert recipients or methods, promptly notify the affected individuals to avoid missing critical alerts.

  • Delete: Deleting a configuration prevents it from triggering alerts for any matching rules. Proceed with caution.

Add an anomaly archiving table

An anomaly archiving table stores records that fail quality rule checks.

  1. On the Quality Rule Details page, go to the Exception Archiving tab and click +Add Exception Archive Table. The Add Exception Archive Table dialog box opens.

  2. In the Add Exception Archive Table dialog box, configure the parameters.

    • The Method parameter has two options: Create Table and Select Existing Table. The system adds special quality-check fields to the archiving table and archives anomalous data to this table instead of the original one.

      • Create Table: The default table name is current_table_name_exception_data. You can also specify a custom table name. The name can contain letters, numbers, underscores (_), and periods (.), and must be no more than 128 characters long.

        • If you monitor a physical table, the system creates the anomaly archiving table in the same project.

        • If you monitor a dimension logical table or a fact logical table, the system creates the anomaly archiving table in the same project by default. You can also manually specify a project under the monitored table's module, such as projectA.table_name.

        • If the monitored table is a summary logical table, we recommend that you specify a project name within the same module for the anomaly archiving table. Otherwise, the system automatically archives the data to a project within the monitored table's module.

        • If you monitor a data source table, the system creates the anomaly archiving table in the same database or data source.

      • Select Existing Table: You can select a table from the same project or data source. The anomaly archiving table must contain all fields from the monitored table plus the required quality-check fields. You can click View DDL of Exception Archive Table to view the DDL statement.

    • Lifecycle: This parameter is supported only for tables that use MaxCompute as the compute engine. If you create a new table, you can specify a custom number of days or select 7 days, 14 days, 30 days, or 360 days. If you select an existing table, the system displays the lifecycle that is already configured for the table.

    • Maximum Number of Archived Entries: This parameter is supported only for data tables whose compute engine is MaxCompute or from the Hadoop family, or when the monitored object is a Hive data source table. It specifies the maximum number of archived records for a single quality rule task. If the amount of anomalous data exceeds this threshold, the system archives only the records up to that limit. The system does not save excess records to the anomaly archiving table, but you can view them in the logs. The default is 10,000 records per check. You can select 10,000, 100,000, 500,000, or All, or enter any positive integer.

      Note
      • A large amount of data in the anomaly archiving table can affect query performance. Configure this setting based on your business requirements.

      • Whether you create a new table or select an existing one, its structure must match the following DDL statement:

        create table current_table_name_exception_data
         (dataphin_quality_tenant_id      varchar(64)   comment 'tenant ID' , 
          dataphin_quality_rule_id        varchar(64)   comment 'quality rule ID', 
          dataphin_quality_rule_name      varchar(256)  comment 'quality rule name', 
          dataphin_quality_column_name    varchar(1024) comment 'validation field name', 
          dataphin_quality_watch_task_id  varchar(128)  comment 'monitored object task ID', 
          dataphin_quality_rule_task_id   varchar(64)   comment 'rule task ID', 
          dataphin_quality_validate_time  varchar(64)   comment 'quality validation time', 
          dataphin_quality_archive_mode   varchar(32)   comment 'anomaly archive mode, ONLY_ERROR_FIELD/FULL_RECORD', 
          dataphin_quality_error_data     string        comment 'anomalous data', 
          ljba_id                         bigint        comment  'ljba_primary key', 
          ljb_id                          bigint        comment  'ljb_primary key', 
          col_tinyint                     tinyint       comment 'field type is TINYINT and lowercase',
          col_tinyint_02                  tinyint       comment '2',
          col_smallint                    smallint      comment 'field type is SMALLINT and lowercase',
          col_smallint_02                 smallint      comment '4',
          col_int                         int           comment 'field type is INT and lowercase',
          col_int_02                      int           comment '6',
          col_bigint                      bigint        comment 'field type is BIGINT and lowercase',
          col_bigint_02                   bigint        comment '8',
          col_float                       float         comment 'field type is FLOAT and lowercase',
          col_float_02                    float         comment '10',
          col_double                      double        comment 'field type is DOUBLE and lowercase',
          col_double_02                   double        comment '11',
          col_decimal                     decimal(38,18) comment 'field type is DECIMAL(38,18) and lowercase',
          col_decimal_02                  decimal(38,18) comment '12',
          col_varchar                     varchar(500)   comment 'field type is VARCHAR(500) and lowercase',
          col_varchar_02                  varchar(500)   comment '13',
          col_char                        char(10)       comment 'field type is CHAR(10) and lowercase',
          col_char_02                     char(10)       comment '14',
          col_string                      string         comment 'field type is STRING and lowercase',
          col_string_02                   string         comment '15',
          col_date                        date           comment 'field type is DATE and lowercase',
          col_date_02                     date           comment '16',
          col_datetime                    datetime       comment 'field type is DATETIME and lowercase',
          col_datetime_02                 datetime       comment '17',
          col_timestmap                   timestamp      comment 'field type is TIMESTAMP and lowercase',
          col_timestmap_02                timestamp      comment '18',
          col_boolean                     boolean        comment 'field type is BOOLEAN and lowercase',
          col_boolean_02                  boolean        comment '19',
          col_binary                      binary         comment 'field type is BINARY and lowercase',
          col_binary_02                   binary         comment '20',
          col_array                       array<int>     comment 'field type is ARRAY<int> and lowercase',
          col_array_02                    array<string>  comment '21',
          col_map                         map<string,string>  comment 'field type is MAP<string, string> and lowercase',
          col_map_02                      map<string,int>     comment '22',
          ds                              string              comment 'date partition, yyyyMMdd'
         ) 
        partitioned by 
        (dataphin_quality_validate_date string comment 'validation date (partition field)');
  3. Click OK to add the table.

    Select Automatically set as the effective archive table after creation to ensure the table is automatically selected when you create quality rules.

Manage anomaly archiving tables

After you add a table, the system sets the first one in the list as the effective archiving table by default. You can click the name of an anomaly archiving table to view its table structure. For other tables in the list, you can perform the following actions:

  • Set as Effective Archive Table: This setting directs all applicable quality rules to archive anomalous data to this table.

  • Delete: This action removes only the reference to the anomaly archiving table; it does not delete the table itself. You can re-add the reference later.

  • Edit: This option is available only for data tables that use MaxCompute or the Hadoop series as the compute engine, or for monitored objects that are Hive data source tables. You can modify the lifecycle and the maximum number of archived records. However, for monitored objects that are Hive data source tables, you can modify only the maximum number of archived records.

Quality report

Click Quality Report to view the rule check overview and rule check details for the current quality rule.

  • You can quickly filter the check details by abnormal result, partition time, or a keyword in the rule or object name.

  • In the operations column of the rule check details list, click the image icon to view the rule check details of the quality rule.

  • In the operations column of the rule check details list, click the image icon to view the execution log of the quality rule.

Permission management for quality rules

  1. Click Permission Management to configure the View Details permission. This setting determines which members can view validation record details, quality rule details, and quality reports.

    View Details: Select All Members or only members with quality management permissions for the current object.

  2. Click OK to save the permission settings.

Verification result configuration

The verification result configuration feature aggregates rule verification results based on the configured fields and writes them to a result table. This helps you analyze data quality trends from different business perspectives, such as by department or region.

  1. Click the Verification result configuration tab, and then click Edit at the bottom of the page to configure the parameters.

    Parameter

    Description

    Grouped statistics

    Specifies whether to enable grouped statistics. This feature is disabled by default. When enabled, the system groups the verification results from applicable rules by the specified grouping fields and saves the statistics to a group result table. You can click View Usage Example to learn how to use grouped statistics.

    Applicable rules

    Select the quality rules to which grouped statistics apply. You can select All Rules or Specified Rules.

    • All Rules: Includes all quality rules for the current monitored object that support grouped statistics.

    • Specified Rules: Select specific quality rules for the current monitored object that support grouped statistics. You can select multiple rules.

    Note
    • The following rules support verification result configuration:

      • Create from Template: field null value check, field empty string check, field uniqueness check, field format check, field length check, field value range check, reference code table comparison, data standard code table comparison, single-table field value consistency comparison, single-table field business logic consistency comparison, time function comparison, single-table time field comparison, two-table time field comparison, two-table field value consistency comparison, and two-table field business logic consistency comparison.

      • Custom SQL: custom data detail verification.

    • When you save the configuration, the system automatically adds any custom data verification rule for which you have enabled grouped statistics to the Specified Rules list.

    • For custom data detail verification rules, you can click Edit Group Statistics SQL to write the SQL.

    Grouping fields

    Select the fields to use for grouping. You can select multiple fields. When multiple fields are selected, statistics are grouped by the combination of their values, for example: group by columnA, columnB.

    Storage location

    The location where grouped verification results are stored. You can select Default file server or Custom result table.

    • Default file server: The system file server configured during Dataphin deployment. You can view grouped verification records on the Verification Records > Verification Details tab, or access the default file server directly to retrieve the records. The default file server displays up to 100 rows of grouped result data per verification, making it suitable for scenarios with small data volumes.

    • Custom result table: If you need to store more grouped results or consolidate data from different verification runs for comparative analysis, specify a custom result table. In addition to viewing the records on the Verification Records > Verification Details tab, you can also access the group result table directly for greater flexibility.

    Group result table

    This parameter is required when you set Storage Location to Custom Result Table. To configure the data table for saving group validation results, click Add Group Result Table or Modify, and then configure the table in the Add Group Result Table dialog box.

    • Add Method supports Create Table and Select Existing Table.

      • Create Table: The default table name is the name of the monitored object with the suffix _group_analysis_result. You can also specify a custom table name. The name can contain letters, numbers, underscores (_), and periods (.), and must be no more than 128 characters long.

        • If the monitored object is a physical table, Dataphin creates the group result table in the project where the monitored table resides.

        • If the monitored object is a dimension or fact logical table, Dataphin defaults to creating the group result table in the object's project. You can also specify a project in the object's module, such as projectA.table_name.

        • If the monitored object is a summary logical table, you should include a project name from the same module when naming the group result table. Otherwise, Dataphin automatically creates it in a project within the object's module.

        • If the monitored object is a data source table, Dataphin creates the group result table in the same database or data source.

      • Select Existing Table: You can only select a table from the same project or data source as the current monitored object. The group result table must meet specific format requirements to prevent write errors. Click View DDL Template for Table Creation to view the required DDL statement.

        Note
        • Applicable rules for the current monitored object share the same custom result table. Data is stored at the metric level, with one metric per row. This means that for any given group in a single verification, each statistical metric (such as total rows and error rows) is stored in a separate row.

        • Whether you create a new table or select an existing one, it must conform to the following DDL statement:

          create table group_analysis_result -- you can change this to a specific name
          (
             dataphin_quality_tenant_id varchar(64) comment 'tenant ID'
          ,
             dataphin_quality_rule_task_id varchar(64) comment 'rule task ID'
          ,
             dataphin_quality_watch_task_id varchar(128) comment 'monitored object'
          ,
             dataphin_quality_rule_id varchar(64) comment 'rule ID'
          ,
             dataphin_quality_rule_name varchar(256) comment 'rule name'
          ,
             dataphin_quality_column_name varchar(1024) comment 'verified field'
          ,
             dataphin_quality_validate_time varchar(64) comment 'verification time'
          ,
             dataphin_quality_validate_date varchar(32) comment 'verification date'
          ,
             total_rows varchar(64) comment 'total rows in the group'
          ,
             error_rows varchar(64) comment 'error rows in the group'
          ,
             normal_rows varchar(64) comment 'normal rows in the group'
          ,
             normal_rate varchar(64) comment 'normal rate in the group'
          ,
             error_rate varchar(64) comment 'error rate in the group'
          ,
             name varchar(512) comment 'name'
          )
  2. Click OK to save the verification result configuration.

Quality rule execution configuration

Note
  • If a quality rule task is automatically terminated due to a timeout, its execution result is failed. You can view the corresponding execution log on the validation record details page.

  • For a quality rule task configured for retry on failure, you can view the record for each retry attempt in the execution log on the validation record details page.

  • All quality rules under a single monitored object, including newly created rules and existing rules that have not yet run, adhere to the latest execution configuration.

  1. Click the Execution Configuration tab, and then click Edit at the bottom of the page to configure the parameters.

    Parameter

    Description

    Scope

    Select All Rules, All Strong Rules, All Weak Rules, or Custom.

    Execution timeout

    If the total runtime of a quality rule task (excluding resource and scheduling wait times) exceeds this threshold, the system automatically terminates the task and marks it as failed. The default is 1 hour. You can set a custom duration from 0 to 2 hours, with a precision of up to two decimal places.

    Automatic retry on failure

    If a quality rule task fails, the system can automatically retry it based on the specified Number of retries and Retry interval. This feature is disabled by default. Enable it to configure these settings.

    • Number of retries: The maximum number of times the system automatically retries a failed quality rule task. The default is 1. You can set an integer from 1 to 3.

    • Retry interval: The interval between retry attempts. The default is 0 minutes. You can set an integer from 0 to 10 minutes.

  2. Click OK to save the execution configuration.

Next steps

After configuring these quality rules, you can view them in the global data table rule list. For more information, see View the monitored object list or .