Repository navigation
Add StarRocks as a first-class data source (correct SQL dialect) #2788
inaboishchikov
started this conversation in
Ideas
Replies: 1 comment 3 replies
|
Hi @inaboishchikov, we are happy to accept the PR for StarRock. Feel free to submit a PR.
I think a separate data source is fine.
I guess you only add the enum for Rust. It's not a big change for the Rust core module. It's fine to send a single PR for the StartRock data source.
It's better to add some integration tests on the Python side. Thanks for your contribution 🚀 |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
I'd like to add StarRocks as a first-class data source in
core/wren(CLI/SDK). I have a working implementation ready as a PR and would like to align on direction before opening it, as suggested in CONTRIBUTING.Problem
StarRocks speaks the MySQL wire protocol, so today it can be connected through the
dorisdata source (port 9030). Connection, models, joins and cubes work. However, SQL is transpiled with the sqlglotdorisdialect, which differs from StarRocks. Tested against a live StarRocks cluster with wrenai 0.13.3 / 0.15.0:dorisdialectdate_trunc('month', d)DATE_TRUNC(d, 'MONTH')→ "date_trunc requires first parameter must be a string constant"DATE_TRUNC('MONTH', d)array_agg(x)COLLECT_LIST(x)→ "No matching function"ARRAY_AGG(x)group_concat(x)a,,b,,c)GROUP_CONCAT(x SEPARATOR ',')Using
mysqlinstead doesn't help: the same driver, butdate_truncturns into aSTR_TO_DATE(CONCAT(...))workaround andarray_aggis unsupported.Also,
wren context import dbtfails for dbt-starrocks projects withUnsupported dbt adapter 'starrocks'.sqlglot already ships a
starrocksdialect. Overriding the dialect map fordoris→starrocks(a one-line monkeypatch) made all three queries above return correct results, with the same connection and driver.Proposal
Add a
starrocksdata source that reuses the existing MySQL/Doris connector but transpiles with sqlglot'sstarrocksdialect:core/wren:DataSource.starrocks,StarRocksConnectionInfo(same fields as Doris, port 9030), connector factory/registry, field registry, valid dialects, dbt adapter mapping (username/schemaas in dbt-starrocks)core/wren-core-base+core/wren-core:DataSource::StarRocksusing the existingMySQLDialectcore/wren-mdl/mdl.schema.json:STARROCKS/starrocksExisting
dorisbehaviour is unchanged.Questions
starrocksdata source acceptable, or would you prefer something else (e.g. a dialect option ondoris)?I have the branch ready (unit tests pass; I could not compile the Rust part locally, so I'd rely on CI there) and can open the PR as soon as the direction is agreed.
All reactions