Files
greptimedb/tests/cases/standalone/common/aggregate/empty_region_stats.sql
T
508d1a1a33 fix: backport clean must-have fixes to release/5e02efa9 (#9772)
* fix(mito2): preserve effective sequences during compaction (#9147)

* fix(mito2): preserve effective row sequences during compaction

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix(mito2): inherit compaction input sequence bounds

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

---------

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>
(cherry picked from commit e0552eee2d)
Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix(meta-client): bound heartbeat handshake timeout (#9438)

* fix(meta-client): bound heartbeat handshake timeout

Signed-off-by: Aetherance <inkToAether@gmail.com>

* chore(meta-client): fix test license header

Signed-off-by: Aetherance <inkToAether@gmail.com>

* test(meta-client): prefix heartbeat tests with test

Signed-off-by: Aetherance <inkToAether@gmail.com>

---------

Signed-off-by: Aetherance <inkToAether@gmail.com>
(cherry picked from commit 9c69e381ae)
Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix(metasrv): stop holding the pusher registry lock across mailbox sends (#9445)

fix(meta-srv): stop holding the pusher registry lock across mailbox sends

Signed-off-by: lczllx <2181719471@qq.com>
(cherry picked from commit 7605f27608)
Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix(mito2): ignore missing inverted indexes in old SSTs (#9545)

Signed-off-by: WenyXu <wenymedia@gmail.com>
(cherry picked from commit 287ced2de2)
Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix: prevent stale leader metadata after concurrent writes (#9549)

fix: fence leader cache fills around store mutations

Signed-off-by: jeremyhi <fengjiachun@gmail.com>
(cherry picked from commit 394562aa9e)
Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix(query): accept narrowed nullability in MergeScan remote schema check (#9592)

On append-mode tables a region reports an exact row count. When it is
zero, DataFusion's AggregateStatistics replaces the region-side
__min_state/__max_state aggregate with a non-null struct literal, so the
remote stream advertises the state column as non-nullable. The MergeScan
schema check required equal nullability and failed the query.

Accept a remote field that is non-nullable where the expected field is
nullable, matching DataFusion's own physical-plan schema invariant.
Batches are already rebuilt with the expected schema. Widening is still
rejected, and nested field nullability is still compared exactly as part
of the data type.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
(cherry picked from commit ef1298ce02)
Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* test: regenerate missing inverted index sqlness result for release/5e02efa9

The release branch renders empty result sets as '++' instead of an empty
table with headers. Only empty-result rendering changes; rows are identical.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

---------

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>
Signed-off-by: Aetherance <inkToAether@gmail.com>
Signed-off-by: lczllx <2181719471@qq.com>
Signed-off-by: WenyXu <wenymedia@gmail.com>
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
Co-authored-by: Aether <98370028+Aetherance@users.noreply.github.com>
Co-authored-by: Dragon Roar <2181719471@qq.com>
Co-authored-by: Weny Xu <wenymedia@gmail.com>
Co-authored-by: jeremyhi <jiachun_feng@proton.me>
Co-authored-by: dennis zhuang <killme2008@gmail.com>
2026-10-20 19:27:22 +08:00

43 lines
1.1 KiB
SQL

-- Append-mode regions report exact row counts, so the datanode can answer
-- count/min/max over a region from statistics. This only happens when every
-- aggregate in the query can be answered that way.
CREATE TABLE a1 (ts TIMESTAMP(9) TIME INDEX, k STRING, v BIGINT)
PARTITION ON COLUMNS (k) (k < 'b', k >= 'b' AND k < 'c', k >= 'c')
WITH (append_mode = 'true');
-- All regions are empty.
SELECT min(v), max(v) FROM a1;
SELECT count(*), count(v) FROM a1;
INSERT INTO a1 VALUES (1000, 'a', 1), (2000, 'a', 2);
-- Two of three regions are empty.
SELECT min(v) FROM a1;
SELECT max(v) FROM a1;
SELECT min(ts), max(k) FROM a1;
SELECT count(*), count(v) FROM a1;
SELECT min(v), count(*) FROM a1;
SELECT sum(v), avg(v) FROM a1;
SELECT k, min(v), max(v), count(*) FROM a1 GROUP BY k ORDER BY k;
INSERT INTO a1 VALUES (3000, 'b', 3);
-- One of three regions is empty.
SELECT min(v), max(v) FROM a1;
SELECT k, min(v), max(v), count(*) FROM a1 GROUP BY k ORDER BY k;
INSERT INTO a1 VALUES (4000, 'c', 4);
-- No region is empty.
SELECT min(v), max(v), count(*) FROM a1;
DROP TABLE a1;