Closed liuyehcf closed 2 years ago
CREATE DATABASE IF NOT EXISTS `analytic`; DROP TABLE IF EXISTS `analytic`.`t0`; CREATE TABLE IF NOT EXISTS `analytic`.`t0` ( `v1` int(11) NOT NULL, `v2` int(11) NOT NULL, `v3` int(11) NOT NULL ) ENGINE=OLAP DUPLICATE KEY(`v1`) DISTRIBUTED BY HASH(`v1`) BUCKETS 10 PROPERTIES ( "replication_num" = "1" ); INSERT INTO `analytic`.`t0` (v1, v2, v3) values (1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 4), (1, 2, 5), (1, 2, 6), (2, 3, 7), (2, 3, 8), (2, 3, 9), (2, 4, 10), (2, 4, 11), (2, 4, 12); SELECT AVG(v1) OVER (ORDER BY v2 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) AS wv, v1, v2 FROM analytic.t0 ORDER BY v2;
+-----+----+----+ | wv | v1 | v2 | +-----+----+----+ | 1.0 | 1 | 1 | | 1.0 | 1 | 1 | | 1.0 | 1 | 1 | | 1.0 | 1 | 2 | | 1.0 | 1 | 2 | | 1.0 | 1 | 2 | | 1.5 | 2 | 3 | | 1.5 | 2 | 3 | | 1.5 | 2 | 3 | | 1.5 | 2 | 4 | | 1.5 | 2 | 4 | | 1.5 | 2 | 4 | +-----+----+----+
+--------------------+------+------+ | wv | v1 | v2 | +--------------------+------+------+ | 1 | 1 | 1 | | 1 | 1 | 1 | | 1 | 1 | 1 | | 1 | 1 | 2 | | 1 | 1 | 2 | | 1 | 1 | 2 | | 1.3333333333333333 | 2 | 3 | | 1.3333333333333333 | 2 | 3 | | 1.3333333333333333 | 2 | 3 | | 1.5 | 2 | 4 | | 1.5 | 2 | 4 | | 1.5 | 2 | 4 | +--------------------+------+------+
select current_version()
+-------------------+ | current_version() | +-------------------+ | UNKNOWN 6f3a93f08 | +-------------------+
I misunderstood the meaning of CURRENT ROW in range window
CURRENT ROW
There is no bug here, just close
Steps to reproduce the behavior (Required)
Expected behavior (Required)
Real behavior (Required)
StarRocks version (Required)
select current_version()