StarRocks / starrocks

The world's fastest open query engine for sub-second analytics both on and off the data lakehouse. With the flexibility to support nearly any scenario, StarRocks provides best-in-class performance for multi-dimensional analytics, real-time analytics, and ad-hoc queries. A Linux Foundation project.
https://starrocks.io
Apache License 2.0
8.9k stars 1.78k forks source link

invalid memory used #8682

Closed wanpengfei-git closed 1 year ago

wanpengfei-git commented 2 years ago

Steps to reproduce the behavior (Required)

DROP DATABASE IF EXISTS v2;
CREATE DATABASE v2;
USE v2;
admin set frontend config ("enable_decimal_v3" = "true");
CREATE TABLE IF NOT EXISTS t0 (c_0_0 DATE NOT NULL ,c_0_1 DATE NOT NULL ,c_0_2 CHAR(21) REPLACE_IF_NOT_NULL NULL ,c_0_3 BOOLEAN REPLACE NOT NULL ,c_0_4 HLL HLL_UNION NULL ,c_0_5 DECIMAL(31, 3)  REPLACE_IF_NOT_NULL NULL ,c_0_6 PERCENTILE PERCENTILE_UNION NOT NULL ,c_0_7 SMALLINT MAX NOT NULL ,c_0_8 DATETIME REPLACE_IF_NOT_NULL NULL ,c_0_9 DOUBLE MIN NOT NULL ,c_0_10 DATE MIN NULL ,c_0_11 PERCENTILE PERCENTILE_UNION NULL ,c_0_12 HLL HLL_UNION NULL ,c_0_13 DECIMAL(27, 9)  MAX NOT NULL ) AGGREGATE KEY (c_0_0,c_0_1) PARTITION BY RANGE(c_0_0) (START ("2010-01-01") END ("2021-12-31") EVERY (INTERVAL 438 day)) DISTRIBUTED BY HASH (c_0_0) BUCKETS 3 properties("replication_num"="3") ;
CREATE TABLE IF NOT EXISTS t1 (c_1_0 DATE NOT NULL ,c_1_1 DECIMAL(14, 9)  NOT NULL ,c_1_2 BOOLEAN NULL ,c_1_3 DATE NULL ,c_1_4 ARRAY<STRING> NOT NULL ,c_1_5 CHAR(11) NULL ,c_1_6 JSON NULL ) DUPLICATE KEY (c_1_0,c_1_1,c_1_2,c_1_3) PARTITION BY RANGE(c_1_0) (START ("2010-01-01") END ("2021-12-31") EVERY (INTERVAL 175 day)) DISTRIBUTED BY HASH (c_1_2,c_1_3,c_1_1) BUCKETS 3 properties("replication_num"="3") ;
INSERT INTO t1 VALUES ('2010-01-06', 0.000044368, false, '2010-01-13', ["", "L", "E", "gXhSrQ", "BI"], 'hr', parse_json('{"CNoH8HMG": 0.9272639621219243, "1": "A", "b": null, "x0H2Tj": "sHm", "n2": false}'));
INSERT INTO t0 VALUES ('2010-01-14', '2010-01-16', '0l', false, hll_hash('ANNFXyG'), 7272102684886177647038962.845, percentile_hash('880920983'), 9, '2009-12-31 08:00:14', 0.7972793645427398, '2010-01-18', percentile_hash('2081318301'), hll_hash('puUc'), 889397988.226272608), ('2010-01-23', '2010-01-04', '', true, hll_hash('xHSY'), 1587068380821120651491540.343, percentile_hash('1671511558'), 11, '2010-01-06 08:00:14', 0.740027695839964, '2010-01-27', percentile_hash('2136103336'), hll_hash('q8'), 536887314.886691624);
DELETE FROM t0 WHERE c_0_1='1970-01-05' AND c_0_0='1970-01-25';
INSERT INTO t0 VALUES ('2010-01-18', '2010-01-23', 'G', false, hll_hash(''), 6738909548863555089015520.138, percentile_hash('-1421667038'), 1, '2010-01-03 08:00:14', 0.5545530549834534, '2010-01-12', percentile_hash('731450677'), hll_hash('WGUo09oF'), 702767599.271111889), ('2010-01-19', '2010-01-15', '', true, hll_hash(''), 3549648732621000869480454.298, percentile_hash('-2124731087'), 12, '2009-12-31 08:00:14', 0.9617326959384124, '2010-01-27', percentile_hash('724360893'), hll_hash('n5mD'), 70174385.622061679);
INSERT INTO t1 VALUES ('2010-01-03', 0.000072681, true, '2010-01-04', ["gz0", "mbS", "7", "", "", "I7", "", "J", "wqB", "lppNqvE", "h28Au", "", "4", "as3Xu8MPJ", "t"], 'lY', parse_json('{"p2B": "7Z", "wY": 0.4206925525170746, "2V": 496649821, "2vZEMNR": 1314053792, "ZhH6vO0k": null, "gbl2": false, "9k": -1879512384, "UQo": "6TzJGh5", "S": false, "t": "6", "QMlz8YsS": {"jUK": -1810075261, "G": 0.4206925525170746, "H": null, "O0VmLXoO": 0.3425403912375834, "BL": null, "l": true, "zPZy": null, "AyfzUWaW": 0.27193398550976666, "P": false, "sVurJk": "na0pqn5", "vu3PnJA": "", "7": -1525966388, "TmT": true}, "VQ": null, "xT": null}'));
INSERT INTO t1 VALUES ('2010-01-04', 0.000085902, true, '2010-01-30', ["4CpzBBe3"], 'IG', parse_json('{"6W": 1671511558, "6do": 1959723862, "iuA": false, "5EO7vS": "", "IebbaQT6q": false, "x": null, "rAvGD8lcz": 1.314053792E9, "ke": false, "OK": 0.5463525851223897, "GYa": true, "3bn": null}')), ('2010-01-31', 0.000060400, false, '2010-01-09', ["", "C", "Bw5YBaE", "lD5p", "D", "N", "Ux", "5gI", "9", "3o", "Fa6Jdjkj", "ei9V"], 'tcY', parse_json('{"Qt": -325214822, "nyP": false, "K": null, "aorjK": false, "O": 0.8049592428848077, "F7y8": null, "6zU": true, "Bs": 229319099, "1": "Ski1h", "5": null, "8urXnm": false, "f3zzYYiFY": "Y", "i7SM": 0.1203559837521444, "z": null}'));
INSERT INTO t0 VALUES ('2010-01-23', '2010-01-26', 'r', true, hll_hash(''), 2011836309222596038681629.693, percentile_hash('1737747762'), 14, '2010-01-11 08:00:14', 0.05458613644151589, '2010-01-15', percentile_hash('-466264024'), hll_hash('X'), 914587571.818807287), ('2010-01-14', '2010-01-17', '4MGtr', false, hll_hash('S0'), 6604758566630249713158562.485, percentile_hash('731450677'), 12, '2010-01-05 08:00:14', 0.41906235420357785, '2010-01-21', percentile_hash('-937585422'), hll_hash('ltA'), 463594932.149096401);
CREATE VIEW v0 AS WITH with_t_0 as (SELECT t1_422.c_1_0, t1_422.c_1_1, t1_422.c_1_2, t1_422.c_1_3, t1_422.c_1_5 FROM t1 AS t1_422 WHERE (DAYNAME('1970-01-16') )  BETWEEN (CAST(["pR", "", "MQ", "X", "xbR", "f", "4E", "ZJl0N", "Cv", "H", "kFXFCS", "va", ""] AS STRING ) ) AND ((('Bc')||('E')))  ORDER BY t1_422.c_1_2 DESC) , with_t_1 as (SELECT t0_421.c_0_0, t0_421.c_0_1, t0_421.c_0_2, t0_421.c_0_3, t0_421.c_0_5, t0_421.c_0_7, t0_421.c_0_8, t0_421.c_0_9, t0_421.c_0_10, t0_421.c_0_13 FROM t0 AS t0_421) SELECT subwith_t_1.c_0_0 FROM  (SELECT t1_422.c_1_0, t1_422.c_1_1, t1_422.c_1_2, t1_422.c_1_3, t1_422.c_1_5 FROM t1 AS t1_422) subt1 RIGHT SEMI JOIN t0 AS t0_421 ON subt1.c_1_5 = t0_421.c_0_1 AND (('6')||('')) = t0_421.c_0_1,  with_t_0 AS with_t_0 RIGHT JOIN (SELECT with_t_1.c_0_0, with_t_1.c_0_1, with_t_1.c_0_2, with_t_1.c_0_3, with_t_1.c_0_5, with_t_1.c_0_7, with_t_1.c_0_8, with_t_1.c_0_9, with_t_1.c_0_10, with_t_1.c_0_13 FROM with_t_1 AS with_t_1 WHERE  ( '' ) < ( with_t_1.c_0_2 ) ) subwith_t_1 ON with_t_0.c_1_1 = subwith_t_1.c_0_5 AND with_t_0.c_1_1 = subwith_t_1.c_0_5;
CREATE VIEW v0 AS SELECT subt1.c_1_0 FROM  (SELECT t0_423.c_0_0, t0_423.c_0_1, t0_423.c_0_2, t0_423.c_0_3, t0_423.c_0_5, t0_423.c_0_7, t0_423.c_0_8, t0_423.c_0_9, t0_423.c_0_10, t0_423.c_0_13 FROM t0 AS t0_423 WHERE ((t0_423.c_0_12) IS NULL)) subt0 RIGHT SEMI JOIN (SELECT t1_424.c_1_0, t1_424.c_1_1, t1_424.c_1_2, t1_424.c_1_3, t1_424.c_1_5 FROM t1 AS t1_424 WHERE true ORDER BY DAYNAME('1969-12-10') ) subt1 ON subt0.c_0_2 = subt1.c_1_5 AND subt0.c_0_2 = subt1.c_1_5 AND subt0.c_0_2 >= subt1.c_1_2 AND subt0.c_0_2 = subt1.c_1_2;
CREATE VIEW v76 AS SELECT t0_425.c_0_0 FROM t0 AS t0_425;
CREATE VIEW v0 AS SELECT t0_425.c_0_0 FROM t0 AS t0_425 WHERE (NOT (false));
CREATE VIEW v1 AS SELECT t0_425.c_0_0 FROM t0 AS t0_425 WHERE (NOT ((NOT (false))));
CREATE VIEW v2 AS SELECT t0_425.c_0_0 FROM t0 AS t0_425 WHERE (((NOT (false))) IS NULL);
CREATE VIEW v3 AS (SELECT t0_425.c_0_0 FROM t0 AS t0_425 WHERE (NOT (false))) UNION ALL (SELECT t0_425.c_0_0 FROM t0 AS t0_425 WHERE (NOT ((NOT (false))))) UNION ALL (SELECT t0_425.c_0_0 FROM t0 AS t0_425 WHERE (((NOT (false))) IS NULL));
CREATE VIEW v4 AS SELECT t1_446.c_1_0 FROM t1 AS t1_446, v1 AS v1_448, v2 AS v2_449, t0 AS t0_445, v0 AS v0_447, v76 AS v76_451, v3 AS v3_450;
CREATE VIEW v5 AS SELECT t1_446.c_1_0 FROM t1 AS t1_446, v1 AS v1_448, v2 AS v2_449, t0 AS t0_445, v0 AS v0_447, v76 AS v76_451, v3 AS v3_450 WHERE (NOT ( ( t1_446.c_1_3 ) > ( t1_446.c_1_3 ) ));
CREATE VIEW v6 AS SELECT t1_446.c_1_0 FROM t1 AS t1_446, v1 AS v1_448, v2 AS v2_449, t0 AS t0_445, v0 AS v0_447, v76 AS v76_451, v3 AS v3_450 WHERE (NOT ((NOT ( ( t1_446.c_1_3 ) > ( t1_446.c_1_3 ) ))));
CREATE VIEW v7 AS SELECT t1_446.c_1_0 FROM t1 AS t1_446, v1 AS v1_448, v2 AS v2_449, t0 AS t0_445, v0 AS v0_447, v76 AS v76_451, v3 AS v3_450 WHERE (((NOT ( ( t1_446.c_1_3 ) > ( t1_446.c_1_3 ) ))) IS NULL);
CREATE VIEW v8 AS (SELECT t1_446.c_1_0 FROM t1 AS t1_446, v1 AS v1_448, v2 AS v2_449, t0 AS t0_445, v0 AS v0_447, v76 AS v76_451, v3 AS v3_450 WHERE (NOT ( ( t1_446.c_1_3 ) > ( t1_446.c_1_3 ) ))) UNION ALL (SELECT t1_446.c_1_0 FROM t1 AS t1_446, v1 AS v1_448, v2 AS v2_449, t0 AS t0_445, v0 AS v0_447, v76 AS v76_451, v3 AS v3_450 WHERE (NOT ((NOT ( ( t1_446.c_1_3 ) > ( t1_446.c_1_3 ) ))))) UNION ALL (SELECT t1_446.c_1_0 FROM t1 AS t1_446, v1 AS v1_448, v2 AS v2_449, t0 AS t0_445, v0 AS v0_447, v76 AS v76_451, v3 AS v3_450 WHERE (((NOT ( ( t1_446.c_1_3 ) > ( t1_446.c_1_3 ) ))) IS NULL));
CREATE VIEW v9 AS SELECT v0_492.c_0_0 FROM v0 AS v0_492, v4 AS v4_496, t0 AS t0_490;
CREATE VIEW v10 AS SELECT v0_492.c_0_0 FROM v0 AS v0_492, v4 AS v4_496, t0 AS t0_490 WHERE true;
CREATE VIEW v11 AS SELECT v0_492.c_0_0 FROM v0 AS v0_492, v4 AS v4_496, t0 AS t0_490 WHERE (NOT (true));
CREATE VIEW v12 AS SELECT v0_492.c_0_0 FROM v0 AS v0_492, v4 AS v4_496, t0 AS t0_490 WHERE ((true) IS NULL);
CREATE VIEW v13 AS (SELECT v0_492.c_0_0 FROM v0 AS v0_492, v4 AS v4_496, t0 AS t0_490 WHERE true) UNION ALL (SELECT v0_492.c_0_0 FROM v0 AS v0_492, v4 AS v4_496, t0 AS t0_490 WHERE (NOT (true))) UNION ALL (SELECT v0_492.c_0_0 FROM v0 AS v0_492, v4 AS v4_496, t0 AS t0_490 WHERE ((true) IS NULL));
CREATE VIEW v14 AS SELECT v76_574.c_0_0 FROM v76 AS v76_574, t1 AS t1_561, v12 AS v12_566, v9 AS v9_576, v10 AS v10_564, v8 AS v8_575, v3 AS v3_569, v11 AS v11_565, t0 AS t0_560, v13 AS v13_567, v6 AS v6_572, v2 AS v2_568;
CREATE VIEW v15 AS SELECT v76_574.c_0_0 FROM v76 AS v76_574, t1 AS t1_561, v12 AS v12_566, v9 AS v9_576, v10 AS v10_564, v8 AS v8_575, v3 AS v3_569, v11 AS v11_565, t0 AS t0_560, v13 AS v13_567, v6 AS v6_572, v2 AS v2_568 WHERE NULL_OR_EMPTY('')  ORDER BY t0_560.c_0_5, t1_561.c_1_2 ASC;
CREATE VIEW v16 AS SELECT v76_574.c_0_0 FROM v76 AS v76_574, t1 AS t1_561, v12 AS v12_566, v9 AS v9_576, v10 AS v10_564, v8 AS v8_575, v3 AS v3_569, v11 AS v11_565, t0 AS t0_560, v13 AS v13_567, v6 AS v6_572, v2 AS v2_568 WHERE (NOT (NULL_OR_EMPTY('') )) ORDER BY t0_560.c_0_5, t1_561.c_1_2 ASC;
CREATE VIEW v17 AS SELECT v76_574.c_0_0 FROM v76 AS v76_574, t1 AS t1_561, v12 AS v12_566, v9 AS v9_576, v10 AS v10_564, v8 AS v8_575, v3 AS v3_569, v11 AS v11_565, t0 AS t0_560, v13 AS v13_567, v6 AS v6_572, v2 AS v2_568 WHERE ((NULL_OR_EMPTY('') ) IS NULL) ORDER BY t0_560.c_0_5, t1_561.c_1_2 ASC;
mysql> SELECT * FROM v15;
ERROR 1064 (HY000): Memory of query_pool exceed limit. try consume:2147483648 Used: 42223130088, Limit: 43058125503. Mem usage has exceed the limit of query pool

But when i run this query after this table created 10h later, it run success.
mysql> use v2
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> SELECT * FROM v15;
Empty set (0.66 sec)

please check if the error occured by the statistics?

StarRocks version (Required)

github-actions[bot] commented 1 year ago

We have marked this issue as stale because it has been inactive for 6 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to StarRocks!