MD5 Exact Deduplication

Updated at:

The MD5-based exact deduplication operator uses the MD5 hash algorithm to generate a unique digital fingerprint for data to rapidly identify identical duplicates. The operator is sensitive to formatting differences, meaning even minor variations such as spaces or line breaks are treated as distinct content. It is ideal for exact deduplication of text and files in scenarios such as web crawler data cleansing, removing duplicate content posts, and knowledge base management. This topic describes how to configure the MD5-based exact deduplication operator.

Prerequisites

  • You can use the workflow feature only after purchasing the unstructured data processing feature for your instance.

  • You have created a workflow. For more information, see Create and manage a workflow.

Permissions

In a Basic project, project administrators, developers, analysts, and custom project roles with the Dataset - Use permission can use all datasets within that project as input and output datasets for the operator.

Supported file formats

The MD5-based exact deduplication operator can process plain text with parsable fields and files referenced by URLs.

Procedure

  1. In the top navigation bar of the Dataphin homepage, choose Develop > Data Develop.

  2. In the top menu bar of the Development page, select Project.

  3. In the left-side navigation pane, choose Data Processing > Workflow. In the Workflow list on the left, click the target workflow to open its canvas. From the Component Library on the left, drag the MD5-based exact deduplication operator to the canvas. In the MD5-based exact deduplication panel on the right, configure the following parameters.

    Parameter

    Description

    Step name

    Enter a name for the operator, up to 256 characters long.

    Input settings

    Dataset

    Select the dataset to process. You can select a hybrid dataset or a table dataset. After you select a dataset, you must also select its version. By default, the earliest version is selected.

    If this operator is downstream of another operator, the dataset selected here is typically the same as the output dataset of the upstream operator.

    Input field

    The source field that contains the text or file URL to process. You can select any field from the metadata table of the input dataset.

    Filter (optional)

    Use SQL syntax to specify a filter condition. You only need to enter the condition that follows the WHERE clause. System global variables, such as the business date ${bizdate}, are supported.

    Component settings

    Mode

    The MD5-based exact deduplication operator supports the following three function modes:

    • comparison and deduplication: Uses pre-calculated MD5 hashes in a comparison dataset as a baseline. This mode calculates the MD5 hash of the input content and compares it against the baseline hashes to flag duplicates without modifying the input content.

    • calculate MD5 hash only: Calculates the MD5 hash of the input content without deleting or modifying the data.

    Note

    Null values in the dataset are ignored during deduplication.

    Comparison dataset

    The dataset that stores the MD5 hashes used for comparison. The operator compares these hashes with the hash of the input field to identify duplicates. You can select a hybrid dataset or a table dataset.

    Note

    This parameter is available only when the function mode is set to comparison and deduplication.

    MD5 field for comparison

    The field that contains the pre-calculated MD5 hashes used as the baseline for comparison. The operator compares the MD5 hash of the input field with the values in this field to identify duplicates. The content of this field is not recalculated.

    Note

    This parameter is available only when the function mode is set to comparison and deduplication.

    Output settings

    Dataset

    Specify the output dataset. You can select source dataset (writes the output back to the source dataset) or other datasets (writes the output to a different specified dataset). If the metadata table of the source dataset does not have a primary key, the output dataset defaults to other datasets.

    • If you select other datasets, you must also specify a hybrid dataset or table dataset and its version as the output dataset. By default, the earliest version is selected. You can also select a different version of the source dataset.

    • If you select source dataset, the output is written to the same version of the source dataset's metadata table.

    Load policy

    If the metadata table of the selected output dataset contains a primary key, the update upon primary key conflict option is selected by default. Otherwise, the append data option is selected by default.

    • append data: Appends new data directly to the target table. An error is reported if a primary key or constraint conflict occurs.

    • update upon primary key conflict: If a primary key or constraint conflict occurs, the operator deletes the existing row with the same primary key and inserts the new data.

    • overwrite: Deletes all data from the target table before writing the new data.

    Note

    If the function mode is set to comparison and deduplication or calculate MD5 hash only and the output dataset is source dataset, only the update upon primary key conflict loading policy is supported.

    Field mapping

    The MD5-based exact deduplication operator always outputs the following fields:

    • is_duplicate: Indicates whether the input content is a duplicate of a value in the comparison MD5 field. Possible values are yes (duplicate), no (not a duplicate), and failed (calculation failed). This field is output only when the function mode is comparison and deduplication, and the output dataset is other datasets.

    • md5_hash: The MD5 hash value of the source field.

    Manage field mappings with the following options:

    • Add output field: Click to add a new, empty field mapping row. This function is available only when the output dataset is other datasets.

    • Batch map: Click to map fields in batches by name, by row, or manually. This function is available only when the output dataset is other datasets.

    • Delete: Click the Delete icon to remove the corresponding field mapping. However, mappings for the operator's fixed output fields cannot be deleted.

    Note

    If you select comparison and deduplication as the function mode, the md5_hash field mapping is optional.

  4. After you configure the parameters, click Save in the top menu bar of the canvas to save the configuration.

    After configuring the operator, you can add upstream or downstream operators to complete the workflow.