Merge pull request #58335 from lingtaolf/feature/sparkBar_alias_to_sparkbar

sparkBar as an alias to sparkbar
This commit is contained in:
Alexey Milovidov 2023-12-29 13:02:55 +01:00 committed by GitHub
commit 09181b6c37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 79 additions and 62 deletions

View File

@ -60,3 +60,5 @@ Result:
└──────────────────────────────────────────────────────────────────────────┘ └──────────────────────────────────────────────────────────────────────────┘
``` ```
The alias for this function is sparkBar.

View File

@ -378,6 +378,7 @@ AggregateFunctionPtr createAggregateFunctionSparkbar(const std::string & name, c
void registerAggregateFunctionSparkbar(AggregateFunctionFactory & factory) void registerAggregateFunctionSparkbar(AggregateFunctionFactory & factory)
{ {
factory.registerFunction("sparkbar", createAggregateFunctionSparkbar); factory.registerFunction("sparkbar", createAggregateFunctionSparkbar);
factory.registerAlias("sparkBar", "sparkbar");
} }
} }

View File

@ -0,0 +1,2 @@
▂▅▂▃▆█ ▂
▂▅▂▃▆█ ▂

View File

@ -0,0 +1,12 @@
SET allow_experimental_analyzer = 1;
DROP TABLE IF EXISTS spark_bar_test;
CREATE TABLE spark_bar_test (`value` Int64, `event_date` Date) ENGINE = MergeTree ORDER BY event_date;
INSERT INTO spark_bar_test VALUES (1,'2020-01-01'), (3,'2020-01-02'), (4,'2020-01-02'), (-3,'2020-01-02'), (5,'2020-01-03'), (2,'2020-01-04'), (3,'2020-01-05'), (7,'2020-01-06'), (6,'2020-01-07'), (8,'2020-01-08'), (2,'2020-01-11');
SELECT sparkbar(9)(event_date,cnt) FROM (SELECT sum(value) as cnt, event_date FROM spark_bar_test GROUP BY event_date);
SELECT sparkBar(9)(event_date,cnt) FROM (SELECT sum(value) as cnt, event_date FROM spark_bar_test GROUP BY event_date);
DROP TABLE IF EXISTS spark_bar_test;