Skip to content

Conversation

@EdwardArchive
Copy link

@EdwardArchive EdwardArchive commented Dec 5, 2025

Issue : #6839
Related PR : #8390 (priveus)

PR: StarRocks OLAP Connector (Read-Only)

What is StarRocks

https://www.starrocks.io/ is an open-source, high-performance OLAP database designed for real-time analytics. It provides a MySQL-compatible interface with columnar storage
and vectorized query execution, making it ideal for large-scale data analytics workloads.

Summary

Add StarRocks as an OLAP connector to directly query existing StarRocks tables. This is a read-only OLAP connector - Model Execution is not supported.

Changes

1. Backend - StarRocks Driver (runtime/drivers/starrocks/) - 5 files

File Status Changes
starrocks.go Added Connection logic, database field optional, OLAP interface only
olap.go Added Query execution with fully qualified table names
information_schema.go Added Table/column metadata retrieval with catalog support
utils.go Added Utility functions for StarRocks-specific SQL
starrocks_test.go Added Test cases for connection and queries

2. Backend - Query Dialect Support (runtime/queries/) - 14 files

File Status Changes
column_cardinality.go Modified Added StarRocks dialect with approx_count_distinct()
column_null_count.go Modified Added StarRocks dialect support
column_desc_stats.go Modified Added StarRocks with percentile_approx(), stddev_samp()
column_time_range.go Modified Added StarRocks dialect support
column_time_grain.go Modified Added StarRocks-specific time functions
column_topk.go Modified Added StarRocks dialect support
column_rug_histogram.go Modified Returns empty result for StarRocks
column_numeric_histogram.go Modified Returns empty result for StarRocks
column_timeseries.go Modified Returns empty result for StarRocks (no TEMP TABLE)
table_head.go Modified Added StarRocks to supportedTableHeadDialects
table_cardinality.go Modified Added StarRocks dialect support
sqlutil.go Modified Added StarRocks to dialect utilities
resource_watermark.go Modified Added StarRocks dialect support

Query Support Summary:

Query Status Notes
TableHead, TableColumns, TableCardinality Full
ColumnCardinality, ColumnNullCount, ColumnTopK Full
ColumnDescriptiveStatistics Full percentile_approx(), stddev_samp()
ColumnTimeRange, ColumnTimeGrain Full StarRocks-specific SQL
ColumnRugHistogram, ColumnNumericHistogram Empty Performance issues
ColumnTimeseries Empty TEMP TABLE not supported

3. Backend - Other (runtime/, cli/) - 2 files

File Status Changes
runtime/drivers/olap.go Modified StarRocks dialect registration
cli/cmd/runtime/start.go Modified StarRocks driver initialization

4. Frontend (web-common/, web-local/) - 8 files

File Status Changes
web-common/src/features/sources/modal/yupSchemas.ts Modified Database field optional (matches backend)
web-common/src/features/sources/modal/constants.ts Modified StarRocks connector constants
web-common/src/features/sources/modal/icons.ts Modified StarRocks icon import
web-common/src/features/connectors/connectors-utils.ts Modified StarRocks connector utilities
web-common/src/features/connectors/connector-icon-mapping.ts Modified StarRocks icon mapping
web-common/src/components/icons/connectors/StarRocks.svelte Added StarRocks icon component
web-common/src/components/icons/connectors/StarRocksIcon.svelte Added StarRocks icon variant
web-local/src/routes/.../connector/starrocks/[name]/[database]/[schema]/[table]/+page.svelte Added StarRocks table page
web-local/src/routes/.../connector/starrocks/+page.ts Added StarRocks connector page route

5. Documentation - 1 file

File Status Changes
docs/docs/build/connectors/olap/starrocks.md Added StarRocks OLAP connector documentation

StarRocks Naming Mapping

Rill API Parameter StarRocks Concept Example
database Catalog default_catalog, iceberg_catalog
databaseSchema Database tpcds_100gb, my_database
table Table store_sales, customer

Tested

  • Connection: default_catalog, external catalogs (Iceberg/Hive), DSN format
  • Table browsing: list tables, preview data, column metadata
  • Profiling: cardinality, null count, statistics, TopK, time range/grain
  • UI: connector modal, optional database field, table preview

Known Limitations

  1. No Model Execution: Read-only OLAP connector only
  2. No Histogram: Returns empty results due to performance issues
  3. No Timeseries: Returns empty results (TEMP TABLE not supported)
  4. MySQL Protocol: Uses StarRocks MySQL-compatible protocol (port 9030)
  5. default_catalog on DSN : MySQL don't have Catalog

@EdwardArchive
Copy link
Author

I just working on it find some edge case

- Add StarRocks support for ColumnRugHistogram with generate_series()
- Add StarRocks support for ColumnNumericHistogram (FD & Diagnostic methods)
- Add CTE-based ColumnTimeseries for StarRocks (no TEMP TABLE required)
- Add helper functions: rangeNumbersEnd(), isNonNullFinite() for StarRocks
- Handle reserved keywords (values, range) with backtick escaping
…ndling, connection timeouts, and error messages
@EdwardArchive
Copy link
Author

@k-anshul
Hi, Can you help review this change so we can move it forward?

@EdwardArchive
Copy link
Author

Thank you for the Hard works!
I'll fixed it

@k-anshul k-anshul requested a review from ericpgreen2 December 8, 2025 09:16
@k-anshul
Copy link
Member

k-anshul commented Dec 8, 2025

Also tagging @ericpgreen2 for review on frontend changes.

- addressed multiple review comments
- cleaned up import and minor issues
- Remove unused 'strings' import from starrocks.go
- Fix undefined variable 't' in olap.go StarRocks case
- Update date_trunc comment to reference validation location
…lorer

- Fix build compilation errors
- Ensure selected catalog (Database), schema (DatabaseSchema), and table
  are properly propagated when creating metrics from Data Explorer
@EdwardArchive
Copy link
Author

Hi @k-anshul,

Thank you so much for taking the time to review my code — I really appreciate it, especially since it was likely during the weekend or early morning hours.

I've addressed all of your review comments. Please let me know if you have any questions or concerns.

Have a great day!

@k-anshul
Copy link
Member

k-anshul commented Dec 9, 2025

Hey @EdwardArchive

Thanks for your work here. I added some more comments. Mostly should be minor.
Please also take a look at the failing checks.

@EdwardArchive
Copy link
Author

Hey @EdwardArchive

Thanks for your work here. I added some more comments. Mostly should be minor. Please also take a look at the failing checks.

Hey @k-anshul
I'll take care of this. thanks again.

@EdwardArchive
Copy link
Author

Hey @k-anshul,
I’ve made a number of the changes you suggested. Please review when you get a chance.

@k-anshul
Copy link
Member

Hey @EdwardArchive

Please also fix the failing checks.

@EdwardArchive
Copy link
Author

Hi sorry for late, I just fix the failing checks.

@k-anshul
Copy link
Member

Hey

Thanks @EdwardArchive
The backend changes looks good to me. Please take a look at the failing test(TestConfigPropertiesValidate/both_dsn_and_host ) and Web code quality checks action.

Eric is going to take a look at UI changes as soon as he gets some bandwidth.

@EdwardArchive
Copy link
Author

Hey @k-anshul

Thanks for the hard work again.
good, I'll wait for the Eric's review

Thanks again,
Have a great day!

@ericpgreen2
Copy link
Contributor

ericpgreen2 commented Dec 12, 2025

@lovincyrus, given your ownership of the connector forms, can you please do the first frontend reviews of this code? For now, I've removed myself as reviewer and tagged you. Once the PR has your sign-off, then please request a review from me and I'll do a final review. Thank you!

@ericpgreen2 ericpgreen2 requested review from lovincyrus and removed request for ericpgreen2 December 12, 2025 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants