StarRocks/starrocks

Support Query ClickHouse AggregatingMergeTree Engine Table.

Open

#53 950 ouverte le 15 déc. 2024

Voir sur GitHub
 (5 commentaires) (0 réactions) (2 assignés)Java (1 246 forks)batch import
good first issuetype/enhancement

Métriques du dépôt

Stars
 (5 717 stars)
Métriques de merge PR
 (Merge moyen 1j 5h) (1 000 PRs mergées en 30 j)

Description

Enhancement

StarRocks as Query Engine

Our team is trying to use StarRocks as a unified query engine layer. We are encountering issues when querying materialized views in ClickHouse.

e.g.

ClickHouse

CREATE DATABASE db0;
CREATE TABLE db0.simple (id UInt64, val SimpleAggregateFunction(sum, UInt64)) ENGINE=AggregatingMergeTree() ORDER BY id;
INSERT INTO db0.simple(id, val) VALUES (1, 10),(1, 11),(2, 12);

Expected Result

ClickHouse :) select id, sum(val) from db0.simple GROUP BY id;

SELECT
    id,
    sum(val)
FROM db0.simple
GROUP BY id

Query id: da27ce92-1f98-4790-9a3d-00f5e9d72b03

   ┌─id─┬─sum(val)─┐
1. │  2 │       12 │
2. │  1 │       21 │
   └────┴──────────┘

2 rows in set. Elapsed: 0.004 sec.

StarRocks

CREATE EXTERNAL CATALOG clickhouse
COMMENT 'example'
PROPERTIES
(
    "type"="jdbc", 
    "user"="default",
    "password"="",
    "jdbc_uri"="jdbc:clickhouse:[your ClickHouse address]:8123",
    "driver_url"="file:///[url]/clickhouse-jdbc-0.7.1-all.jar",
    "driver_class"="com.clickhouse.jdbc.ClickHouseDriver"
);

Query ClickHouse table from StarRocks

SELECT id, sum(val) FROM clickhouse.db0.simple GROUP BY id;

Got Error:

ERROR 1064 (HY000): Getting analyzing error. Detail message: Datatype of external table column [val] is not supported!.

Features Required

  1. Support AggregateFuntion types
  2. Support Aggregation pushdown

Guide contributeur