Skip to content

[Enhancement] Support Query cache in shared_data #52415

[Enhancement] Support Query cache in shared_data

[Enhancement] Support Query cache in shared_data #52415

GitHub Actions / SQL-Tester Report failed Oct 19, 2024 in 0s

777 tests run, 776 passed, 0 skipped, 1 failed.

Annotations

Check failure on line 1 in TestSQLCases

See this annotation in the file changed.

@github-actions github-actions / SQL-Tester Report

TestSQLCases.test_query_cache

Element counts were not equal:
First has 1, Second has 0:  '2022-01-03 05:00:00 z6   -49680.52'
First has 1, Second has 0:  '2022-01-03 08:00:00 Nlpz1j3h    217.58'
First has 1, Second has 0:  '2022-01-03 18:00:00 7Bh 55723.01'
First has 1, Second has 0:  '2022-01-03 19:00:00     -53084.04'
First has 0, Second has 1:  '2022-01-03 05:00:00\tz6\t-49680.52'
First has 0, Second has 1:  '2022-01-03 08:00:00\tNlpz1j3h\t217.58'
First has 0, Second has 1:  '2022-01-03 18:00:00\t7Bh\t55723.01'
First has 0, Second has 1:  '2022-01-03 19:00:00\t\t-53084.04' : sql result not match:
- [SQL]: SELECT /*+SET_VAR(enable_query_cache=true, pipeline_dop=1) */
    date_trunc('hour', ts) AS hour,
    k0,
    sum(v1) AS __c_0
FROM
    t0
WHERE
    ts between '2022-01-03 00:00:00'
    and '2022-01-03 23:59:59'
GROUP BY
    date_trunc('hour', ts),
    k0
ORDER BY
    hour;
- [exp]: ['2022-01-03 05:00:00 z6   -49680.52', '2022-01-03 08:00:00 Nlpz1j3h    217.58', '2022-01-03 18:00:00 7Bh 55723.01', '2022-01-03 19:00:00     -53084.04']
- [act]: ['2022-01-03 05:00:00\tz6\t-49680.52', '2022-01-03 08:00:00\tNlpz1j3h\t217.58', '2022-01-03 18:00:00\t7Bh\t55723.01', '2022-01-03 19:00:00\t\t-53084.04']
---
Raw output
[Stacktrace]: 
Traceback (most recent call last):
  File "/root/.pyenv/versions/3.8.19/lib/python3.8/unittest/case.py", line 60, in testPartExecutor
    yield
  File "/root/.pyenv/versions/3.8.19/lib/python3.8/unittest/case.py", line 676, in run
    self._callTestMethod(testMethod)
  File "/root/.pyenv/versions/3.8.19/lib/python3.8/unittest/case.py", line 633, in _callTestMethod
    method()
  File "/root/.pyenv/versions/3.8.19/lib/python3.8/site-packages/nose/case.py", line 170, in runTest
    self.test(*self.arg)
  File "/root/.pyenv/versions/3.8.19/lib/python3.8/site-packages/parameterized/parameterized.py", line 620, in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
  File "/home/runner/_work/starrocks/starrocks/test/lib/sql_annotation.py", line 48, in wrapper
    raise e
  File "/home/runner/_work/starrocks/starrocks/test/lib/sql_annotation.py", line 43, in wrapper
    res = func(*args, **kwargs)
  File "/home/runner/_work/starrocks/starrocks/test/test_sql_cases.py", line 384, in test_sql_basic
    self.check(sql_id, sql, expect_res, actual_res, order, ori_sql)
  File "/home/runner/_work/starrocks/starrocks/test/lib/sr_sql_lib.py", line 1480, in check
    tools.assert_count_equal(
  File "/root/.pyenv/versions/3.8.19/lib/python3.8/unittest/case.py", line 1272, in assertCountEqual
    self.fail(msg)
  File "/root/.pyenv/versions/3.8.19/lib/python3.8/unittest/case.py", line 753, in fail
    raise self.failureException(msg)
AssertionError: Element counts were not equal:
First has 1, Second has 0:  '2022-01-03 05:00:00 z6   -49680.52'
First has 1, Second has 0:  '2022-01-03 08:00:00 Nlpz1j3h    217.58'
First has 1, Second has 0:  '2022-01-03 18:00:00 7Bh 55723.01'
First has 1, Second has 0:  '2022-01-03 19:00:00     -53084.04'
First has 0, Second has 1:  '2022-01-03 05:00:00\tz6\t-49680.52'
First has 0, Second has 1:  '2022-01-03 08:00:00\tNlpz1j3h\t217.58'
First has 0, Second has 1:  '2022-01-03 18:00:00\t7Bh\t55723.01'
First has 0, Second has 1:  '2022-01-03 19:00:00\t\t-53084.04' : sql result not match:
- [SQL]: SELECT /*+SET_VAR(enable_query_cache=true, pipeline_dop=1) */
    date_trunc('hour', ts) AS hour,
    k0,
    sum(v1) AS __c_0
FROM
    t0
WHERE
    ts between '2022-01-03 00:00:00'
    and '2022-01-03 23:59:59'
GROUP BY
    date_trunc('hour', ts),
    k0
ORDER BY
    hour;
- [exp]: ['2022-01-03 05:00:00 z6   -49680.52', '2022-01-03 08:00:00 Nlpz1j3h    217.58', '2022-01-03 18:00:00 7Bh 55723.01', '2022-01-03 19:00:00     -53084.04']
- [act]: ['2022-01-03 05:00:00\tz6\t-49680.52', '2022-01-03 08:00:00\tNlpz1j3h\t217.58', '2022-01-03 18:00:00\t7Bh\t55723.01', '2022-01-03 19:00:00\t\t-53084.04']
---

[Standard Output]: 
?[1;32m------------------------------------------------------------ ?[0m
?[1;32m[case name]: test_query_cache ?[0m
?[1;32m[case file]: sql/test_query_cache/R/test_query_cache ?[0m
?[1;32m------------------------------------------------------------ ?[0m
[SQL]: CREATE DATABASE test_db_917fe2b5479d4d6da8769da363bdf5bf;
[SQL]: USE test_db_917fe2b5479d4d6da8769da363bdf5bf;
	 → case db: ['test_db_917fe2b5479d4d6da8769da363bdf5bf']
	 → case resource: []
CREATE TABLE t0
(
      `ts` datetime NOT NULL COMMENT "",
      `k0` varchar(10) NOT NULL COMMENT "",
      `k1` char(6) NOT NULL COMMENT "",
      `v0` bigint(20) NOT NULL COMMENT "",
      `v1` decimal64(7, 2) NOT NULL COMMENT ""
)
ENGINE=OLAP
DUPLICATE KEY(`ts`, `k0`, `k1`)
COMMENT "OLAP"
PARTITION BY RANGE(`ts`)
(
    START ("2022-01-01 00:00:00") END ("2022-02-01 00:00:00") EVERY (INTERVAL 1 DAY)
)
DISTRIBUTED BY HASH(`ts`, `k0`, `k1`)
PROPERTIES
(
    "replication_num" = "3",
    "storage_format" = "DEFAULT",
    "enable_persistent_index" = "false"
);
INSERT INTO t0
VALUES
    ('2022-01-11 20:42:26', 'n4AGcEqYp', 'hhbawx', '799393174109549', '8029.42'),
    ('2022-01-27 18:17:59', 'i66lt', 'mtrtzf', '100400167', '10000.88'),
    ('2022-01-28 20:10:44', 'z6', 'oqkeun', '-58681382337', '59881.87'),
    ('2022-01-29 14:54:31', 'qQ', 'dzytua', '-19682006834', '43807.02'),
    ('2022-01-31 08:08:11', 'qQ', 'dzytua', '7970665929984223925', '-8947.74'),
    ('2022-01-15 00:40:58', '65', 'hhbawx', '4054945', '156.56'),
    ('2022-01-24 16:17:51', 'onqR3JsK1', 'udtmfp', '-12962', '-72127.53'),
    ('2022-01-01 22:36:24', 'n4AGcEqYp', 'fabnct', '-50999821', '17349.85'),
    ('2022-01-21 08:41:50', 'Nlpz1j3h', 'dzytua', '-60162', '287.06'),
    ('2022-01-30 23:44:55', '', 'slfght', '62891747919627339', '8014.98'),
    ('2022-01-18 19:14:28', 'z6', 'dzytua', '-1113001726', '73258.24'),
    ('2022-01-30 14:54:59', 'z6', 'udtmfp', '111175577438857975', '-15280.41'),
    ('2022-01-08 22:08:26', 'z6', 'ympyls', '3', '2.07'),
    ('2022-01-03 08:17:29', 'Nlpz1j3h', 'udtmfp', '-234492', '217.58'),
    ('2022-01-27 07:28:47', 'Pc', 'cawanm', '-1015', '-20631.50'),
    ('2022-01-17 14:07:47', 'Nlpz1j3h', 'lbsvqu', '2295574006197343179', '93768.75'),
    ('2022-01-31 14:00:12', 'onqR3JsK1', 'umlkpo', '-227', '-66199.05'),
    ('2022-01-05 20:31:26', '65', 'lbsvqu', '684307', '36412.49'),
    ('2022-01-06 00:51:34', 'z6', 'dzytua', '11700309310', '-26064.10'),
    ('2022-01-26 02:59:00', 'n4AGcEqYp', 'slfght', '-15320250288446', '-58003.69'),
    ('2022-01-05 03:26:26', 'z6', 'cawanm', '19841055192960542', '-5634.36'),
    ('2022-01-17 08:51:23', 'Pc', 'ghftus', '35476438804110', '13625.99'),
    ('2022-01-30 18:56:03', 'n4AGcEqYp', 'lbsvqu', '3303892099598', '8.37'),
    ('2022-01-22 14:17:18', 'i66lt', 'umlkpo', '-27653110', '-82306.25'),
    ('2022-01-02 10:25:01', 'qQ', 'ghftus', '-188567166', '71442.87'),
    ('2022-01-30 04:58:14', 'Pc', 'ympyls', '-9983', '-82071.59'),
    ('2022-01-05 00:16:56', '7Bh', 'hhbawx', '43712', '84762.97'),
    ('2022-01-25 03:25:53', '65', 'mtrtzf', '4604107', '-2434.69'),
    ('2022-01-27 21:09:10', '65', 'udtmfp', '476134823953365199', '38736.04'),
    ('2022-01-11 13:35:44', '65', 'qmwhvr', '1', '0.28'),
    ('2022-01-03 19:13:07', '', 'lbsvqu', '11', '-53084.04'),
    ('2022-01-20 02:27:25', 'i66lt', 'umlkpo', '3218824416', '-71393.20'),
    ('2022-01-04 04:52:36', '7Bh', 'ghftus', '-112543071', '-78377.93'),
    ('2022-01-27 18:27:06', 'Pc', 'umlkpo', '477', '-98060.13'),
    ('2022-01-04 19:40:36', '', 'udtmfp', '433677211', '-99829.94'),
    ('2022-01-20 23:19:58', 'Nlpz1j3h', 'udtmfp', '361394977', '-19284.18'),
    ('2022-01-05 02:17:56', 'Pc', 'oqkeun', '-552390906075744662', '-25267.92'),
    ('2022-01-02 16:14:07', '65', 'dzytua', '132', '2393.77'),
    ('2022-01-28 23:17:14', 'z6', 'umlkpo', '61', '-52028.57'),
    ('2022-01-12 08:05:44', 'qQ', 'hhbawx', '-9579605666539132', '-87801.81'),
    ('2022-01-31 19:48:22', 'z6', 'lbsvqu', '9883530877822', '34006.42'),
    ('2022-01-11 20:38:41', '', 'piszhr', '56108215256366', '-74059.80'),
    ('2022-01-01 04:15:17', '65', 'cawanm', '-440061829443010909', '88960.51'),
    ('2022-01-05 07:26:09', 'qQ', 'umlkpo', '-24889917494681901', '-23372.12'),
    ('2022-01-29 18:13:55', 'Nlpz1j3h', 'cawanm', '-233', '-24294.42'),
    ('2022-01-10 00:49:45', 'Nlpz1j3h', 'ympyls', '-2396341', '77723.88'),
    ('2022-01-29 08:02:58', 'n4AGcEqYp', 'slfght', '45212', '93099.78'),
    ('2022-01-28 08:59:21', 'onqR3JsK1', 'oqkeun', '76', '-78641.65'),
    ('2022-01-26 14:29:39', '7Bh', 'umlkpo', '176003552517', '-99999.96'),
    ('2022-01-03 18:53:37', '7Bh', 'piszhr', '3906151622605106', '55723.01'),
    ('2022-01-04 07:08:19', 'i66lt', 'ympyls', '-240097380835621', '-81800.87'),
    ('2022-01-28 14:54:17', 'Nlpz1j3h', 'slfght', '-69018069110121', '90533.64'),
    ('2022-01-22 07:48:53', 'Pc', 'ympyls', '22396835447981344', '-12583.39'),
    ('2022-01-22 07:39:29', 'Pc', 'uqkghp', '10551305', '52163.82'),
    ('2022-01-08 22:39:47', 'Nlpz1j3h', 'cawanm', '67905472699', '87831.30'),
    ('2022-01-05 14:53:34', '7Bh', 'dzytua', '-779598598706906834', '-38780.41'),
    ('2022-01-30 17:34:41', 'onqR3JsK1', 'oqkeun', '346687625005524', '-62475.31'),
    ('2022-01-29 12:14:06', '', 'qmwhvr', '3315', '22076.88'),
    ('2022-01-05 06:47:04', 'Nlpz1j3h', 'udtmfp', '-469', '42747.17'),
    ('2022-01-19 15:20:20', '7Bh', 'lbsvqu', '347317095885', '-76393.49'),
    ('2022-01-08 16:18:22', 'z6', 'fghmcd', '2', '90315.60'),
    ('2022-01-02 00:23:06', 'Pc', 'piszhr', '-3651517384168400', '58220.34'),
    ('2022-01-12 08:23:31', 'onqR3JsK1', 'udtmfp', '5636394870355729225', '33224.25'),
    ('2022-01-28 10:46:44', 'onqR3JsK1', 'oqkeun', '-28102078612755', '6469.53'),
    ('2022-01-23 23:16:11', 'onqR3JsK1', 'ghftus', '-707475035515433949', '63422.66'),
    ('2022-01-03 05:32:31', 'z6', 'hhbawx', '-45', '-49680.52'),
    ('2022-01-27 03:24:33', 'qQ', 'qmwhvr', '375943906057539870', '-66092.96'),
    ('2022-01-25 20:07:22', '7Bh', 'slfght', '1', '72440.21'),
    ('2022-01-04 16:07:24', 'qQ', 'uqkghp', '751213107482249', '16417.31'),
    ('2022-01-23 19:22:00', 'Pc', 'hhbawx', '-740731249600493', '88439.40'),
    ('2022-01-05 09:04:20', '7Bh', 'cawanm', '23602', '302.44');
SELECT /*+SET_VAR(enable_query_cache=true, pipeline_dop=1) */
    date_trunc('hour', ts) AS hour,
    k0,
    sum(v1) AS __c_0
FROM
    t0
WHERE
    ts between '2022-01-03 00:00:00'
    and '2022-01-03 23:59:59'
GROUP BY
    date_trunc('hour', ts),
    k0
ORDER BY
    hour;
?[1;32m******************** [FINISH] test_query_cache ******************** ?[0m