You need to enable JavaScript to run this app.
Intelligent Data Insight

Intelligent Data Insight

Copy page
Download PDF
Best Practices for Dataset
Practice for Configuring Filtering Partition Field in Direct-Connection Datasets
Copy page
Download PDF
Practice for Configuring Filtering Partition Field in Direct-Connection Datasets

After creating a direct-connect dataset, to avoid scanning the entire partitioned table when querying data later, you need to filter data based on partition fields. This article introduces how to configure partition fields for direct-connect datasets that use partitioned tables to improve filtering efficiency during subsequent data queries.

Prerequisites

A direct-connect dataset has been created, and the data table in the source data engine is a partitioned table.

Configure Partition Fields for Dataset
  1. After creating the corresponding direct-connect dataset, go to the dataset details page and click the "Edit" button in the upper right corner to enter the dataset editing page.
    Image

  2. On the dataset editing page, click the "Field settings" button in the upper right corner to enter the field settings page, then modify partition fields of text or numeric type.
    Image

    Parameters

    Configuration description

    Data type

    Only when the original field type is date or datetime can it be directly set as a partition field. If the original field is of text or numeric type (such as Int or String), you must first change its data type to "date", configure the correct format (see expression), and then set it as a partition field.

    Expression

    Convert partition fields of text or numeric type to date type. The conversion syntax varies by engine. Below are examples for common engines (using order_date as an example; please replace with the actual field name):

    • ClickHouse: cast(order_date as Date) or toDate(order_date)
    • Hetu: cast(order_date as date)
    • Doris: cast(order_date as date) or date(order_date)
    • OpenGauss: cast(order_date as date)
    • GaussDWS: CAST(order_date AS DATE FORMAT 'YYYY-MM-DD')

    warning

    The converted format must match the actual value of the source field (such as yyyyMMdd, yyyy-MM-dd, yyyy/MM/dd, or timestamp).

    Set partition

    In the field configuration list, locate the "Operation" column for the corresponding field and click the "Set partition" button to set this field as the dataset partition field.

    tip

    Scope of application: Only effective for direct single node connections (multi-node and custom SQL nodes do not support setting dataset partition fields).
    Automatic setting logic: If the table's partition field is already of date type, the system will automatically set it as the dataset partition field; other types (text or numeric) will not be set automatically and require the user to manually complete the above three steps: "data type → expression → set partition".
    Role of partition field: Once set successfully, a "Recent data in N days" filter will be automatically added on the visualization query side, styled as a date filter.
    Supported types and formats (direct connection):

    • Date type: Directly supported.
    • Int type: Supports yyyyMMdd format or timestamp.
    • Text type: Supports yyyyMMdd, yyyy-MM-dd, and yyyy/MM/dd formats.
  3. (Optional) Modify the field name. Since the above operation converts the field type using a field expression, it is recommended that you modify the field name.
    Image
    If you do not modify the field name, when saving the dataset, the interface will display a field name error. You can also choose not to modify the field name and select "Save anyway" here.

Application Example: Quick Partition Field Filtering

After completing the above configuration, when querying data in the corresponding dataset, you can easily filter data using the configured partition fields.
Image
As shown in the figure above, on the visual query page, the configured partition fields are automatically added to the filter configuration results, and it supports convenient selection of the date range to filter using the date component.

Last updated: 2026.07.06 14:43:01