Qeasy Cloud
Get Started

Advanced Query Condition Engine: Source Platform Data Filtering Configuration Guide

· 钟家寿· Product Docs· 20 views· 3 min read

Feature Overview

When we designed the Advanced Query Condition Engine for the Qeasy DataHub platform, the original intent was to address a common engineering challenge: the query interfaces of certain source platforms offer limited filtering capabilities and cannot support complex business data screening requirements.

The Advanced Query Condition Engine is a conditional filtering mechanism that runs within the data integration pipeline. It operates at a critical juncture: after data is pulled from the source platform's query queue and before it is written to the target storage. Once data is fetched from the source platform into the in-memory buffer, the system evaluates each record against the conditions. Any data that does not satisfy the condition configuration will be discarded and will not be persisted into the target storage.

It must be emphasized that the condition parameter only takes effect within source platform configurations; target platform configurations do not recognize this parameter. This boundary design avoids confusion in configuration semantics and clarifies the responsibility of filtering.

Usage Scenarios

Typical usage scenarios include the following:

  1. Insufficient native filtering on the source platform: For example, a business system only provides an interface for exact queries by document number, but the business side requires filtering across multiple dimensions such as date ranges, product names, and warehouse codes.
  2. Data denoising and sampling: When performing full data synchronization, if only records with specific statuses or specific field values are relevant, conditions can be used to discard irrelevant data early, reducing downstream storage and computational pressure.
  3. Fine-grained filtering on sub-table (line item) fields: Business documents typically contain headers and line items. The strict mode strictMode for line items allows fine-grained control over document-level retention versus line-level retention.

Configuration Guide

condition should be an array, and its child members are also arrays. The outer array expresses OR logic, while the inner array expresses AND logic. This two-dimensional array structure allows any complex Boolean expression to be expressed naturally.

Basic Structure of a Filter Object

A standard filter object contains at least three parts:

  • field: The name of the field to be filtered. When handling sub-table or line item fields, it can be written in dot-path format such as items.name.
  • logic: The logical operator.
  • value: The comparison value.

Supported Logical Operators

The Qeasy DataHub platform currently supports the following logical operators:

  • eq: equal to
  • neq: not equal to
  • gt: greater than. When comparing dates, the value must first be converted to a timestamp, prefixed with timestamp.
  • egt: greater than or equal to
  • lt: less than
  • elt: less than or equal to
  • like: contains
  • notlike: does not contain
  • between: range. The value field should be written as 100,500, separated by an English comma.
  • notnull: not null. The value can be omitted.
  • isnull: is null. The value can be omitted.

Line Item Strict Mode (strictMode)

For sub-table filtering, the platform additionally provides the strictMode switch:

  • When strictMode is set to true, if any line in the line items satisfies the condition, the entire document is retained at the document level; otherwise, the entire document is discarded.
  • When strictMode is set to false (the default), the system evaluates line by line, discarding only the line items that do not satisfy the condition while preserving the other line items.

This design allows engineers to flexibly choose between document-level matching or line-level matching for filtering granularity.

Complete Example Interpretation

json
{
  "api": "purchasein.query",
  "type": "QUERY",
  "method": "POST",
  "number": "io_id",
  "id": "io_id",
  "condition": [
    [
      { "field": "io_id", "logic": "eq", "value": "816403" },
      { "field": "items.name", "logic": "like", "value": "活动", "strictMode": true }
    ],
    [
      { "field": "io_id", "logic": "like", "value": "512" }
    ],
    [
      { "field": "items.name", "logic": "eq", "value": "企鹅爸爸15合1桌游" }
    ]
  ]
}

The above configuration can be interpreted as:

(io_id equals 816403 AND items.name contains "活动" with strict mode) OR (io_id contains "512") OR (items.name equals "企鹅爸爸15合1桌游").

Important Notes

  1. Scope boundary: condition only takes effect in source platform configurations; do not use it in target platform configurations.
  2. Date type handling: When using operators such as gt or lt to compare dates, the date must first be converted to a timestamp, and the value must be prefixed with timestamp.
  3. Range syntax: The value for the between operator must separate the two boundary values with an English comma; no other separators are permitted.
  4. strictMode default: strictMode is disabled by default (false), meaning line-level filtering is the default behavior. To enable document-level matching, explicitly set it to true.
  5. Two-dimensional array semantics: The outer array represents OR, and the inner array represents AND. Do not confuse the hierarchy of logic.
Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/product-docs/doc-nd4463885

Comments