Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
fbde1a6
only olap connector(not incloud model)
EdwardArchive Dec 3, 2025
ad513a0
fix : message "not available for dialect 'starrocks'" & starrocks icon
EdwardArchive Dec 5, 2025
aee42f2
feat(starrocks): implement histogram and timeseries support
EdwardArchive Dec 5, 2025
692f7c6
feat(starrocks): add support for resolving timestamps in StarRocks di…
EdwardArchive Dec 5, 2025
4c09870
feat(starrocks): enhance StarRocks connector with improved context ha…
EdwardArchive Dec 7, 2025
c47dbd9
feat(starrocks): add StarRocks form and error handling to AddDataForm
EdwardArchive Dec 7, 2025
0a3dbc5
Update docs
EdwardArchive Dec 7, 2025
ed2301b
fix: update code based on PR review feedback
EdwardArchive Dec 8, 2025
ffdce1b
fix: apply fixes from PR comments
EdwardArchive Dec 8, 2025
948fa2a
fix: resolve build errors
EdwardArchive Dec 8, 2025
4de5c64
fix: update reserved keyword handling and SQL name sanitization for S…
EdwardArchive Dec 8, 2025
2987351
fix: improve dry run handling in Query method and simplify SQL min query
EdwardArchive Dec 8, 2025
003001e
fix: correct safeName call in Druid maxSQL query
EdwardArchive Dec 8, 2025
ae95f12
fix: use equality check instead of Before for StarRocks time range bins
EdwardArchive Dec 8, 2025
436fa8c
fix: resolve build errors and metrics context propagation in Data Exp…
EdwardArchive Dec 8, 2025
b83c569
change test code and fix on AddStarRocksFrom
EdwardArchive Dec 9, 2025
f4cd71f
Apply minor fixes from code review comments
EdwardArchive Dec 9, 2025
0d75a03
Refactor: removed unused code as suggested by Git CI
EdwardArchive Dec 9, 2025
60c6614
fix: Add only for the StarRocks compatibility by executor part
EdwardArchive Dec 9, 2025
6cd5488
fix change c.getDB to c.db
EdwardArchive Dec 9, 2025
11db47c
fix: simplify database connection retrieval in StarRocks driver
EdwardArchive Dec 9, 2025
193ba9c
fix: update column handling for StarRocks compatibility in numeric an…
EdwardArchive Dec 9, 2025
3bec873
feat: enhance error handling and form structure in AddStarRocksForm c…
EdwardArchive Dec 9, 2025
3f61433
fix the failing checks.
EdwardArchive Dec 10, 2025
cae1bdf
fix the failing checks 2
EdwardArchive Dec 11, 2025
5945162
fix : npx prettier check
EdwardArchive Dec 15, 2025
2c14c1c
[Fix] avoid creating a separate AddStarRocksForm
EdwardArchive Dec 16, 2025
3a3bd35
[Enhancement] Limit StarRocks Frontend until integration is supported…
EdwardArchive Dec 18, 2025
4b37cbc
[Enhancement] Restrict changes to Backend components only (StarRocks)
EdwardArchive Dec 19, 2025
65488dc
fix: format OLAP_DRIVERS_WITHOUT_MODELING array for consistency
EdwardArchive Dec 19, 2025
78df8ec
[Enhancement] Handle StarRocks icon in a more general way
EdwardArchive Dec 19, 2025
3a69ee6
fix: Prettier checks
EdwardArchive Dec 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cli/cmd/runtime/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import (
_ "github.com/rilldata/rill/runtime/drivers/slack"
_ "github.com/rilldata/rill/runtime/drivers/snowflake"
_ "github.com/rilldata/rill/runtime/drivers/sqlite"
_ "github.com/rilldata/rill/runtime/drivers/starrocks"
_ "github.com/rilldata/rill/runtime/reconcilers"
_ "github.com/rilldata/rill/runtime/resolvers"
)
Expand Down
118 changes: 118 additions & 0 deletions docs/docs/build/connectors/olap/starrocks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---
title: StarRocks
description: Power Rill dashboards using StarRocks
sidebar_label: StarRocks
sidebar_position: 5
---

[StarRocks](https://www.starrocks.io/) is an open-source, high-performance analytical database designed for real-time, multi-dimensional analytics on large-scale data. It supports both primary key and aggregate data models, making it suitable for a variety of analytical workloads including real-time dashboards, ad-hoc queries, and complex analytical tasks.

Rill supports connecting to an existing StarRocks cluster via a "live connector" and using it as an OLAP engine built against [external tables](/build/connectors/olap#external-olap-tables) to power Rill dashboards.

:::

## Connect to StarRocks

When using StarRocks for local development, you can connect via connection parameters or by using the DSN.

After selecting "Add Data", select StarRocks and fill in your connection parameters. This will automatically create the `starrocks.yaml` file in your `connectors` directory and populate the `.env` file with `connector.starrocks.password`.

### Connection Parameters

```yaml
type: connector
driver: starrocks

host: <HOSTNAME>
port: 9030
username: <USERNAME>
password: "{{ .env.connector.starrocks.password }}"
catalog: default_catalog
database: <DATABASE>
ssl: false
```

### Connection String (DSN)

Rill can also connect to StarRocks using a DSN connection string. StarRocks uses MySQL protocol, so the connection string follows the MySQL DSN format:

```yaml
type: connector
driver: starrocks

dsn: "{{ .env.connector.starrocks.dsn }}"
```

The DSN format is:
```
starrocks://user:password@host:port/database
```

Or using MySQL-style format:
```
user:password@tcp(host:port)/database?parseTime=true
```

## Configuration Properties

| Property | Description | Default |
|----------|-------------|---------|
| `host` | StarRocks FE (Frontend) server hostname | Required |
| `port` | MySQL protocol port of StarRocks FE | `9030` |
| `username` | Username for authentication | Required |
| `password` | Password for authentication | - |
| `catalog` | StarRocks catalog name (for external catalogs like Iceberg, Hive) | `default_catalog` |
| `database` | StarRocks database name | - |
| `ssl` | Enable SSL/TLS encryption | `false` |
| `dsn` | Full connection string (alternative to individual parameters) | - |

## External Catalogs

StarRocks supports external catalogs for querying data in Hive, Iceberg, Delta Lake, and other external data sources. To use an external catalog:

1. Set the `catalog` property to your external catalog name (e.g., `iceberg_catalog`)
2. Set the `database` property to the database within that catalog

```yaml
type: connector
driver: starrocks

host: starrocks-fe.example.com
port: 9030
username: analyst
password: "{{ .env.connector.starrocks.password }}"
catalog: iceberg_catalog
database: my_database
```

## Naming Mapping

StarRocks uses a three-level hierarchy: Catalog > Database > Table. In Rill's API:

| Rill Parameter | StarRocks Concept | Example |
|----------------|-------------------|---------|
| `database` | Catalog | `default_catalog`, `iceberg_catalog` |
| `databaseSchema` | Database | `my_database` |
| `table` | Table | `my_table` |

## Troubleshooting

### Connection Issues

If you encounter connection issues:

1. Verify the FE node hostname and port (default: 9030)
2. Check that your user has appropriate permissions
3. Ensure network connectivity to the StarRocks FE node
4. For SSL connections, verify SSL is enabled on the StarRocks server


## Known Limitations

- **Model execution**: Model creation and execution is not yet supported. This feature is under development.

:::info Need help connecting to StarRocks?

If you would like to connect Rill to an existing StarRocks instance, please don't hesitate to [contact us](/contact). We'd love to help!

:::
36 changes: 31 additions & 5 deletions runtime/drivers/olap.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ const (
DialectDruid
DialectClickHouse
DialectPinot
DialectStarRocks

// Below dialects are not fully supported dialects.
DialectBigQuery
Expand All @@ -220,6 +221,8 @@ func (d Dialect) String() string {
return "clickhouse"
case DialectPinot:
return "pinot"
case DialectStarRocks:
return "starrocks"
case DialectBigQuery:
return "bigquery"
case DialectSnowflake:
Expand Down Expand Up @@ -248,8 +251,8 @@ func (d Dialect) EscapeIdentifier(ident string) string {
}

switch d {
case DialectMySQL, DialectBigQuery:
// MySQL uses backticks for quoting identifiers
case DialectMySQL, DialectBigQuery, DialectStarRocks:
// MySQL and StarRocks use backticks for quoting identifiers
// Replace any backticks inside the identifier with double backticks.
return fmt.Sprintf("`%s`", strings.ReplaceAll(ident, "`", "``"))

Expand Down Expand Up @@ -294,7 +297,8 @@ func (d Dialect) ConvertToDateTruncSpecifier(grain runtimev1.TimeGrain) string {
}

func (d Dialect) SupportsILike() bool {
return d != DialectDruid && d != DialectPinot
// StarRocks uses MySQL syntax which doesn't support ILIKE
return d != DialectDruid && d != DialectPinot && d != DialectStarRocks
}

// RequiresCastForLike returns true if the dialect requires an expression used in a LIKE or ILIKE condition to explicitly be cast to type TEXT.
Expand Down Expand Up @@ -470,6 +474,10 @@ func (d Dialect) JoinOnExpression(lhs, rhs string) string {
if d == DialectClickHouse {
return fmt.Sprintf("isNotDistinctFrom(%s, %s)", lhs, rhs)
}
// StarRocks uses MySQL's NULL-safe equal operator
if d == DialectStarRocks {
return fmt.Sprintf("%s <=> %s", lhs, rhs)
}
return fmt.Sprintf("%s IS NOT DISTINCT FROM %s", lhs, rhs)
}

Expand Down Expand Up @@ -581,6 +589,10 @@ func (d Dialect) DateTruncExpr(dim *runtimev1.MetricsViewSpec_Dimension, grain r
return fmt.Sprintf("CAST(date_trunc('%s', %s, 'MILLISECONDS') AS TIMESTAMP)", specifier, expr), nil
}
return fmt.Sprintf("CAST(date_trunc('%s', %s, 'MILLISECONDS', '%s') AS TIMESTAMP)", specifier, expr, tz), nil
case DialectStarRocks:
// StarRocks supports date_trunc similar to DuckDB but does not support timezone parameter
// NOTE: Timezone and time shift parameters are validated in runtime/metricsview/executor/executor_validate.go
return fmt.Sprintf("date_trunc('%s', %s)", specifier, expr), nil
default:
return "", fmt.Errorf("unsupported dialect %q", d)
}
Expand All @@ -593,7 +605,7 @@ func (d Dialect) DateDiff(grain runtimev1.TimeGrain, t1, t2 time.Time) (string,
return fmt.Sprintf("DATEDIFF('%s', parseDateTimeBestEffort('%s'), parseDateTimeBestEffort('%s'))", unit, t1.Format(time.RFC3339), t2.Format(time.RFC3339)), nil
case DialectDruid:
return fmt.Sprintf("TIMESTAMPDIFF(%q, TIME_PARSE('%s'), TIME_PARSE('%s'))", unit, t1.Format(time.RFC3339), t2.Format(time.RFC3339)), nil
case DialectDuckDB:
case DialectDuckDB, DialectStarRocks:
return fmt.Sprintf("DATEDIFF('%s', TIMESTAMP '%s', TIMESTAMP '%s')", unit, t1.Format(time.RFC3339), t2.Format(time.RFC3339)), nil
case DialectPinot:
return fmt.Sprintf("DATEDIFF('%s', %d, %d)", unit, t1.UnixMilli(), t2.UnixMilli()), nil
Expand All @@ -604,7 +616,7 @@ func (d Dialect) DateDiff(grain runtimev1.TimeGrain, t1, t2 time.Time) (string,

func (d Dialect) IntervalSubtract(tsExpr, unitExpr string, grain runtimev1.TimeGrain) (string, error) {
switch d {
case DialectClickHouse, DialectDruid, DialectDuckDB:
case DialectClickHouse, DialectDruid, DialectDuckDB, DialectStarRocks:
return fmt.Sprintf("(%s - INTERVAL (%s) %s)", tsExpr, unitExpr, d.ConvertToDateTruncSpecifier(grain)), nil
case DialectPinot:
return fmt.Sprintf("CAST((dateAdd('%s', -1 * %s, %s)) AS TIMESTAMP)", d.ConvertToDateTruncSpecifier(grain), unitExpr, tsExpr), nil
Expand Down Expand Up @@ -650,6 +662,18 @@ func (d Dialect) SelectTimeRangeBins(start, end time.Time, grain runtimev1.TimeG
}
sb.WriteString(fmt.Sprintf(") t (%s)", d.EscapeIdentifier(alias)))
return sb.String(), args, nil
case DialectStarRocks:
// StarRocks uses UNION ALL for generating time series
var sb strings.Builder
first := true
for t := start; t != end; t = timeutil.OffsetTime(t, g, 1, tz) {
if !first {
sb.WriteString(" UNION ALL ")
}
sb.WriteString(fmt.Sprintf("SELECT CAST('%s' AS DATETIME) AS %s", t.Format(time.DateTime), d.EscapeIdentifier(alias)))
first = false
}
return sb.String(), nil, nil
default:
return "", nil, fmt.Errorf("unsupported dialect %q", d)
}
Expand Down Expand Up @@ -847,6 +871,8 @@ func (d Dialect) GetTimeExpr(t time.Time) (bool, string) {
return true, fmt.Sprintf("CAST('%s' AS TIMESTAMP)", t.Format(time.RFC3339Nano))
case DialectPinot:
return true, fmt.Sprintf("CAST(%d AS TIMESTAMP)", t.UnixMilli())
case DialectStarRocks:
return true, fmt.Sprintf("CAST('%s' AS DATETIME)", t.Format(time.DateTime))
default:
return false, ""
}
Expand Down
Loading
Loading