chore: update datafusion to 50 (#7076)

* chore: update datafusion to 50

Signed-off-by: luofucong <luofc@foxmail.com>

* fix ci

Signed-off-by: luofucong <luofc@foxmail.com>

* fix: update datafusion_pg_catalog import

* chore: fix toml format

* chore: fix toml format again

* fix nextest

Signed-off-by: luofucong <luofc@foxmail.com>

* fix sqlness

Signed-off-by: luofucong <luofc@foxmail.com>

* chore: switch datafusion-orc to upstream tag

* fix sqlness

Signed-off-by: luofucong <luofc@foxmail.com>

* resolve PR comments

Signed-off-by: luofucong <luofc@foxmail.com>

---------

Signed-off-by: luofucong <luofc@foxmail.com>
Co-authored-by: Ning Sun <sunning@greptime.com>
This commit is contained in:
LFC
2025-10-23 15:18:36 +08:00
committed by GitHub
parent f388dbdbb8
commit 2f637a262e
63 changed files with 830 additions and 778 deletions

View File

@@ -203,13 +203,13 @@ SELECT * FROM (SELECT i1.i AS a, i2.i AS b, row_number() OVER (ORDER BY i1.i, i2
-- Align the result to PostgreSQL: empty.
EXPLAIN SELECT * FROM (SELECT 0=1 AS cond FROM integers i1, integers i2) a1 WHERE cond ORDER BY 1;
+---------------+---------------+
| plan_type | plan |
+---------------+---------------+
| logical_plan | EmptyRelation |
| physical_plan | EmptyExec |
| | |
+---------------+---------------+
+---------------+-----------------------+
| plan_type | plan |
+---------------+-----------------------+
| logical_plan | EmptyRelation: rows=0 |
| physical_plan | EmptyExec |
| | |
+---------------+-----------------------+
-- Align the result to PostgreSQL: empty.
SELECT * FROM (SELECT 0=1 AS cond FROM integers i1, integers i2 GROUP BY 1) a1 WHERE cond ORDER BY 1;

View File

@@ -10,13 +10,12 @@ SELECT corr(NULL,NULL);
+-----------------+
-- Single value returns NULL
-- FIXME(dennis): datafusion returns 0.0 here, should be NULL
SELECT corr(1,1);
+-------------------------+
| corr(Int64(1),Int64(1)) |
+-------------------------+
| 0.0 |
| |
+-------------------------+
-- Test with table

View File

@@ -5,7 +5,6 @@
SELECT corr(NULL,NULL);
-- Single value returns NULL
-- FIXME(dennis): datafusion returns 0.0 here, should be NULL
SELECT corr(1,1);
-- Test with table

View File

@@ -10,55 +10,55 @@ Affected Rows: 6
SELECT stddev_samp(1);
+------------------+
| stddev(Int64(1)) |
+------------------+
| |
+------------------+
+-----------------------+
| stddev_samp(Int64(1)) |
+-----------------------+
| |
+-----------------------+
SELECT var_samp(1);
+---------------+
| var(Int64(1)) |
+---------------+
| |
+---------------+
+--------------------+
| var_samp(Int64(1)) |
+--------------------+
| |
+--------------------+
-- stddev_samp
SELECT round(stddev_samp(val), 1) FROM stddev_test;
+-----------------------------------------+
| round(stddev(stddev_test.val),Int64(1)) |
+-----------------------------------------+
| 478.8 |
+-----------------------------------------+
+----------------------------------------------+
| round(stddev_samp(stddev_test.val),Int64(1)) |
+----------------------------------------------+
| 478.8 |
+----------------------------------------------+
SELECT round(stddev_samp(val), 1) FROM stddev_test WHERE val IS NOT NULL;
+-----------------------------------------+
| round(stddev(stddev_test.val),Int64(1)) |
+-----------------------------------------+
| 478.8 |
+-----------------------------------------+
+----------------------------------------------+
| round(stddev_samp(stddev_test.val),Int64(1)) |
+----------------------------------------------+
| 478.8 |
+----------------------------------------------+
SELECT grp, sum(val), round(stddev_samp(val), 1), min(val) FROM stddev_test GROUP BY grp ORDER BY grp;
+-----+----------------------+-----------------------------------------+----------------------+
| grp | sum(stddev_test.val) | round(stddev(stddev_test.val),Int64(1)) | min(stddev_test.val) |
+-----+----------------------+-----------------------------------------+----------------------+
| 1 | 85 | 0.7 | 42 |
| 2 | 1042 | 677.4 | 42 |
| 3 | | | |
+-----+----------------------+-----------------------------------------+----------------------+
+-----+----------------------+----------------------------------------------+----------------------+
| grp | sum(stddev_test.val) | round(stddev_samp(stddev_test.val),Int64(1)) | min(stddev_test.val) |
+-----+----------------------+----------------------------------------------+----------------------+
| 1 | 85 | 0.7 | 42 |
| 2 | 1042 | 677.4 | 42 |
| 3 | | | |
+-----+----------------------+----------------------------------------------+----------------------+
SELECT grp, sum(val), round(stddev_samp(val), 1), min(val) FROM stddev_test WHERE val IS NOT NULL GROUP BY grp ORDER BY grp;
+-----+----------------------+-----------------------------------------+----------------------+
| grp | sum(stddev_test.val) | round(stddev(stddev_test.val),Int64(1)) | min(stddev_test.val) |
+-----+----------------------+-----------------------------------------+----------------------+
| 1 | 85 | 0.7 | 42 |
| 2 | 1042 | 677.4 | 42 |
+-----+----------------------+-----------------------------------------+----------------------+
+-----+----------------------+----------------------------------------------+----------------------+
| grp | sum(stddev_test.val) | round(stddev_samp(stddev_test.val),Int64(1)) | min(stddev_test.val) |
+-----+----------------------+----------------------------------------------+----------------------+
| 1 | 85 | 0.7 | 42 |
| 2 | 1042 | 677.4 | 42 |
+-----+----------------------+----------------------------------------------+----------------------+
-- stddev_pop
SELECT round(stddev_pop(val), 1) FROM stddev_test;
@@ -99,38 +99,38 @@ SELECT grp, sum(val), round(stddev_pop(val), 1), min(val) FROM stddev_test WHERE
-- var_samp
SELECT round(var_samp(val), 1) FROM stddev_test;
+--------------------------------------+
| round(var(stddev_test.val),Int64(1)) |
+--------------------------------------+
| 229281.6 |
+--------------------------------------+
+-------------------------------------------+
| round(var_samp(stddev_test.val),Int64(1)) |
+-------------------------------------------+
| 229281.6 |
+-------------------------------------------+
SELECT round(var_samp(val), 1) FROM stddev_test WHERE val IS NOT NULL;
+--------------------------------------+
| round(var(stddev_test.val),Int64(1)) |
+--------------------------------------+
| 229281.6 |
+--------------------------------------+
+-------------------------------------------+
| round(var_samp(stddev_test.val),Int64(1)) |
+-------------------------------------------+
| 229281.6 |
+-------------------------------------------+
SELECT grp, sum(val), round(var_samp(val), 1), min(val) FROM stddev_test GROUP BY grp ORDER BY grp;
+-----+----------------------+--------------------------------------+----------------------+
| grp | sum(stddev_test.val) | round(var(stddev_test.val),Int64(1)) | min(stddev_test.val) |
+-----+----------------------+--------------------------------------+----------------------+
| 1 | 85 | 0.5 | 42 |
| 2 | 1042 | 458882.0 | 42 |
| 3 | | | |
+-----+----------------------+--------------------------------------+----------------------+
+-----+----------------------+-------------------------------------------+----------------------+
| grp | sum(stddev_test.val) | round(var_samp(stddev_test.val),Int64(1)) | min(stddev_test.val) |
+-----+----------------------+-------------------------------------------+----------------------+
| 1 | 85 | 0.5 | 42 |
| 2 | 1042 | 458882.0 | 42 |
| 3 | | | |
+-----+----------------------+-------------------------------------------+----------------------+
SELECT grp, sum(val), round(var_samp(val), 1), min(val) FROM stddev_test WHERE val IS NOT NULL GROUP BY grp ORDER BY grp;
+-----+----------------------+--------------------------------------+----------------------+
| grp | sum(stddev_test.val) | round(var(stddev_test.val),Int64(1)) | min(stddev_test.val) |
+-----+----------------------+--------------------------------------+----------------------+
| 1 | 85 | 0.5 | 42 |
| 2 | 1042 | 458882.0 | 42 |
+-----+----------------------+--------------------------------------+----------------------+
+-----+----------------------+-------------------------------------------+----------------------+
| grp | sum(stddev_test.val) | round(var_samp(stddev_test.val),Int64(1)) | min(stddev_test.val) |
+-----+----------------------+-------------------------------------------+----------------------+
| 1 | 85 | 0.5 | 42 |
| 2 | 1042 | 458882.0 | 42 |
+-----+----------------------+-------------------------------------------+----------------------+
-- var_pop
SELECT round(var_pop(val), 1) FROM stddev_test;

View File

@@ -25,7 +25,7 @@ Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: Execution err
-- No matching function signature
SELECT cos(0, 1, 2, 3);
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: Failed to coerce arguments to satisfy a call to 'cos' function: coercion from [Int64, Int64, Int64, Int64] to the signature Uniform(1, [Float64, Float32]) failed No function matches the given name and argument types 'cos(Int64, Int64, Int64, Int64)'. You might need to add explicit type casts.
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: Failed to coerce arguments to satisfy a call to 'cos' function: coercion from Int64, Int64, Int64, Int64 to the signature Uniform(1, [Float64, Float32]) failed No function matches the given name and argument types 'cos(Int64, Int64, Int64, Int64)'. You might need to add explicit type casts.
Candidate functions:
cos(Float64/Float32)

View File

@@ -28,27 +28,27 @@ Error: 3001(EngineExecuteQuery), Divide by zero error
SELECT POW (2, 5);
+--------------------------+
| power(Int64(2),Int64(5)) |
+--------------------------+
| 32 |
+--------------------------+
+------------------------+
| pow(Int64(2),Int64(5)) |
+------------------------+
| 32 |
+------------------------+
SELECT POW (1.01, 365);
+---------------------------------+
| power(Float64(1.01),Int64(365)) |
+---------------------------------+
| 37.78343433288728 |
+---------------------------------+
+-------------------------------+
| pow(Float64(1.01),Int64(365)) |
+-------------------------------+
| 37.78343433288728 |
+-------------------------------+
SELECT POW (0.99, 365);
+---------------------------------+
| power(Float64(0.99),Int64(365)) |
+---------------------------------+
| 0.025517964452291125 |
+---------------------------------+
+-------------------------------+
| pow(Float64(0.99),Int64(365)) |
+-------------------------------+
| 0.025517964452291125 |
+-------------------------------+
SELECT CLAMP(10, 0, 1);

View File

@@ -49,7 +49,7 @@ Error: 1001(Unsupported), This feature is not implemented: Unsupported LIMIT exp
SELECT a FROM test LIMIT row_number() OVER ();
Error: 3001(EngineExecuteQuery), This feature is not implemented: Unsupported LIMIT expression: Some(Cast(Cast { expr: WindowFunction(WindowFunction { fun: WindowUDF(WindowUDF { inner: RowNumber { signature: Signature { type_signature: Nullary, volatility: Immutable } } }), params: WindowFunctionParams { args: [], partition_by: [], order_by: [], window_frame: WindowFrame { units: Rows, start_bound: Preceding(UInt64(NULL)), end_bound: Following(UInt64(NULL)), is_causal: false }, null_treatment: None, distinct: false } }), data_type: Int64 }))
Error: 3001(EngineExecuteQuery), This feature is not implemented: Unsupported LIMIT expression: Some(Cast(Cast { expr: WindowFunction(WindowFunction { fun: WindowUDF(WindowUDF { inner: RowNumber { signature: Signature { type_signature: Nullary, volatility: Immutable } } }), params: WindowFunctionParams { args: [], partition_by: [], order_by: [], window_frame: WindowFrame { units: Rows, start_bound: Preceding(UInt64(NULL)), end_bound: Following(UInt64(NULL)), is_causal: false }, filter: None, null_treatment: None, distinct: false } }), data_type: Int64 }))
CREATE TABLE test2 (a STRING, ts TIMESTAMP TIME INDEX);

View File

@@ -23,12 +23,12 @@ Affected Rows: 10
-- Test by calculate
SELECT ts, length(host), max(val) RANGE '5s' FROM host ALIGN '20s' BY (length(host)) ORDER BY ts;
+---------------------+-----------------------------+------------------------+
| ts | character_length(host.host) | max(host.val) RANGE 5s |
+---------------------+-----------------------------+------------------------+
| 1970-01-01T00:00:00 | 5 | 3 |
| 1970-01-01T00:00:20 | 5 | 5 |
+---------------------+-----------------------------+------------------------+
+---------------------+-------------------+------------------------+
| ts | length(host.host) | max(host.val) RANGE 5s |
+---------------------+-------------------+------------------------+
| 1970-01-01T00:00:00 | 5 | 3 |
| 1970-01-01T00:00:20 | 5 | 5 |
+---------------------+-------------------+------------------------+
SELECT ts, max(val) RANGE '5s' FROM host ALIGN '20s' BY (2) ORDER BY ts;
@@ -52,12 +52,12 @@ SELECT ts, max(val) RANGE '5s' FROM host ALIGN '20s' BY () ORDER BY ts;
SELECT ts, length(host)::INT64 + 2, max(val) RANGE '5s' FROM host ALIGN '20s' BY (length(host)::INT64 + 2) ORDER BY ts;
+---------------------+------------------------------------------------------------------+------------------------+
| ts | arrow_cast(character_length(host.host),Utf8("Int64")) + Int64(2) | max(host.val) RANGE 5s |
+---------------------+------------------------------------------------------------------+------------------------+
| 1970-01-01T00:00:00 | 7 | 3 |
| 1970-01-01T00:00:20 | 7 | 5 |
+---------------------+------------------------------------------------------------------+------------------------+
+---------------------+--------------------------------------------------------+------------------------+
| ts | arrow_cast(length(host.host),Utf8("Int64")) + Int64(2) | max(host.val) RANGE 5s |
+---------------------+--------------------------------------------------------+------------------------+
| 1970-01-01T00:00:00 | 7 | 3 |
| 1970-01-01T00:00:20 | 7 | 5 |
+---------------------+--------------------------------------------------------+------------------------+
-- Test error
-- project non-aggregation key

View File

@@ -188,22 +188,22 @@ SELECT ts, host, floor(cos(ceil(sin(min(val) RANGE '5s')))) FROM host ALIGN '5s'
SELECT ts, host, gcd(CAST(max(floor(val::DOUBLE)) RANGE '10s' FILL PREV as INT64) * 4, max(val * 4) RANGE '10s' FILL PREV) * length(host) + 1 FROM host ALIGN '5s' ORDER BY host, ts;
+---------------------+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ts | host | gcd(arrow_cast(max(floor(host.val)) RANGE 10s FILL PREV,Utf8("Int64")) * Int64(4),max(host.val * Int64(4)) RANGE 10s FILL PREV) * character_length(host.host) + Int64(1) |
+---------------------+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 1969-12-31T23:59:55 | host1 | 1 |
| 1970-01-01T00:00:00 | host1 | 1 |
| 1970-01-01T00:00:05 | host1 | 21 |
| 1970-01-01T00:00:10 | host1 | 21 |
| 1970-01-01T00:00:15 | host1 | 41 |
| 1970-01-01T00:00:20 | host1 | 41 |
| 1969-12-31T23:59:55 | host2 | 61 |
| 1970-01-01T00:00:00 | host2 | 61 |
| 1970-01-01T00:00:05 | host2 | 81 |
| 1970-01-01T00:00:10 | host2 | 81 |
| 1970-01-01T00:00:15 | host2 | 101 |
| 1970-01-01T00:00:20 | host2 | 101 |
+---------------------+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+---------------------+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ts | host | gcd(arrow_cast(max(floor(host.val)) RANGE 10s FILL PREV,Utf8("Int64")) * Int64(4),max(host.val * Int64(4)) RANGE 10s FILL PREV) * length(host.host) + Int64(1) |
+---------------------+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 1969-12-31T23:59:55 | host1 | 1 |
| 1970-01-01T00:00:00 | host1 | 1 |
| 1970-01-01T00:00:05 | host1 | 21 |
| 1970-01-01T00:00:10 | host1 | 21 |
| 1970-01-01T00:00:15 | host1 | 41 |
| 1970-01-01T00:00:20 | host1 | 41 |
| 1969-12-31T23:59:55 | host2 | 61 |
| 1970-01-01T00:00:00 | host2 | 61 |
| 1970-01-01T00:00:05 | host2 | 81 |
| 1970-01-01T00:00:10 | host2 | 81 |
| 1970-01-01T00:00:15 | host2 | 101 |
| 1970-01-01T00:00:20 | host2 | 101 |
+---------------------+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
DROP TABLE host;

View File

@@ -712,10 +712,10 @@ select * from pg_catalog.pg_type order by oid;
-- SQLNESS REPLACE (\d+\s*) OID
select * from pg_catalog.pg_database where datname = 'public';
+-----+---------+--------+----------+------------+----------+---------------+--------------+--------------+---------------+--------------+------------+---------------+--------+
| oid | datname | datdba | encoding | datcollate | datctype | datistemplate | datallowconn | datconnlimit | datlastsysoid | datfrozenxid | datminmxid | dattablespace | datacl |
+-----+---------+--------+----------+------------+----------+---------------+--------------+--------------+---------------+--------------+------------+---------------+--------+
+-----+---------+--------+----------+------------+----------+---------------+--------------+--------------+---------------+--------------+------------+---------------+--------+
+-----+---------+--------+----------+----------------+------------+----------+---------------+--------------+--------------+---------------+--------------+------------+---------------+--------------+-------------+--------+
| oid | datname | datdba | encoding | datlocprovider | datcollate | datctype | datistemplate | datallowconn | datconnlimit | datlastsysoid | datfrozenxid | datminmxid | dattablespace | daticulocale | daticurules | datacl |
+-----+---------+--------+----------+----------------+------------+----------+---------------+--------------+--------------+---------------+--------------+------------+---------------+--------------+-------------+--------+
+-----+---------+--------+----------+----------------+------------+----------+---------------+--------------+--------------+---------------+--------------+------------+---------------+--------------+-------------+--------+
-- \d
-- SQLNESS PROTOCOL POSTGRES

View File

@@ -184,6 +184,7 @@ TQL EXPLAIN VERBOSE (0, 10, '5s') test;
| physical_plan after OutputRequirements_| MergeScanExec: REDACTED
|_|_|
| physical_plan after LimitAggregation_| SAME TEXT AS ABOVE_|
| physical_plan after LimitPushPastWindows_| SAME TEXT AS ABOVE_|
| physical_plan after LimitPushdown_| SAME TEXT AS ABOVE_|
| physical_plan after ProjectionPushdown_| SAME TEXT AS ABOVE_|
| physical_plan after EnsureCooperative_| CooperativeExec_|
@@ -321,6 +322,7 @@ TQL EXPLAIN VERBOSE (0, 10, '5s') test AS series;
| physical_plan after OutputRequirements_| MergeScanExec: REDACTED
|_|_|
| physical_plan after LimitAggregation_| SAME TEXT AS ABOVE_|
| physical_plan after LimitPushPastWindows_| SAME TEXT AS ABOVE_|
| physical_plan after LimitPushdown_| SAME TEXT AS ABOVE_|
| physical_plan after ProjectionPushdown_| SAME TEXT AS ABOVE_|
| physical_plan after EnsureCooperative_| CooperativeExec_|

View File

@@ -775,8 +775,8 @@ LIMIT 5;
| | SubqueryAlias: l |
| | TableScan: labels |
| | ]] |
| physical_plan | SortPreservingMergeExec: [ts@0 ASC NULLS LAST, host@2 ASC NULLS LAST, avg_value@1 ASC NULLS LAST], fetch=5 |
| | SortExec: TopK(fetch=5), expr=[ts@0 ASC NULLS LAST, host@2 ASC NULLS LAST, avg_value@1 ASC NULLS LAST], preserve_REDACTED
| physical_plan | SortPreservingMergeExec: [ts@0 ASC NULLS LAST, avg_value@1 ASC NULLS LAST], fetch=5 |
| | SortExec: TopK(fetch=5), expr=[ts@0 ASC NULLS LAST, avg_value@1 ASC NULLS LAST], preserve_REDACTED
| | ProjectionExec: expr=[ts@0 as ts, cpu@1 as avg_value, host@2 as host] |
| | CoalesceBatchesExec: target_batch_size=8192 |
| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(date_trunc(Utf8("second"),t.ts)@2, date_trunc(Utf8("second"),l.ts)@2)], projection=[ts@0, cpu@1, host@4] |
@@ -861,8 +861,8 @@ LIMIT 5;
| | SubqueryAlias: l |
| | TableScan: labels |
| | ]] |
| physical_plan | SortPreservingMergeExec: [ts@0 ASC NULLS LAST, host@2 ASC NULLS LAST, avg_value@1 ASC NULLS LAST], fetch=5 |
| | SortExec: TopK(fetch=5), expr=[ts@0 ASC NULLS LAST, host@2 ASC NULLS LAST, avg_value@1 ASC NULLS LAST], preserve_REDACTED
| physical_plan | SortPreservingMergeExec: [ts@0 ASC NULLS LAST, avg_value@1 ASC NULLS LAST], fetch=5 |
| | SortExec: TopK(fetch=5), expr=[ts@0 ASC NULLS LAST, avg_value@1 ASC NULLS LAST], preserve_REDACTED
| | ProjectionExec: expr=[ts@1 as ts, cpu@0 as avg_value, host@2 as host] |
| | CoalesceBatchesExec: target_batch_size=8192 |
| | HashJoinExec: mode=Partitioned, join_type=Inner, on=[(date_trunc(Utf8("second"),t.ts)@2, date_trunc(Utf8("second"),l.ts)@2)], projection=[cpu@0, ts@1, host@4] |

View File

@@ -23,14 +23,14 @@ Affected Rows: 1
SELECT LENGTH(a) FROM test ORDER BY 1;
+--------------------------+
| character_length(test.a) |
+--------------------------+
| 10 |
| 100 |
| 1000 |
| 10000 |
+--------------------------+
+----------------+
| length(test.a) |
+----------------+
| 10 |
| 100 |
| 1000 |
| 10000 |
+----------------+
DROP TABLE test;

View File

@@ -33,11 +33,11 @@ Affected Rows: 1
-- verify that the append worked
SELECT COUNT(*), COUNT(a), MAX(LENGTH(a)), SUM(LENGTH(a)) FROM bigtable;
+----------+-------------------+-----------------------------------+-----------------------------------+
| count(*) | count(bigtable.a) | max(character_length(bigtable.a)) | sum(character_length(bigtable.a)) |
+----------+-------------------+-----------------------------------+-----------------------------------+
| 1 | 1 | 10000 | 10000 |
+----------+-------------------+-----------------------------------+-----------------------------------+
+----------+-------------------+-------------------------+-------------------------+
| count(*) | count(bigtable.a) | max(length(bigtable.a)) | sum(length(bigtable.a)) |
+----------+-------------------+-------------------------+-------------------------+
| 1 | 1 | 10000 | 10000 |
+----------+-------------------+-------------------------+-------------------------+
-- we create a total of 16K entries in the big table
-- the total size of this table is 16K*10K = 160MB
@@ -48,11 +48,11 @@ Affected Rows: 1
SELECT COUNT(*), COUNT(a), MAX(LENGTH(a)), SUM(LENGTH(a)) FROM bigtable;
+----------+-------------------+-----------------------------------+-----------------------------------+
| count(*) | count(bigtable.a) | max(character_length(bigtable.a)) | sum(character_length(bigtable.a)) |
+----------+-------------------+-----------------------------------+-----------------------------------+
| 2 | 2 | 10000 | 20000 |
+----------+-------------------+-----------------------------------+-----------------------------------+
+----------+-------------------+-------------------------+-------------------------+
| count(*) | count(bigtable.a) | max(length(bigtable.a)) | sum(length(bigtable.a)) |
+----------+-------------------+-------------------------+-------------------------+
| 2 | 2 | 10000 | 20000 |
+----------+-------------------+-------------------------+-------------------------+
INSERT INTO bigtable SELECT a, to_unixtime(ts) * 23 FROM bigtable;
@@ -60,11 +60,11 @@ Affected Rows: 2
SELECT COUNT(*), COUNT(a), MAX(LENGTH(a)), SUM(LENGTH(a)) FROM bigtable;
+----------+-------------------+-----------------------------------+-----------------------------------+
| count(*) | count(bigtable.a) | max(character_length(bigtable.a)) | sum(character_length(bigtable.a)) |
+----------+-------------------+-----------------------------------+-----------------------------------+
| 4 | 4 | 10000 | 40000 |
+----------+-------------------+-----------------------------------+-----------------------------------+
+----------+-------------------+-------------------------+-------------------------+
| count(*) | count(bigtable.a) | max(length(bigtable.a)) | sum(length(bigtable.a)) |
+----------+-------------------+-------------------------+-------------------------+
| 4 | 4 | 10000 | 40000 |
+----------+-------------------+-------------------------+-------------------------+
INSERT INTO bigtable SELECT a, to_unixtime(ts) * 31 FROM bigtable;
@@ -72,11 +72,11 @@ Affected Rows: 4
SELECT COUNT(*), COUNT(a), MAX(LENGTH(a)), SUM(LENGTH(a)) FROM bigtable;
+----------+-------------------+-----------------------------------+-----------------------------------+
| count(*) | count(bigtable.a) | max(character_length(bigtable.a)) | sum(character_length(bigtable.a)) |
+----------+-------------------+-----------------------------------+-----------------------------------+
| 8 | 8 | 10000 | 80000 |
+----------+-------------------+-----------------------------------+-----------------------------------+
+----------+-------------------+-------------------------+-------------------------+
| count(*) | count(bigtable.a) | max(length(bigtable.a)) | sum(length(bigtable.a)) |
+----------+-------------------+-------------------------+-------------------------+
| 8 | 8 | 10000 | 80000 |
+----------+-------------------+-------------------------+-------------------------+
INSERT INTO bigtable SELECT a, to_unixtime(ts) * 37 FROM bigtable;
@@ -84,11 +84,11 @@ Affected Rows: 8
SELECT COUNT(*), COUNT(a), MAX(LENGTH(a)), SUM(LENGTH(a)) FROM bigtable;
+----------+-------------------+-----------------------------------+-----------------------------------+
| count(*) | count(bigtable.a) | max(character_length(bigtable.a)) | sum(character_length(bigtable.a)) |
+----------+-------------------+-----------------------------------+-----------------------------------+
| 16 | 16 | 10000 | 160000 |
+----------+-------------------+-----------------------------------+-----------------------------------+
+----------+-------------------+-------------------------+-------------------------+
| count(*) | count(bigtable.a) | max(length(bigtable.a)) | sum(length(bigtable.a)) |
+----------+-------------------+-------------------------+-------------------------+
| 16 | 16 | 10000 | 160000 |
+----------+-------------------+-------------------------+-------------------------+
INSERT INTO bigtable SELECT a, to_unixtime(ts) * 41 FROM bigtable;
@@ -96,11 +96,11 @@ Affected Rows: 16
SELECT COUNT(*), COUNT(a), MAX(LENGTH(a)), SUM(LENGTH(a)) FROM bigtable;
+----------+-------------------+-----------------------------------+-----------------------------------+
| count(*) | count(bigtable.a) | max(character_length(bigtable.a)) | sum(character_length(bigtable.a)) |
+----------+-------------------+-----------------------------------+-----------------------------------+
| 32 | 32 | 10000 | 320000 |
+----------+-------------------+-----------------------------------+-----------------------------------+
+----------+-------------------+-------------------------+-------------------------+
| count(*) | count(bigtable.a) | max(length(bigtable.a)) | sum(length(bigtable.a)) |
+----------+-------------------+-------------------------+-------------------------+
| 32 | 32 | 10000 | 320000 |
+----------+-------------------+-------------------------+-------------------------+
INSERT INTO bigtable SELECT a, to_unixtime(ts) * 47 FROM bigtable;
@@ -108,11 +108,11 @@ Affected Rows: 32
SELECT COUNT(*), COUNT(a), MAX(LENGTH(a)), SUM(LENGTH(a)) FROM bigtable;
+----------+-------------------+-----------------------------------+-----------------------------------+
| count(*) | count(bigtable.a) | max(character_length(bigtable.a)) | sum(character_length(bigtable.a)) |
+----------+-------------------+-----------------------------------+-----------------------------------+
| 64 | 64 | 10000 | 640000 |
+----------+-------------------+-----------------------------------+-----------------------------------+
+----------+-------------------+-------------------------+-------------------------+
| count(*) | count(bigtable.a) | max(length(bigtable.a)) | sum(length(bigtable.a)) |
+----------+-------------------+-------------------------+-------------------------+
| 64 | 64 | 10000 | 640000 |
+----------+-------------------+-------------------------+-------------------------+
INSERT INTO bigtable SELECT a, to_unixtime(ts) * 51 FROM bigtable;
@@ -120,11 +120,11 @@ Affected Rows: 64
SELECT COUNT(*), COUNT(a), MAX(LENGTH(a)), SUM(LENGTH(a)) FROM bigtable;
+----------+-------------------+-----------------------------------+-----------------------------------+
| count(*) | count(bigtable.a) | max(character_length(bigtable.a)) | sum(character_length(bigtable.a)) |
+----------+-------------------+-----------------------------------+-----------------------------------+
| 128 | 128 | 10000 | 1280000 |
+----------+-------------------+-----------------------------------+-----------------------------------+
+----------+-------------------+-------------------------+-------------------------+
| count(*) | count(bigtable.a) | max(length(bigtable.a)) | sum(length(bigtable.a)) |
+----------+-------------------+-------------------------+-------------------------+
| 128 | 128 | 10000 | 1280000 |
+----------+-------------------+-------------------------+-------------------------+
INSERT INTO bigtable SELECT a, to_unixtime(ts) * 53 FROM bigtable;
@@ -132,11 +132,11 @@ Affected Rows: 128
SELECT COUNT(*), COUNT(a), MAX(LENGTH(a)), SUM(LENGTH(a)) FROM bigtable;
+----------+-------------------+-----------------------------------+-----------------------------------+
| count(*) | count(bigtable.a) | max(character_length(bigtable.a)) | sum(character_length(bigtable.a)) |
+----------+-------------------+-----------------------------------+-----------------------------------+
| 256 | 256 | 10000 | 2560000 |
+----------+-------------------+-----------------------------------+-----------------------------------+
+----------+-------------------+-------------------------+-------------------------+
| count(*) | count(bigtable.a) | max(length(bigtable.a)) | sum(length(bigtable.a)) |
+----------+-------------------+-------------------------+-------------------------+
| 256 | 256 | 10000 | 2560000 |
+----------+-------------------+-------------------------+-------------------------+
INSERT INTO bigtable SELECT a, to_unixtime(ts) * 57 FROM bigtable;
@@ -144,11 +144,11 @@ Affected Rows: 256
SELECT COUNT(*), COUNT(a), MAX(LENGTH(a)), SUM(LENGTH(a)) FROM bigtable;
+----------+-------------------+-----------------------------------+-----------------------------------+
| count(*) | count(bigtable.a) | max(character_length(bigtable.a)) | sum(character_length(bigtable.a)) |
+----------+-------------------+-----------------------------------+-----------------------------------+
| 512 | 512 | 10000 | 5120000 |
+----------+-------------------+-----------------------------------+-----------------------------------+
+----------+-------------------+-------------------------+-------------------------+
| count(*) | count(bigtable.a) | max(length(bigtable.a)) | sum(length(bigtable.a)) |
+----------+-------------------+-------------------------+-------------------------+
| 512 | 512 | 10000 | 5120000 |
+----------+-------------------+-------------------------+-------------------------+
INSERT INTO bigtable SELECT a, to_unixtime(ts) * 61 FROM bigtable;
@@ -156,11 +156,11 @@ Affected Rows: 512
SELECT COUNT(*), COUNT(a), MAX(LENGTH(a)), SUM(LENGTH(a)) FROM bigtable;
+----------+-------------------+-----------------------------------+-----------------------------------+
| count(*) | count(bigtable.a) | max(character_length(bigtable.a)) | sum(character_length(bigtable.a)) |
+----------+-------------------+-----------------------------------+-----------------------------------+
| 1024 | 1024 | 10000 | 10240000 |
+----------+-------------------+-----------------------------------+-----------------------------------+
+----------+-------------------+-------------------------+-------------------------+
| count(*) | count(bigtable.a) | max(length(bigtable.a)) | sum(length(bigtable.a)) |
+----------+-------------------+-------------------------+-------------------------+
| 1024 | 1024 | 10000 | 10240000 |
+----------+-------------------+-------------------------+-------------------------+
INSERT INTO bigtable SELECT a, to_unixtime(ts) * 63 FROM bigtable;
@@ -168,20 +168,20 @@ Affected Rows: 1024
SELECT COUNT(*), COUNT(a), MAX(LENGTH(a)), SUM(LENGTH(a)) FROM bigtable;
+----------+-------------------+-----------------------------------+-----------------------------------+
| count(*) | count(bigtable.a) | max(character_length(bigtable.a)) | sum(character_length(bigtable.a)) |
+----------+-------------------+-----------------------------------+-----------------------------------+
| 2048 | 2048 | 10000 | 20480000 |
+----------+-------------------+-----------------------------------+-----------------------------------+
+----------+-------------------+-------------------------+-------------------------+
| count(*) | count(bigtable.a) | max(length(bigtable.a)) | sum(length(bigtable.a)) |
+----------+-------------------+-------------------------+-------------------------+
| 2048 | 2048 | 10000 | 20480000 |
+----------+-------------------+-------------------------+-------------------------+
-- SQLNESS ARG restart=true
SELECT COUNT(*), COUNT(a), MAX(LENGTH(a)), SUM(LENGTH(a)) FROM bigtable;
+----------+-------------------+-----------------------------------+-----------------------------------+
| count(*) | count(bigtable.a) | max(character_length(bigtable.a)) | sum(character_length(bigtable.a)) |
+----------+-------------------+-----------------------------------+-----------------------------------+
| 2048 | 2048 | 10000 | 20480000 |
+----------+-------------------+-----------------------------------+-----------------------------------+
+----------+-------------------+-------------------------+-------------------------+
| count(*) | count(bigtable.a) | max(length(bigtable.a)) | sum(length(bigtable.a)) |
+----------+-------------------+-------------------------+-------------------------+
| 2048 | 2048 | 10000 | 20480000 |
+----------+-------------------+-------------------------+-------------------------+
INSERT INTO bigtable SELECT a, to_unixtime(ts) * 67 FROM bigtable;
@@ -189,11 +189,11 @@ Affected Rows: 2048
SELECT COUNT(*), COUNT(a), MAX(LENGTH(a)), SUM(LENGTH(a)) FROM bigtable;
+----------+-------------------+-----------------------------------+-----------------------------------+
| count(*) | count(bigtable.a) | max(character_length(bigtable.a)) | sum(character_length(bigtable.a)) |
+----------+-------------------+-----------------------------------+-----------------------------------+
| 4096 | 4096 | 10000 | 40960000 |
+----------+-------------------+-----------------------------------+-----------------------------------+
+----------+-------------------+-------------------------+-------------------------+
| count(*) | count(bigtable.a) | max(length(bigtable.a)) | sum(length(bigtable.a)) |
+----------+-------------------+-------------------------+-------------------------+
| 4096 | 4096 | 10000 | 40960000 |
+----------+-------------------+-------------------------+-------------------------+
INSERT INTO bigtable SELECT a, to_unixtime(ts) * 71 FROM bigtable;
@@ -201,11 +201,11 @@ Affected Rows: 4096
SELECT COUNT(*), COUNT(a), MAX(LENGTH(a)), SUM(LENGTH(a)) FROM bigtable;
+----------+-------------------+-----------------------------------+-----------------------------------+
| count(*) | count(bigtable.a) | max(character_length(bigtable.a)) | sum(character_length(bigtable.a)) |
+----------+-------------------+-----------------------------------+-----------------------------------+
| 8192 | 8192 | 10000 | 81920000 |
+----------+-------------------+-----------------------------------+-----------------------------------+
+----------+-------------------+-------------------------+-------------------------+
| count(*) | count(bigtable.a) | max(length(bigtable.a)) | sum(length(bigtable.a)) |
+----------+-------------------+-------------------------+-------------------------+
| 8192 | 8192 | 10000 | 81920000 |
+----------+-------------------+-------------------------+-------------------------+
DROP TABLE test;

View File

@@ -58,12 +58,12 @@ SELECT substr('🦤🦆f', 1, 2);
-- length on emojis
SELECT length(s) FROM emojis ORDER BY id;
+----------------------------+
| character_length(emojis.s) |
+----------------------------+
| 1 |
| 3 |
+----------------------------+
+------------------+
| length(emojis.s) |
+------------------+
| 1 |
| 3 |
+------------------+
DROP TABLE emojis;

View File

@@ -9,7 +9,7 @@ Error: 2000(InvalidSyntax), Invalid SQL syntax: sql parser error: Expected: AS,
CREATE VIEW test_view as DELETE FROM public.numbers;
Error: 2000(InvalidSyntax), Invalid SQL syntax: sql parser error: Expected: SELECT, VALUES, or a subquery in the query body, found: DELETE at Line: 1, Column: 26
Error: 1001(Unsupported), Failed to plan SQL: This feature is not implemented: Query DELETE FROM public.numbers not implemented yet
--- Table already exists ---
CREATE VIEW test_table as SELECT * FROM public.numbers;