Skip to content

Commit 439f797

Browse files
brucearctorxinge.ji
andcommitted
Feat: Add Apache Doris engine adapter with OLAP and Lakehouse multi-catalog support
Closes #5875 Co-authored-by: xinge.ji <xinge.ji@outlook.com> Signed-off-by: Bruce Arctor <5032356+brucearctor@users.noreply.github.com>
1 parent 5a09168 commit 439f797

33 files changed

Lines changed: 14835 additions & 30 deletions

‎.github/scripts/install-prerequisites.sh‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ elif [ "$ENGINE" == "fabric" ]; then
2828
rm packages-microsoft-prod.deb
2929

3030
ENGINE_DEPENDENCIES="msodbcsql18"
31+
elif [ "$ENGINE" == "doris" ]; then
32+
sudo sysctl -w vm.max_map_count=2000000
3133
fi
3234

3335
ALL_DEPENDENCIES="$COMMON_DEPENDENCIES $ENGINE_DEPENDENCIES"

‎.github/scripts/wait-for-db.sh‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,46 @@ db2_ready() {
104104
done
105105
}
106106

107+
doris_ready() {
108+
probe_port 9030
109+
110+
echo "Waiting for Doris FE to accept SQL connections..."
111+
while true; do
112+
if docker exec -i doris-fe mysql -h127.0.0.1 -P9030 -uroot -e "SHOW FRONTENDS\G" 2>/dev/null | grep -q "Alive: true"; then
113+
echo "Doris FE is alive"
114+
break
115+
fi
116+
sleep 2
117+
done
118+
119+
docker exec -i doris-fe mysql -h127.0.0.1 -P9030 -uroot -e "ALTER SYSTEM ADD BACKEND '172.30.80.3:9050';" 2>/dev/null || true
120+
121+
echo "Checking for 1 alive Doris backends..."
122+
while true; do
123+
echo "Checking Doris backends..."
124+
ALIVE_BACKENDS=$(docker exec -i doris-fe mysql -h127.0.0.1 -P9030 -uroot -e "show backends \G" 2>/dev/null | grep -c "^ *Alive: true *$" || true)
125+
126+
# fallback value if failed to get number
127+
if ! [[ "$ALIVE_BACKENDS" =~ ^[0-9]+$ ]]; then
128+
echo "WARN: Unable to parse number of alive backends, got: '$ALIVE_BACKENDS'"
129+
ALIVE_BACKENDS=0
130+
fi
131+
132+
echo "Found $ALIVE_BACKENDS alive backends"
133+
134+
if [ "$ALIVE_BACKENDS" -ge 1 ]; then
135+
echo "Doris has 1 or more alive backends"
136+
break
137+
fi
138+
139+
echo "Waiting for more backends to become alive..."
140+
sleep 3
141+
done
142+
143+
# set default replication num to 1 (there is only one be in the docker compose file)
144+
docker exec -i doris-fe mysql -h127.0.0.1 -P9030 -uroot -e "ADMIN SET FRONTEND CONFIG ('force_olap_table_replication_num' = '1');"
145+
}
146+
107147
echo "Waiting for $ENGINE to be ready..."
108148

109149
READINESS_FUNC="${ENGINE}_ready"

‎.github/workflows/pr.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ jobs:
269269
clickhouse,
270270
risingwave,
271271
starrocks,
272+
doris,
272273
]
273274
env:
274275
PYTEST_XDIST_AUTO_NUM_WORKERS: 2

‎.readthedocs.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build:
66
python: "3.10"
77
jobs:
88
pre_build:
9-
- pip install -e ".[athena,azuresql,bigframes,bigquery,clickhouse,databricks,dbt,dlt,gcppostgres,github,llm,mssql,mysql,mwaa,postgres,redshift,slack,snowflake,starrocks,trino,web,risingwave]"
9+
- pip install -e ".[athena,azuresql,bigframes,bigquery,clickhouse,databricks,dbt,dlt,doris,gcppostgres,github,llm,mssql,mysql,mwaa,postgres,redshift,slack,snowflake,starrocks,trino,web,risingwave]"
1010
- make api-docs
1111

1212
mkdocs:

‎Makefile‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,9 @@ starrocks-test: engine-starrocks-up
226226
db2-test: engine-db2-up
227227
pytest -n auto -m "db2" --reruns 3 --junitxml=test-results/junit-db2.xml
228228

229+
doris-test: engine-doris-up
230+
pytest -n auto -m "doris" --reruns 3 --junitxml=test-results/junit-doris.xml
231+
229232
#################
230233
# Cloud Engines #
231234
#################

‎docs/concepts/models/model_kinds.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ Depending on the target engine, models of the `INCREMENTAL_BY_TIME_RANGE` kind a
444444
| Redshift | DELETE by time range, then INSERT |
445445
| Postgres | DELETE by time range, then INSERT |
446446
| DuckDB | DELETE by time range, then INSERT |
447+
| Doris | DELETE by time range, then INSERT |
447448

448449
## INCREMENTAL_BY_UNIQUE_KEY
449450

@@ -669,6 +670,7 @@ Depending on the target engine, models of the `INCREMENTAL_BY_UNIQUE_KEY` kind a
669670
| Redshift | MERGE ON unique key |
670671
| Postgres | MERGE ON unique key |
671672
| DuckDB | DELETE ON matched + INSERT new rows |
673+
| Doris | DELETE ON matched + INSERT new rows |
672674

673675
## FULL
674676
Models of the `FULL` kind cause the dataset associated with a model to be fully refreshed (rewritten) upon each model evaluation.
@@ -761,6 +763,7 @@ Depending on the target engine, models of the `FULL` kind are materialized using
761763
| Redshift | DROP TABLE, CREATE TABLE, INSERT |
762764
| Postgres | DROP TABLE, CREATE TABLE, INSERT |
763765
| DuckDB | CREATE OR REPLACE TABLE |
766+
| Doris | CREATE TABLE ... AS SELECT (new OLAP), DELETE + INSERT (existing OLAP) / INSERT OVERWRITE (Iceberg) |
764767

765768
## VIEW
766769
The model kinds described so far cause the output of a model query to be materialized and stored in a physical table.
@@ -837,6 +840,7 @@ MODEL (
837840

838841
* BigQuery
839842
* Databricks
843+
* Doris
840844
* Snowflake
841845

842846
During the evaluation of a model of this kind, the view will be replaced or recreated only if the model's query rendered during evaluation does not match the query used during the previous view creation for this model, or if the target view does not exist. Thus, views are recreated only when necessary in order to realize all the benefits provided by materialized views.
@@ -1629,6 +1633,7 @@ Depending on the target engine, models of the `INCREMENTAL_BY_PARTITION` kind ar
16291633
| Redshift | DELETE by partitioning key, then INSERT |
16301634
| Postgres | DELETE by partitioning key, then INSERT |
16311635
| DuckDB | DELETE by partitioning key, then INSERT |
1636+
| Doris | DELETE by partitioning key, then INSERT |
16321637

16331638
## INCREMENTAL_UNMANAGED
16341639

‎docs/concepts/models/overview.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ This table lists each engine's support for `TABLE` and `VIEW` object comments:
181181
| BigQuery | Y | Y |
182182
| ClickHouse | Y | Y |
183183
| Databricks | Y | Y |
184+
| Doris | Y | Y |
184185
| DuckDB <=0.9 | N | N |
185186
| DuckDB >=0.10 | Y | Y |
186187
| MySQL | Y | Y |

‎docs/guides/configuration.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,7 @@ These pages describe the connection configuration options for each execution eng
933933
* [BigQuery](../integrations/engines/bigquery.md)
934934
* [ClickHouse](../integrations/engines/clickhouse.md)
935935
* [Databricks](../integrations/engines/databricks.md)
936+
* [Doris](../integrations/engines/doris.md)
936937
* [DuckDB](../integrations/engines/duckdb.md)
937938
* [Fabric](../integrations/engines/fabric.md)
938939
* [MotherDuck](../integrations/engines/motherduck.md)
@@ -975,6 +976,7 @@ Other state engines with fast and reliable database transactions (less tested th
975976
Unsupported state engines, even for development:
976977

977978
* [ClickHouse](../integrations/engines/clickhouse.md)
979+
* [Doris](../integrations/engines/doris.md)
978980
* [Spark](../integrations/engines/spark.md)
979981
* [StarRocks](../integrations/engines/starrocks.md)
980982
* [Trino](../integrations/engines/trino.md)

‎docs/guides/connections.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ default_gateway: local_db
8585
* [ClickHouse](../integrations/engines/clickhouse.md)
8686
* [Databricks](../integrations/engines/databricks.md)
8787
* [Db2](../integrations/engines/db2.md)
88+
* [Doris](../integrations/engines/doris.md)
8889
* [DuckDB](../integrations/engines/duckdb.md)
8990
* [Fabric](../integrations/engines/fabric.md)
9091
* [MotherDuck](../integrations/engines/motherduck.md)

‎docs/installation.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Other extras are required to use specific SQL engines, like Bigquery or Postgres
5454
| Bigquery | `pip install "sqlmesh[bigquery]"` |
5555
| ClickHouse | `pip install "sqlmesh[clickhouse]"` |
5656
| Databricks | `pip install "sqlmesh[databricks]"` |
57+
| Doris | `pip install "sqlmesh[doris]"` |
5758
| Fabric | `pip install "sqlmesh[fabric]"` |
5859
| GCP Postgres | `pip install "sqlmesh[gcppostgres]"` |
5960
| MS SQL Server | `pip install "sqlmesh[mssql]"` |

0 commit comments

Comments
 (0)