Files
jeremyhi 03b304522f refactor: model distributed inspect fan-in as exec (#8447)
* refactor: model distributed inspect fan-in as exec

Signed-off-by: jeremyhi <fengjiachun@gmail.com>

* fix: harden distributed inspect exec fan-in

Signed-off-by: jeremyhi <fengjiachun@gmail.com>

* fix: show distributed inspect scan in plans

Signed-off-by: jeremyhi <fengjiachun@gmail.com>

* fix: stabilize distributed inspect sqlness

Signed-off-by: jeremyhi <fengjiachun@gmail.com>

* fix: apply sqlness replacement to inspect explain

Signed-off-by: jeremyhi <fengjiachun@gmail.com>

* fix: redact inspect repartition plan

Signed-off-by: jeremyhi <fengjiachun@gmail.com>

---------

Signed-off-by: jeremyhi <fengjiachun@gmail.com>
2026-07-10 08:53:23 +00:00

101 lines
7.6 KiB
Plaintext

CREATE TABLE ssts_limit_case (
a INT PRIMARY KEY INVERTED INDEX,
b STRING SKIPPING INDEX,
c STRING FULLTEXT INDEX,
ts TIMESTAMP TIME INDEX,
)
PARTITION ON COLUMNS (a) (
a < 1000,
a >= 1000 AND a < 2000,
a >= 2000
);
Affected Rows: 0
INSERT INTO ssts_limit_case VALUES
(500, 'a', 'a', 1),
(1500, 'b', 'b', 2),
(2500, 'c', 'c', 3);
Affected Rows: 3
ADMIN FLUSH_TABLE('ssts_limit_case');
+--------------------------------------+
| ADMIN FLUSH_TABLE('ssts_limit_case') |
+--------------------------------------+
| 0 |
+--------------------------------------+
SELECT COUNT(DISTINCT node_id) > 1 AS has_multi_datanodes
FROM information_schema.ssts_manifest;
+---------------------+
| has_multi_datanodes |
+---------------------+
| true |
+---------------------+
SELECT COUNT(*) AS limited_rows
FROM (
SELECT region_id
FROM information_schema.ssts_manifest
LIMIT 1
);
+--------------+
| limited_rows |
+--------------+
| 1 |
+--------------+
SELECT COUNT(*) AS filtered_limited_rows
FROM (
SELECT region_id
FROM information_schema.ssts_manifest
WHERE region_id > 0
LIMIT 1
);
+-----------------------+
| filtered_limited_rows |
+-----------------------+
| 1 |
+-----------------------+
-- SQLNESS REPLACE (RepartitionExec:.*) RepartitionExec: REDACTED
EXPLAIN SELECT COUNT(*) AS filtered_limited_rows
FROM (
SELECT region_id
FROM information_schema.ssts_manifest
WHERE table_id > 0
LIMIT 1
);
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| plan_type | plan |
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| logical_plan | MergeScan [is_placeholder=false, remote_input=[ |
| | Projection: count(Int64(1)) AS count(*) AS filtered_limited_rows |
| | Aggregate: groupBy=[[]], aggr=[[count(Int64(1))]] |
| | Limit: skip=0, fetch=1 |
| | Projection: information_schema.ssts_manifest.region_id |
| | Filter: information_schema.ssts_manifest.table_id > UInt32(0) |
| | TableScan: information_schema.ssts_manifest, partial_filters=[information_schema.ssts_manifest.table_id > UInt32(0)] |
| | ]] |
| physical_plan | ProjectionExec: expr=[count(Int64(1))@0 as filtered_limited_rows] |
| | AggregateExec: mode=Final, gby=[], aggr=[count(Int64(1))] |
| | CoalescePartitionsExec |
| | AggregateExec: mode=Partial, gby=[], aggr=[count(Int64(1))] |
| | CoalescePartitionsExec: fetch=1 |
| | FilterExec: table_id@0 > 0, projection=[], fetch=1 |
| | RepartitionExec: REDACTED
| | DistributedInspectExec: kind=SstManifest, scan=ScanRequest { projection: ProjectionInput { projection: [2], nested_paths: [] }, filters: [table_id > UInt32(0)] }, schema=Schema { fields: [Field { name: "table_id", data_type: UInt32 }], metadata: {"greptime:version": "0"} } |
| | |
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
DROP TABLE ssts_limit_case;
Affected Rows: 0