Skip to content

Commit

Permalink
ut
Browse files Browse the repository at this point in the history
  • Loading branch information
st1page committed Mar 29, 2022
1 parent ccd24dc commit 3c3f650
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 59 deletions.
20 changes: 10 additions & 10 deletions rust/frontend/test_runner/tests/testdata/basic_query_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
select * from t;
batch_plan: |
BatchExchange { order: [], dist: Single }
BatchScan { table: t, columns: [_row_id#0, v1, v2] }
BatchScan { table: t, columns: [v1, v2] }
stream_plan: |
StreamMaterialize { columns: [_row_id#0, v1, v2], pk_columns: [_row_id#0] }
StreamTableScan { table: t, columns: [_row_id#0, v1, v2], pk_indices: [0] }
StreamMaterialize { columns: [v1, v2, _row_id#0(hidden)], pk_columns: [_row_id#0] }
StreamTableScan { table: t, columns: [v1, v2, _row_id#0], pk_indices: [2] }
- sql: |
create table t (v1 bigint, v2 double precision);
select t2.* from t;
Expand All @@ -22,22 +22,22 @@
batch_plan: |
BatchExchange { order: [], dist: Single }
BatchFilter { predicate: (((((1:Int32 > 2:Int32) AND (1:Int32 = 1:Int32)) AND (3:Int32 < 1:Int32)) AND (4:Int32 <> 1:Int32)) OR (((1:Int32 = 1:Int32) AND (2:Int32 >= 1:Int32)) AND (1:Int32 <= 2:Int32))) }
BatchScan { table: t, columns: [_row_id#0] }
BatchScan { table: t, columns: [] }
stream_plan: |
StreamMaterialize { columns: [_row_id#0], pk_columns: [_row_id#0] }
StreamMaterialize { columns: [_row_id#0(hidden)], pk_columns: [_row_id#0] }
StreamFilter { predicate: (((((1:Int32 > 2:Int32) AND (1:Int32 = 1:Int32)) AND (3:Int32 < 1:Int32)) AND (4:Int32 <> 1:Int32)) OR (((1:Int32 = 1:Int32) AND (2:Int32 >= 1:Int32)) AND (1:Int32 <= 2:Int32))) }
StreamTableScan { table: t, columns: [_row_id#0], pk_indices: [0] }
- sql: |
create table t (v1 int);
select * from t where v1<1;
batch_plan: |
BatchExchange { order: [], dist: Single }
BatchFilter { predicate: ($1 < 1:Int32) }
BatchScan { table: t, columns: [_row_id#0, v1] }
BatchFilter { predicate: ($0 < 1:Int32) }
BatchScan { table: t, columns: [v1] }
stream_plan: |
StreamMaterialize { columns: [_row_id#0, v1], pk_columns: [_row_id#0] }
StreamFilter { predicate: ($1 < 1:Int32) }
StreamTableScan { table: t, columns: [_row_id#0, v1], pk_indices: [0] }
StreamMaterialize { columns: [v1, _row_id#0(hidden)], pk_columns: [_row_id#0] }
StreamFilter { predicate: ($0 < 1:Int32) }
StreamTableScan { table: t, columns: [v1, _row_id#0], pk_indices: [1] }
- sql: |
create table t ();
select (((((false is not true) is true) is not false) is false) is not null) is null from t;
Expand Down
6 changes: 3 additions & 3 deletions rust/frontend/test_runner/tests/testdata/limit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
logical_plan: |
LogicalLimit { limit: 4, offset: 0 }
LogicalProject { exprs: [$1], expr_alias: [v] }
LogicalScan { table: t, columns: [_row_id, v] }
LogicalScan { table: t, columns: [_row_id#0, v] }
- sql: |
create table t (v int not null);
select * from t offset 4;
logical_plan: |
LogicalLimit { limit: 9223372036854775807, offset: 4 }
LogicalProject { exprs: [$1], expr_alias: [v] }
LogicalScan { table: t, columns: [_row_id, v] }
LogicalScan { table: t, columns: [_row_id#0, v] }
- sql: |
create table t (v int not null);
select * from ( select * from t limit 5 ) limit 4;
Expand All @@ -20,4 +20,4 @@
LogicalProject { exprs: [$0], expr_alias: [v] }
LogicalLimit { limit: 5, offset: 0 }
LogicalProject { exprs: [$1], expr_alias: [v] }
LogicalScan { table: t, columns: [_row_id, v] }
LogicalScan { table: t, columns: [_row_id#0, v] }
6 changes: 3 additions & 3 deletions rust/frontend/test_runner/tests/testdata/order_by.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
create table t (v1 bigint, v2 double precision);
select * from t order by v1 desc;
batch_plan: |
BatchExchange { order: [$1 DESC], dist: Single }
BatchSort { order: [$1 DESC] }
BatchScan { table: t, columns: [_row_id#0, v1, v2] }
BatchExchange { order: [$0 DESC], dist: Single }
BatchSort { order: [$0 DESC] }
BatchScan { table: t, columns: [v1, v2] }
- sql: |
create table t (v1 bigint, v2 double precision);
select t.* from t order by v1;
Expand Down
22 changes: 11 additions & 11 deletions rust/frontend/test_runner/tests/testdata/predicate_pushdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
create table t2 (v1 int, v2 int, v3 int);
select * from t1 join t2 on t1.v1=t2.v2 and t1.v1>1 where t2.v2>2;
logical_plan: |
LogicalProject { exprs: [$0, $1, $2, $3, $4, $5, $6, $7], expr_alias: [_row_id#0, v1, v2, v3, _row_id#0, v1, v2, v3] }
LogicalProject { exprs: [$1, $2, $3, $5, $6, $7], expr_alias: [v1, v2, v3, v1, v2, v3] }
LogicalFilter { predicate: ($6 > 2:Int32) }
LogicalJoin { type: Inner, on: ($1 = $6) AND ($1 > 1:Int32) }
LogicalScan { table: t1, columns: [_row_id#0, v1, v2, v3] }
LogicalScan { table: t2, columns: [_row_id#0, v1, v2, v3] }
optimized_logical_plan: |
LogicalJoin { type: Inner, on: ($1 = $6) }
LogicalFilter { predicate: ($1 > 1:Int32) }
LogicalScan { table: t1, columns: [_row_id#0, v1, v2, v3] }
LogicalFilter { predicate: ($2 > 2:Int32) }
LogicalScan { table: t2, columns: [_row_id#0, v1, v2, v3] }
LogicalJoin { type: Inner, on: ($0 = $4) }
LogicalFilter { predicate: ($0 > 1:Int32) }
LogicalScan { table: t1, columns: [v1, v2, v3] }
LogicalFilter { predicate: ($1 > 2:Int32) }
LogicalScan { table: t2, columns: [v1, v2, v3] }
- sql: |
create table t (v1 bigint, v2 double precision);
select * from (select * from t) where v2 > 1;
logical_plan: |
LogicalProject { exprs: [$0, $1, $2], expr_alias: [_row_id#0, v1, v2] }
LogicalFilter { predicate: ($2 > 1:Int32) }
LogicalProject { exprs: [$0, $1, $2], expr_alias: [_row_id#0, v1, v2] }
LogicalProject { exprs: [$0, $1], expr_alias: [v1, v2] }
LogicalFilter { predicate: ($1 > 1:Int32) }
LogicalProject { exprs: [$1, $2], expr_alias: [v1, v2] }
LogicalScan { table: t, columns: [_row_id#0, v1, v2] }
optimized_logical_plan: |
LogicalFilter { predicate: ($2 > 1:Int32) }
LogicalScan { table: t, columns: [_row_id#0, v1, v2] }
LogicalFilter { predicate: ($1 > 1:Int32) }
LogicalScan { table: t, columns: [v1, v2] }
- sql: |
create table t (v1 bigint, v2 double precision);
select v1 from (select v2, v1 from t) where v2 > 1;
Expand Down
26 changes: 4 additions & 22 deletions rust/frontend/test_runner/tests/testdata/stream_proto.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
tableRefId:
tableId: 1
columnDescs:
- columnType:
typeName: INT64
isNullable: true
name: "_row_id#0"
- columnType:
typeName: INT32
isNullable: true
Expand All @@ -26,7 +22,7 @@
- columnType:
typeName: INT64
isNullable: true
name: _row_id
name: "_row_id#0"
pkIndices:
- 1
chainNode:
Expand Down Expand Up @@ -82,11 +78,6 @@
id: 4294967294
name: test
columns:
- columnDesc:
columnType:
typeName: INT64
isNullable: true
name: "_row_id#0"
- columnDesc:
columnType:
typeName: INT32
Expand All @@ -97,7 +88,7 @@
typeName: INT64
isNullable: true
columnId: 1
name: _row_id
name: "_row_id#0"
isHidden: true
pkColumnIds:
- 1
Expand All @@ -118,10 +109,6 @@
tableRefId:
tableId: 1
columnDescs:
- columnType:
typeName: INT64
isNullable: true
name: "_row_id#0"
- columnType:
typeName: INT32
isNullable: true
Expand All @@ -130,7 +117,7 @@
- columnType:
typeName: INT64
isNullable: true
name: _row_id
name: "_row_id#0"
pkIndices:
- 1
chainNode:
Expand Down Expand Up @@ -165,11 +152,6 @@
id: 4294967294
name: test
columns:
- columnDesc:
columnType:
typeName: INT64
isNullable: true
name: "_row_id#0"
- columnDesc:
columnType:
typeName: INT32
Expand All @@ -180,7 +162,7 @@
typeName: INT64
isNullable: true
columnId: 1
name: _row_id
name: "_row_id#0"
isHidden: true
pkColumnIds:
- 1
Expand Down
16 changes: 8 additions & 8 deletions rust/frontend/test_runner/tests/testdata/subquery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
create table t (v1 bigint, v2 double precision);
select v1 from (select * from t) where v2 > 1;
logical_plan: |
LogicalProject { exprs: [$1], expr_alias: [v1] }
LogicalFilter { predicate: ($2 > 1:Int32) }
LogicalProject { exprs: [$0, $1, $2], expr_alias: [_row_id#0, v1, v2] }
LogicalProject { exprs: [$0], expr_alias: [v1] }
LogicalFilter { predicate: ($1 > 1:Int32) }
LogicalProject { exprs: [$1, $2], expr_alias: [v1, v2] }
LogicalScan { table: t, columns: [_row_id#0, v1, v2] }
- sql: |
/* merge and then eliminate */
Expand Down Expand Up @@ -43,19 +43,19 @@
create table t (v1 bigint, v2 double precision);
select * from (select * from t);
logical_plan: |
LogicalProject { exprs: [$0, $1, $2], expr_alias: [_row_id#0, v1, v2] }
LogicalProject { exprs: [$0, $1, $2], expr_alias: [_row_id#0, v1, v2] }
LogicalProject { exprs: [$0, $1], expr_alias: [v1, v2] }
LogicalProject { exprs: [$1, $2], expr_alias: [v1, v2] }
LogicalScan { table: t, columns: [_row_id#0, v1, v2] }
optimized_logical_plan: |
LogicalScan { table: t, columns: [_row_id#0, v1, v2] }
LogicalScan { table: t, columns: [v1, v2] }
- sql: |
/* joins */
create table t (v1 bigint, v2 double precision);
select * from (select * from t), t;
logical_plan: |
LogicalProject { exprs: [$0, $1, $2, $3, $4, $5], expr_alias: [_row_id#0, v1, v2, _row_id#0, v1, v2] }
LogicalProject { exprs: [$0, $1, $3, $4], expr_alias: [v1, v2, v1, v2] }
LogicalJoin { type: Inner, on: true:Boolean }
LogicalProject { exprs: [$0, $1, $2], expr_alias: [_row_id#0, v1, v2] }
LogicalProject { exprs: [$1, $2], expr_alias: [v1, v2] }
LogicalScan { table: t, columns: [_row_id#0, v1, v2] }
LogicalScan { table: t, columns: [_row_id#0, v1, v2] }
- sql: |
Expand Down
4 changes: 2 additions & 2 deletions rust/frontend/test_runner/tests/testdata/subquery_expr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
LogicalValues { rows: [[]], schema: Schema { fields: [] } }
LogicalProject { exprs: [($0 >= 1:Int32)], expr_alias: [ ] }
LogicalAgg { group_keys: [], agg_calls: [count] }
LogicalProject { exprs: [$0, $1], expr_alias: [_row_id#0, x] }
LogicalProject { exprs: [$1], expr_alias: [x] }
LogicalScan { table: t, columns: [_row_id#0, x] }
- sql: |
create table t1(x int);
Expand All @@ -86,7 +86,7 @@
LogicalScan { table: t, columns: [_row_id#0, x] }
LogicalProject { exprs: [($0 >= 1:Int32)], expr_alias: [ ] }
LogicalAgg { group_keys: [], agg_calls: [count] }
LogicalProject { exprs: [$0, $1], expr_alias: [_row_id#0, x] }
LogicalProject { exprs: [$1], expr_alias: [x] }
LogicalScan { table: t, columns: [_row_id#0, x] }
- sql: |
create table t1(x int);
Expand Down

0 comments on commit 3c3f650

Please sign in to comment.