All Products
Search
Document Center

DataWorks:Doris

Last Updated:Sep 03, 2026

Data Integration allows you to use Doris Reader to read data from Doris and use Doris Writer to write table data to Doris. This topic describes the capabilities of DataWorks Data Integration in Doris data synchronization.

Supported Doris versions

Doris Writer uses MySQL Driver 5.1.47. The kernel versions supported by the driver are as follows. For more information about driver capabilities, see the Doris official documentation.

Doris version

Supported

0.x.x

Yes

1.1.x

Yes

1.2.x

Yes

2.x

Yes

Usage restrictions

Data Integration supports offline synchronization of Doris data (offline read and offline write).

Supported data types

Different Doris versions support different data types and aggregation models. For information about all data types supported in each Doris version, see the official Doris documentation. The following table describes the mainly supported data types.

Data type

Supported model

Doris version

Offline write (Doris Writer)

SMALLINT

Aggregate,Unique,Duplicate

0.x.x, 1.1.x, 1.2.x, 2.x

Yes

INT

Aggregate,Unique,Duplicate

0.x.x, 1.1.x, 1.2.x, 2.x

Yes

BIGINT

Aggregate,Unique,Duplicate

0.x.x, 1.1.x, 1.2.x, 2.x

Yes

LARGEINT

Aggregate,Unique,Duplicate

0.x.x, 1.1.x, 1.2.x, 2.x

Yes

FLOAT

Aggregate,Unique,Duplicate

0.x.x, 1.1.x, 1.2.x, 2.x

Yes

DOUBLE

Aggregate,Unique,Duplicate

0.x.x, 1.1.x, 1.2.x, 2.x

Yes

DECIMAL

Aggregate,Unique,Duplicate

0.x.x, 1.1.x, 1.2.x, 2.x

Yes

DECIMALV3

Aggregate,Unique,Duplicate

Versions later than 1.2.1, 2.x

Yes

DATE

Aggregate,Unique,Duplicate

0.x.x, 1.1.x, 1.2.x, 2.x

Yes

DATETIME

Aggregate,Unique,Duplicate

0.x.x, 1.1.x, 1.2.x, 2.x

Yes

DATEV2

Aggregate,Unique,Duplicate

1.2.x, 2.x

Yes

DATETIMEV2

Aggregate,Unique,Duplicate

1.2.x, 2.x

Yes

CHAR

Aggregate,Unique,Duplicate

0.x.x, 1.1.x, 1.2.x, 2.x

Yes

VARCHAR

Aggregate,Unique,Duplicate

0.x.x, 1.1.x, 1.2.x, 2.x

Yes

STRING

Aggregate,Unique,Duplicate

0.x.x, 1.1.x, 1.2.x, 2.x

Yes

ARRAY

Duplicate

1.2.x, 2.x

Yes

JSON

Aggregate,Unique,Duplicate

1.2.x, 2.x

Yes

HLL

Aggregate

0.x.x, 1.1.x, 1.2.x, 2.x

Yes

BITMAP

Aggregate

0.x.x, 1.1.x, 1.2.x, 2.x

Yes

QUANTILE_STATE

Aggregate

1.2.x, 2.x

Yes

How it works

Doris Writer writes data by using StreamLoad that is natively supported by Doris. Doris Writer caches the data that is read by the reader in memory, concatenates the data into text, and then imports the text to the Doris database in batches. For more information, see the Doris official documentation.

Prepare an ApsaraDB for OceanBase environment before data synchronization

Before you use DataWorks to synchronize data to a Doris data source, you must prepare a Doris environment. This ensures that a data synchronization task can be configured and can synchronize data to the Doris data source as expected. The following information describes how to prepare a Doris environment for data synchronization to a Doris data source.

Confirm the Doris version

Data Integration has requirements on Doris versions. You can check whether the version of the Doris cluster that you want to synchronize data from meets the requirements based on the Supported Doris versions section. You can download a specific version from the Doris official website and install it.

Create an account and grant permissions

You must create an account that is used to log on to the Doris database for subsequent operations. You must specify a password for the account for subsequent connections to the Doris database. If you want to use the default root user of Doris to log on to the Doris database, you must specify a password for the root user. By default, the root user does not have a password. You can execute an SQL statement in Doris to specify the password:

SET PASSWORD FOR 'root' = PASSWORD('Password')

Configure the network connection for Doris

To use the StreamLoad method to write data, you need to access the private IP address of an FE node. If you access the public IP address of the FE node, you are redirected to the private IP address of a BE node. For more information about the redirection, see Data operation issues. In this case, you must establish network connections between your data source and a serverless resource group or an exclusive resource group for Data Integration to enable the resource group to access the data source over an internal network. For more information about how to establish a network connection between the Doris database and a resource group, see Network connectivity solutions.

Add a data source

Before you develop a synchronization task in DataWorks, you must add the required data source to DataWorks by following the instructions in Data source configuration. You can view parameter descriptions in the DataWorks console to understand the meanings of the parameters when you add a data source.

Take note of the configuration requirements for the following configuration items of the Doris data source:

  • JdbcUrl: Enter the JDBC connection string, which includes the IP address, port number, database, and connection parameters. Both public and private IP addresses are supported. If you use a public IP address, make sure that the Data Integration resource group can access the host where your Doris instance is located.

  • FE endpoint: Enter the IP addresses and ports of the FE nodes. If your cluster has multiple FE nodes, you can enter multiple endpoints separated by commas, for example, ip1:port1,ip2:port2. When you test the connection, DataWorks tests the connectivity to all specified FE endpoints.

  • Username: Enter the username for accessing the Doris database.

  • Password: Enter the password that corresponds to the username.

  • Advanced Parameters: The Doris data source supports multiple advanced parameters that extend the connection configuration. For example, to adjust the Java Database Connectivity (JDBC) query timeout, add the queryTimeout parameter to the advanced parameters. The value is in seconds, and queryTimeout=600 sets the timeout to 600 seconds. After you set this parameter, it is automatically appended to the JDBC connection string. queryTimeout takes effect only at the data source level. You cannot configure queryTimeout separately for a batch synchronization node. Configure it centrally in the data source.

Develop a data synchronization task

For information about the entry point for and the procedure of configuring a synchronization task, see the following configuration guides.

Appendix: Code and parameters

Configure a batch synchronization task by using the code editor

If you want to configure a batch synchronization task by using the code editor, you must configure the related parameters in the script based on the unified script format requirements. For more information, see Script mode configuration. The following information describes the parameters that you must configure for data sources when you configure a batch synchronization task by using the code editor.

Reader script demo

{
  "type": "job",
  "version": "2.0",// The version number. 
  "steps": [
    {
      "stepType": "doris",// The plug-in name. 
      "parameter": {
        "column": [// The names of the columns. 
          "id"
        ],
        "connection": [
          {
            "querySql": [
              "select a,b from join1 c join join2 d on c.id = d.id;"
            ],
            "datasource": ""// The name of the data source. 
          }
        ],
        "where": "",// The WHERE clause. 
        "splitPk": "",// The shard key. 
        "encoding": "UTF-8"// The encoding format. 
      },
      "name": "Reader",
      "category": "reader"
    },
    {
      "stepType": "stream",
      "parameter": {},
      "name": "Writer",
      "category": "writer"
    }
  ],
  "setting": {
    "errorLimit": {
      "record": "0"// The maximum number of dirty data records allowed. 
    },
    "speed": {
      "throttle": true,// Specifies whether to enable throttling. The value false indicates that throttling is disabled, and the value true indicates that throttling is enabled. The mbps parameter takes effect only when the throttle parameter is set to true. 
      "concurrent": 1,// The maximum number of parallel threads. 
      "mbps": "12"// The maximum transmission rate. Unit: MB/s. 
    }
  },
  "order": {
    "hops": [
      {
        "from": "Reader",
        "to": "Writer"
      }
    ]
  }
}

Reader script parameters

Parameter

Description

Required

Default value

datasource

The name of the data source. It must be the same as the name of the added data source. You can add data sources by using the code editor.

Yes

No default value

table

The name of the table from which you want to read data. Each synchronization task can be used to synchronize data from only one table.

For a sharded table, you can use the table parameter to specify the partitions from which you want to read data. Examples:

  • You can configure a range to read data from sharded databases and tables. For example, 'table_[0-99]' specifies that data is read from 'table_0', 'table_1', and 'table_2', up to 'table_99'.

  • If your tables have numeric suffixes of the same length, such as 'table_000', 'table_001', and 'table_002', up to 'table_999', you can configure the parameter as '"table": ["table_00[0-9]", "table_0[10-99]", "table_[100-999]"]'.

Note

Doris Reader reads data from the columns that are specified by the column parameter in the partitions that are specified by the table parameter. If a specified partition or column does not exist, the synchronization task fails.

Yes

No default value

column

The columns that you want to synchronize. The columns are described in a JSON array. By default, all columns are synchronized. For example, use ["*"].

  • Column pruning: You can select a subset of columns to export.

  • The column order can be changed. This indicates that you can specify columns in an order different from the order specified by the schema of the source table.

  • Constant configuration: You must follow the Doris SQL syntax. Example: ["id","`table`","1","'mingya.wmy'","'null'","to_char(a+1)","2.3","true"].

    • id: a column name.

    • table: the name of a column that contains reserved keywords.

    • 1: an integer constant.

    • 'mingya.wmy': a string constant, which is enclosed in single quotation marks (').

    • null:

      • " " indicates an empty string.

      • null indicates a null value.

      • 'null' indicates the string "null".

    • to_char(a+1): a function expression that is used to calculate the length of a string.

    • 2.3: a floating-point constant.

    • true: a Boolean value.

  • The column parameter must explicitly specify all the columns from which you want to read data. This parameter cannot be left empty.

Yes

No default value

splitPk

To improve read performance, you can use the splitPk parameter to specify a shard key. Data Integration uses this key to partition the data and run concurrent tasks.

  • We recommend that you set the splitPk parameter to the name of the primary key column of the table. Data can be evenly distributed to different shards based on the primary key column, instead of being intensively distributed only to specific shards.

  • The splitPk parameter supports sharding for data only of integer data types. If you set the splitPk parameter to a field of an unsupported data type, such as a string, floating point, or date data type, the setting of this parameter is ignored, and a single thread is used to read data.

  • If the splitPk parameter is not provided or is left empty, a single thread is used to read data.

No

No default value

where

The filter condition. In many business scenarios, you may want to synchronize only the data from the current day. To do this, you can specify the where condition as gmt_create > $bizdate.

  • You can use the WHERE clause to read incremental data. If the where parameter is not provided or is left empty, Doris Reader reads all data.

  • Do not set the where parameter to limit 10. This value does not conform to the constraints of Doris on the SQL WHERE clause.

No

No default value

querySql (advanced parameter, which is available only in the code editor)

In some business scenarios, the where parameter may not be sufficient to describe the desired filter conditions. You can use this parameter to specify a custom SQL query for filtering. If you configure this parameter, Data Integration ignores the table, column, where, and splitPk parameters, and uses the custom query to retrieve data. For example, to join multiple tables before synchronization, you can use a query like select a,b from table_a join table_b on table_a.id = table_b.id. The querySql parameter has a higher priority than the table, column, where, and splitPk parameters. The datasource parameter is still required for the system to retrieve connection details such as the username and password.

Note

The name of the querySql parameter is case-sensitive. For example, querysql does not take effect.

No

No default value

Writer script demo

{
  "stepType": "doris",// The plug-in name. 
  "parameter":
  {
    "postSql":// The SQL statement that you want to execute after the synchronization task is run. 
    [],
    "preSql":
    [],// The SQL statement that you want to execute before the synchronization task is run. 
    "datasource":"doris_datasource",// The name of the data source. 
    "table": "doris_table_name",// The name of the table. 
    "column":
    [
      "id",
      "table_id",
      "table_no",
      "table_name",
      "table_status"
    ],
    "loadProps":{
      "column_separator": "\\x01",// The column delimiter of data in the CSV format.
      "line_delimiter": "\\x02"// The row delimiter of data in the CSV format.
    }
  },
  "name": "Writer",
  "category": "writer"
}

Writer script parameters

Parameter

Description

Required

Default value

datasource

The name of the data source. It must be the same as the name of the added data source. You can add data sources by using the code editor.

Yes

No default value

table

The name of the table from which you want to read data.

Yes

No default value

column

The destination columns to write data to. Specify column names in an array, for example, "column":["id","name","age"]. To write data to all columns in order, use an asterisk (*) in the array, for example, "column":["*"].

Yes

No default value

preSql

The SQL statements to execute before the data synchronization task starts. In the codeless UI, you can execute only one SQL statement. In the code editor, you can execute multiple SQL statements. For example, you can use these statements to clear existing data from the table.

No

No default value

postSql

The SQL statement that you want to execute after the synchronization task is run. For example, you can set this parameter to the SQL statement that is used to add a timestamp. You can execute only one SQL statement on the codeless UI and multiple SQL statements in the code editor.

No

No default value

maxBatchRows

The maximum number of rows that you can write to the destination table at a time. Both this parameter and the batchSize parameter determine the number of data records that you can write to the destination table at a time. Each time the cached data reaches the value of either parameter, the writer starts to write the data to the destination table.

No

500000

batchSize

The maximum amount of data that you can write to the destination table at a time. Both this parameter and the maxBatchRows parameter determine the number of data records that you can write to the destination table at a time. Each time the cached data reaches the value of either parameter, the writer starts to write the data to the destination table.

No

104857600

maxRetries

The maximum number of retries allowed after you failed to write multiple data records to the destination table at a time.

No

3

labelPrefix

The label prefix for each uploaded file batch. The final label is a combination of labelPrefix + UUID to ensure that each import is idempotent, preventing data duplication.

No

datax_doris_writer_

loadProps

The request parameters for StreamLoad, mainly used to configure the import data format. By default, data is imported in CSV format. If the loadProps parameter is not configured, the default CSV format is used, with \t as the column delimiter and \n as the row delimiter. The default configuration is as follows:

"loadProps": {
    "format":"csv",
    "column_separator": "\t",
    "line_delimiter": "\n"
}

If you want to write data in the JSON format, use the following settings:

"loadProps": {
    "format": "json"
}

No

No default value

Write data of aggregate types

You can use Doris Writer to write data of aggregate types, but you must make additional configurations in the code editor.

For example, in the following Doris table, uuid is of the bitmap type (aggregation type) and sex is of the HLL type (aggregation type).

CREATE TABLE `example_table_1` (
  `user_id` int(11) NOT NULL,
  `date` varchar(10) NOT NULL,
  `city` varchar(10) NOT NULL,
  `uuid` bitmap BITMAP_UNION, -- Aggregation type
  `sex` HLL HLL_UNION  -- Aggregation type
) ENGINE=OLAP AGGREGATE KEY(`user_id`, `date`, `city`)
COMMENT 'OLAP' DISTRIBUTED BY HASH(`user_id`) BUCKETS 32

The raw data to be synchronized consists of five columns, as shown below. The values in the uuid and sex columns are raw values (ordinary numbers and strings) instead of values of the bitmap or HLL type:

user_id,date,city,uuid,sex
0,T0S4Pb,abc,43,'54'
1,T0S4Pd,fsd,34,'54'
2,T0S4Pb,fa3,53,'64'
4,T0S4Pb,fwe,87,'64'
5,T0S4Pb,gbr,90,'56'
2,iY3GiHkLF,234,100,'54'

Raw values cannot be directly written to bitmap or HLL columns. The values must be converted by using aggregate functions. The columns parameter of Doris Stream Load can complete the conversion. The mapping rule is as follows: columns in the file are mapped in sequence to the column names that do not contain an equal sign (=) in columns, and entries that contain an equal sign (=) are expression transformations (the values of the destination columns are calculated from the expressions) and do not occupy file column positions.

Therefore, the mappings between the file columns and table columns in this example are as follows:

  • Columns 1 to 3 in the file (user_id, date, and city): directly written to the table columns of the same names.

  • Column 4 in the file (the raw value of uuid): assigned to the temporary placeholder column k1, converted into a bitmap by the expression uuid=bitmap_hash(k1), and written to the table column uuid.

  • Column 5 in the file (the raw value of sex): assigned to the temporary placeholder column k2, converted into an HLL value by the expression sex=hll_hash(k2), and written to the table column sex.

k1 and k2 are temporary placeholder names that are not written to the table. You can change the names to any other names, as long as the names referenced in the expressions are consistent with the names of the placeholder columns.

When you use Doris Writer to write data of aggregate types, you must specify the columns to write in writer.parameter.column and configure the preceding conversion rules in writer.parameter.loadProps.columns. uuid and sex in writer.parameter.column are the names of the raw value fields in synchronization records. They determine only the fields to write and the write order. A CSV file does not contain column names, and Stream Load identifies columns by position. Therefore, you can use custom names for the fourth and fifth columns in the columns parameter (k1 and k2 in this example).

Sample code:

{
    "stepType": "doris",
    "parameter": {
        "datasource": "doris_datasource",
        "table": "example_table_1",
        "column": [
            "user_id",
            "date",
            "city",
            "uuid",
            "sex"
        ],
        "loadProps": {
            "format": "csv",
            "column_separator": "\\x01",
            "line_delimiter": "\\x02",
            "columns": "user_id,date,city,k1,uuid=bitmap_hash(k1),k2,sex=hll_hash(k2)"
        },
        "preSql": [],
        "postSql": []
    },
    "name": "Writer",
    "category": "writer"
}