Files
greptimedb/tests/cases/standalone/limit/limit.result
discord9 ac6d68aa2d fix: simp expr recursively (#7523)
* fix: simp expr recursively

Signed-off-by: discord9 <discord9@163.com>

* test: some simple constant folding case

Signed-off-by: discord9 <discord9@163.com>

* fix: literal ts cast to UTC

Signed-off-by: discord9 <discord9@163.com>

* fix: patch merge scan batch col tz instead

Signed-off-by: discord9 <discord9@163.com>

* test: fix

Signed-off-by: discord9 <discord9@163.com>

---------

Signed-off-by: discord9 <discord9@163.com>
2026-01-07 09:22:26 +00:00

69 lines
3.4 KiB
Plaintext

SELECT * FROM (SELECT SUM(number) FROM numbers LIMIT 100000000000) LIMIT 0;
++
++
EXPLAIN SELECT * FROM (SELECT SUM(number) FROM numbers LIMIT 100000000000) LIMIT 0;
+---------------+-------------------------------------------------------------------------------+
| plan_type | plan |
+---------------+-------------------------------------------------------------------------------+
| logical_plan | MergeScan [is_placeholder=false, remote_input=[ |
| | Limit: skip=0, fetch=0 |
| | Projection: sum(numbers.number) |
| | Limit: skip=0, fetch=100000000000 |
| | Projection: sum(numbers.number) |
| | Aggregate: groupBy=[[]], aggr=[[sum(CAST(numbers.number AS UInt64))]] |
| | TableScan: numbers |
| | ]] |
| physical_plan | EmptyExec |
| | |
+---------------+-------------------------------------------------------------------------------+
EXPLAIN SELECT * FROM (SELECT SUM(number) FROM numbers LIMIT 100000000000) WHERE 1=0;
+---------------+-------------------------------------------------------------------------------+
| plan_type | plan |
+---------------+-------------------------------------------------------------------------------+
| logical_plan | MergeScan [is_placeholder=false, remote_input=[ |
| | Projection: sum(numbers.number) |
| | Filter: Boolean(false) |
| | Limit: skip=0, fetch=100000000000 |
| | Projection: sum(numbers.number) |
| | Aggregate: groupBy=[[]], aggr=[[sum(CAST(numbers.number AS UInt64))]] |
| | TableScan: numbers |
| | ]] |
| physical_plan | EmptyExec |
| | |
+---------------+-------------------------------------------------------------------------------+
CREATE TABLE test (a TIMESTAMP TIME INDEX, b INTEGER);
Affected Rows: 0
INSERT INTO test VALUES (11, 23), (12, 21), (13, 22);
Affected Rows: 3
SELECT a FROM test LIMIT 1;
+-------------------------+
| a |
+-------------------------+
| 1970-01-01T00:00:00.011 |
+-------------------------+
SELECT b FROM test ORDER BY b LIMIT 2 OFFSET 0;
+----+
| b |
+----+
| 21 |
| 22 |
+----+
DROP TABLE test;
Affected Rows: 0