Skip to content

Conversation

@EdwardArchive
Copy link
Contributor

@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
Contributor 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
Contributor Author

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

@EdwardArchive
Copy link
Contributor 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
Contributor 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
Contributor 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.

Copy link
Contributor

@lovincyrus lovincyrus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this pass, I'd proceed without the frontend since there are ongoing updates to how the form is rendered in #8467

We should avoid creating a separate AddStarRocksForm, as it is an anti-pattern that we do not want to maintain in the codebase.

Copy link
Contributor

@lovincyrus lovincyrus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job removing the StarRocks form! I see some remnants of StarRocks frontend integration.

We should limit this branch's scope to the StarRocks driver changes and exclude any frontend-related changes.

… + Fix external catalog information schema check
@EdwardArchive
Copy link
Contributor Author

@lovincyrus
Thanks a lot for your review!
I’ve updated the code as per your suggestions

@EdwardArchive
Copy link
Contributor Author

Sorry for the repeated review.
I've synced all changes to the main branch, excluding the icon-related frontend updates.
Thank you once again for your thorough feedback.

@EdwardArchive EdwardArchive force-pushed the feat_starrocks_olap_connector branch from 17d5118 to 78df8ec Compare December 21, 2025 09:46
@lovincyrus
Copy link
Contributor

lovincyrus commented Dec 22, 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!

This branch is now focused on supporting the StarRocks driver and adding some icons. Requesting the final +1 @ericpgreen2

Copy link
Contributor

@ericpgreen2 ericpgreen2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Cyrus. I agree with the decision to remove the frontend changes from this branch, as they can be addressed in a separate dedicated PR. I'll approve the PR from the frontend perspective :)

@EdwardArchive
Copy link
Contributor Author

Hi @k-anshul, sorry for commenting at the end of the year

It looks like the frontend changes have passed successfully in this PR.

Could you please guide me on what additional steps are needed to move this PR toward merge?

Thank you!

@k-anshul
Copy link
Member

Hey @EdwardArchive

Can you fix the prettier checks? You can run npx prettier --check "**/*" --write at the repo root.

@EdwardArchive
Copy link
Contributor Author

Oh.. thanks!

@k-anshul
Copy link
Member

LGTM.

Thank you for your contribution @EdwardArchive

@k-anshul k-anshul removed the request for review from lovincyrus December 30, 2025 10:43
@k-anshul k-anshul dismissed lovincyrus’s stale review December 30, 2025 10:44

Already approved in comments above

@k-anshul k-anshul merged commit e46c9dd into rilldata:main Dec 30, 2025
10 of 13 checks passed
@EdwardArchive
Copy link
Contributor Author

Hi @k-anshul, @lovincyrus

Thanks for your hard work again! And happy new year!

I'd like to start working on the frontend portion for StarRocks integration.
Before I begin, I wanted to check with you:

Should I create a new issue to track the frontend work, or is it okay
to just open a follow-up PR directly (referencing this PR)?

Also, is #8467 at a point where I can proceed with the form integration?

Thanks!

@k-anshul
Copy link
Member

k-anshul commented Jan 12, 2026

Hey @EdwardArchive

Thank you for your interest in contributing to Rill.
Before we dive into frontend integration, I recommend prioritizing stability improvements for the driver.
I did some more testing and found following issues:

  1. The varchar results are still being returned in binary. We discussed this earlier as well : Add StarRocks Driver Support #8390 (comment) May need to borrow changes from MySQL driver :
    type mysqlRows struct {
  2. Some APIs are returning incorrect results. It might make sense to add unit tests for starrocks. You can take a reference from unit tests in runtime/queries for other drivers like clickhouse.

@EdwardArchive
Copy link
Contributor Author

Hi @k-anshul,

Sure, I'll work for the stability improvements for the driver.
thanks for the testing.

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.

4 participants