Files
greptimedb/tests/cases/standalone/common/subquery/table.result
Yingwen 35b635f639 feat!: Bump datafusion, prost, hyper, tonic, tower, axum (#5417)
* change dep

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* feat: adapt to arrow's interval array

* chore: fix compile errors in datatypes crate

* chore: fix api crate compiler errors

* chore: fix compiler errors in common-grpc

* chore: fix common-datasource errors

* chore: fix deprecated code in common-datasource

* fix promql and physical plan related

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* wip: upgrading network deps

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* block on updating `sqlparser`

* upgrade sqlparser

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* adapt new df's trait requirements

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* chore: fix compiler errors in mito2

* chore: fix common-function crate errors

* chore: fix catalog errors

* change import path

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* chore: fix some errors in query crate

* chore: fix some errors in query crate

* aggr expr and some other tiny fixes

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* chore: fix expr related errors in query crate

* chore: fix query serializer and admin command

* chore: fix grpc services

* feat: axum serve

* chore: fix http server

* remove handle_error handler
* refactor timeout layer
* serve axum

* chore: fix flow aggr functions

* chore: fix flow

* feat: fix errors in meta-srv

* boxed()
* use TokioIo

* feat!: Remove script crate and python feature (#5321)

* feat: exclude script crate

* chore: simplify feature

* feat: remove the script crate

* chore: remove python feature and some comments

* chore: fix warning

* chore: fix servers tests compiler errors

* feat: fix tests-integration errors

* chore: fix unused

* test: fix catalog test

* chore: fix compiler errors for crates using common-meta

testing feature is enabled when check with --workspace

* test: use display for logical plan test

* test: implement rewrite for ScanHintRule

* fix: http server build panic

* test: fix mito test

* fix: sql parser type alias error

* test: fix TestClient not listen

* test: some flow tests

* test(flow): more fix

* fix: test_otlp_logs

* test: fix promql test that using deprecated method fun()

* fix: sql type replace supports Int8 ~ Int64, UInt8 ~ UInt64

* test: fix infer schema test case

* test: fix tests related to plan display

* chore: fix last flow test

* test: fix function format related assertion

* test: use larger port range for tests

* fix: test_otlp_traces

* fix: test_otlp_metrics

* fix range query and dist plan

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix: flow handle distinct use deprecated field

* fix: can't pass Join plan expressions to LogicalPlan::with_new_exprs

* test: fix deserialize test

* test: reduce split key case num

* tests: lower case aggr func name

* test: fix some sqlness tests

* tests: more sqlness fix

* tests: fixed sqlness test

* commit non-bug changes

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix: make our udf correct

* fix: implement empty methods of ContextProvider for DfContextProviderAdapter

* test: update sqlness test result

* chore: remove unused

* fix: provide alias name for AggregateExprBuilder in range plan

* test: update range query result

* fix: implement missing ContextProvider methods for DfContextProviderAdapter

* test: update timestamps, cte result

* fix: supports empty projection in mito

* test: update comment for cte test

* fix: support projection for numbers

* test: update test cases after projection fix

* fix: fix range select first_value/last_value

* fix: handle CAST and time index conflict

* fix: handle order by correctly in range first_value/last_value

* test: update sqlness result

* test: update view test result

* test: update decimal test

wait for https://github.com/apache/datafusion/pull/14126 to fix this

* feat: remove redundant physical optimization

todo(ruihang): Check if we can remove this.

* test: update sqlness test result

* chore: range select default sort use nulls_first = false

* test: update filter push down test result

* test: comment deciaml test to avoid different panic message

* test: update some distributed test result

* test: update test for distributed count and filter push down

* test: update subqueries test

* fix: SessionState may overwrite our UDFs

* chore: fix compiler errors after merging main

* fix: fix elasticsearch and dashboard router panic

* chore: fix common-functions tests

* chore: update sqlness result

* test: fix id keyword and update sqlness result

* test: fix flow_null test

* fix: enlarge thread size in debug mode to avoid overflow

* chore: fix warnings in common-function

* chore: fix warning in flow

* chore: fix warnings in query crate

* chore: remove unused warnings

* chore: fix deprecated warnings for parquet

* chore: fix deprecated warning in servers crate

* style: fix clippy

* test: enlarge mito cache tttl test ttl time

* chore: fix typo

* style: fmt toml

* refactor: reimplement PartialOrd for RangeSelect

* chore: remove script crate files introduced by merge

* fix: return error if sql option is not kv

* chore: do not use ..default::default()

* chore: per review

* chore: update error message in BuildAdminFunctionArgsSnafu

Co-authored-by: jeremyhi <jiachun_feng@proton.me>

* refactor: typed precision

* update sqlness view case

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* chore: flow per review

* chore: add example in comment

* chore: warn if parquet stats of timestamp is not INT64

* style: add a newline before derive to make the comment more clear

* test: update sqlness result

* fix: flow from substrait

* chore: change update_range_context log to debug level

* chore: move axum-extra axum-macros to workspace

---------

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Co-authored-by: Ruihang Xia <waynestxia@gmail.com>
Co-authored-by: luofucong <luofc@foxmail.com>
Co-authored-by: discord9 <discord9@163.com>
Co-authored-by: shuiyisong <xixing.sys@gmail.com>
Co-authored-by: jeremyhi <jiachun_feng@proton.me>
2025-01-23 06:15:40 +00:00

185 lines
4.2 KiB
Plaintext

-- aliasing, from:
-- https://github.com/duckdb/duckdb/blob/9196dd9b0a163e6c8aada26218803d04be30c562/test/sql/subquery/table/test_aliasing.test
CREATE TABLE a(ts TIMESTAMP TIME INDEX, i INTEGER);
Affected Rows: 0
insert into a values (1, 42);
Affected Rows: 1
SELECT * FROM (SELECT i AS j FROM a GROUP BY j) WHERE j = 42;
+----+
| j |
+----+
| 42 |
+----+
SELECT * FROM (SELECT i AS j FROM a GROUP BY i) WHERE j = 42;
+----+
| j |
+----+
| 42 |
+----+
DROP TABLE a;
Affected Rows: 0
-- nested table subquery, from:
-- https://github.com/duckdb/duckdb/blob/2e4e2913266ddc46c7281d1b992228cb0095954b/test/sql/subquery/table/test_nested_table_subquery.test_slow
CREATE TABLE test (ts TIMESTAMP TIME INDEX, i INTEGER, j INTEGER);
Affected Rows: 0
INSERT INTO test VALUES (0, 3, 4), (1, 4, 5), (2, 5, 6);
Affected Rows: 3
SELECT * FROM (SELECT i, j FROM (SELECT j AS i, i AS j FROM (SELECT j AS i, i AS j FROM test) AS a) AS a) AS a, (SELECT i+1 AS r,j FROM test) AS b, test WHERE a.i=b.r AND test.j=a.i ORDER BY 1;
+---+---+---+---+-------------------------+---+---+
| i | j | r | j | ts | i | j |
+---+---+---+---+-------------------------+---+---+
| 4 | 5 | 4 | 4 | 1970-01-01T00:00:00 | 3 | 4 |
| 5 | 6 | 5 | 5 | 1970-01-01T00:00:00.001 | 4 | 5 |
+---+---+---+---+-------------------------+---+---+
SELECT i FROM (SELECT i + 1 AS i FROM (SELECT i + 1 AS i FROM (SELECT i + 1 AS i FROM test)));
+---+
| i |
+---+
| 6 |
| 7 |
| 8 |
+---+
DROP TABLE test;
Affected Rows: 0
-- subquery union, from:
-- https://github.com/duckdb/duckdb/blob/9196dd9b0a163e6c8aada26218803d04be30c562/test/sql/subquery/table/test_subquery_union.test
SELECT * FROM (SELECT 42) UNION ALL SELECT * FROM (SELECT 43) ORDER BY 1;
+-----------+
| Int64(42) |
+-----------+
| 42 |
| 43 |
+-----------+
-- table subquery, from:
-- https://github.com/duckdb/duckdb/blob/8704c7d0807d6ce1e2ebcdf6398e1b6cc050e507/test/sql/subquery/table/test_table_subquery.test
CREATE TABLE test (ts TIMESTAMP TIME INDEX, i INTEGER, j INTEGER);
Affected Rows: 0
INSERT INTO test VALUES (0, 3, 4), (1, 4, 5), (2, 5, 6);
Affected Rows: 3
SELECT * FROM (SELECT i, j AS d FROM test ORDER BY i) AS b;
+---+---+
| i | d |
+---+---+
| 3 | 4 |
| 4 | 5 |
| 5 | 6 |
+---+---+
SELECT b.d FROM (SELECT i * 2 + j AS d FROM test) AS b;
+----+
| d |
+----+
| 10 |
| 13 |
| 16 |
+----+
SELECT a.i,a.j,b.r,b.j FROM (SELECT i, j FROM test) AS a INNER JOIN (SELECT i+1 AS r,j FROM test) AS b ON a.i=b.r ORDER BY 1;
+---+---+---+---+
| i | j | r | j |
+---+---+---+---+
| 4 | 5 | 4 | 4 |
| 5 | 6 | 5 | 5 |
+---+---+---+---+
SELECT * FROM (SELECT i, j FROM test) AS a, (SELECT i+1 AS r,j FROM test) AS b, test WHERE a.i=b.r AND test.j=a.i ORDER BY 1;
+---+---+---+---+-------------------------+---+---+
| i | j | r | j | ts | i | j |
+---+---+---+---+-------------------------+---+---+
| 4 | 5 | 4 | 4 | 1970-01-01T00:00:00 | 3 | 4 |
| 5 | 6 | 5 | 5 | 1970-01-01T00:00:00.001 | 4 | 5 |
+---+---+---+---+-------------------------+---+---+
SELECT sum(x) FROM (SELECT i AS x FROM test GROUP BY i) sq;
+-----------+
| sum(sq.x) |
+-----------+
| 12 |
+-----------+
SELECT sum(x) FROM (SELECT i+1 AS x FROM test GROUP BY x) sq;
+-----------+
| sum(sq.x) |
+-----------+
| 15 |
+-----------+
DROP TABLE test;
Affected Rows: 0
-- test unamed subquery, from:
-- https://github.com/duckdb/duckdb/blob/00a605270719941ca0412ad5d0a14b1bdfbf9eb5/test/sql/subquery/table/test_unnamed_subquery.test
SELECT a FROM (SELECT 42 a);
+----+
| a |
+----+
| 42 |
+----+
SELECT * FROM (SELECT 42 a), (SELECT 43 b);
+----+----+
| a | b |
+----+----+
| 42 | 43 |
+----+----+
SELECT * FROM (VALUES (42, 43));
+---------+---------+
| column1 | column2 |
+---------+---------+
| 42 | 43 |
+---------+---------+
SELECT * FROM (SELECT 42 a), (SELECT 43 b), (SELECT 44 c), (SELECT 45 d);
+----+----+----+----+
| a | b | c | d |
+----+----+----+----+
| 42 | 43 | 44 | 45 |
+----+----+----+----+
SELECT * FROM (SELECT * FROM (SELECT 42 a), (SELECT 43 b)) JOIN (SELECT 44 c) ON (true) JOIN (SELECT 45 d) ON (true);
+----+----+----+----+
| a | b | c | d |
+----+----+----+----+
| 42 | 43 | 44 | 45 |
+----+----+----+----+