mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-07-04 21:10:37 +00:00
* fix(query): push down join filters before MergeScan Signed-off-by: discord9 <discord9@163.com> * fix(query): run optimizer before MergeScan pushdown Signed-off-by: discord9 <discord9@163.com> * fix(query): narrow pre-MergeScan filter pushdown Signed-off-by: discord9 <discord9@163.com> * fix(query): refine pre-MergeScan optimizer prepass Signed-off-by: discord9 <discord9@163.com> * fix(query): satisfy predicate extractor clippy Signed-off-by: discord9 <discord9@163.com> * test(query): cover pre-MergeScan optimizer edges Signed-off-by: discord9 <discord9@163.com> * test(query): cover set comparison prepass Signed-off-by: discord9 <discord9@163.com> * fix(query): guard remote scan filter pushdown Signed-off-by: discord9 <discord9@163.com> * fix(query): preserve subquery planning errors Signed-off-by: discord9 <discord9@163.com> * fix(query): preserve usable scan predicates Signed-off-by: discord9 <discord9@163.com> * fix(query): simplify scan predicate extraction Signed-off-by: discord9 <discord9@163.com> * fix(query): keep scan filter extraction scoped Signed-off-by: discord9 <discord9@163.com> * docs(query): explain pre-MergeScan optimizer Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com>
45 lines
1.3 KiB
SQL
45 lines
1.3 KiB
SQL
-- Document the current aliased SQL LATERAL limitation and guard the remote
|
|
-- scan boundary. DataFusion's DecorrelateLateralJoin does not currently match
|
|
-- the SubqueryAlias(Subquery) shape produced by `LATERAL (...) d`, so this query
|
|
-- is still expected to fail physical planning with an outer_ref expression. The
|
|
-- important regression assertion is that the remaining outer_ref predicate must
|
|
-- NOT be advertised as a remote TableScan.partial_filters predicate.
|
|
|
|
CREATE TABLE lateral_fact (
|
|
ts TIMESTAMP(3) TIME INDEX,
|
|
k STRING,
|
|
val DOUBLE,
|
|
PRIMARY KEY (k)
|
|
) ENGINE = mito;
|
|
|
|
CREATE TABLE lateral_dim (
|
|
ts TIMESTAMP(3) TIME INDEX,
|
|
k STRING,
|
|
threshold DOUBLE,
|
|
PRIMARY KEY (k)
|
|
) ENGINE = mito;
|
|
|
|
INSERT INTO lateral_fact VALUES
|
|
('2024-01-30 00:00:00', 'a', 10.0),
|
|
('2024-01-30 01:00:00', 'b', 20.0);
|
|
|
|
INSERT INTO lateral_dim VALUES
|
|
('2024-01-30 00:00:00', 'a', 5.0),
|
|
('2024-01-30 01:00:00', 'b', 25.0);
|
|
|
|
ADMIN FLUSH_TABLE('lateral_fact');
|
|
ADMIN FLUSH_TABLE('lateral_dim');
|
|
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
EXPLAIN SELECT f.k, d.threshold
|
|
FROM lateral_fact f,
|
|
LATERAL (
|
|
SELECT threshold FROM lateral_dim d WHERE d.k = f.k
|
|
) d
|
|
WHERE f.val > d.threshold
|
|
ORDER BY f.k;
|
|
|
|
DROP TABLE lateral_fact;
|
|
DROP TABLE lateral_dim;
|