Skip to content

Commit

Permalink
fix planner test
Browse files Browse the repository at this point in the history
Signed-off-by: Runji Wang <[email protected]>
  • Loading branch information
wangrunji0408 committed Mar 23, 2023
1 parent 5110437 commit 65a83b6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/frontend/planner_test/tests/testdata/expr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -377,14 +377,12 @@
sql: |
select array[1] < SOME(null);
binder_error: |-
Feature is not yet implemented: LessThan[List, unknown]
Tracking issue: https://github.com/risingwavelabs/risingwave/issues/112
Bind error: array/struct on left are not supported yet
- name: array of array/struct on right not supported yet 5808
sql: |
select null < SOME(array[array[1]]);
binder_error: |-
Feature is not yet implemented: LessThan[unknown, List]
Tracking issue: https://github.com/risingwavelabs/risingwave/issues/112
Bind error: array of array/struct on right are not supported yet
- sql: |
select 1 < SOME(array[null]::integer[]);
logical_plan: |
Expand Down
6 changes: 3 additions & 3 deletions src/frontend/planner_test/tests/testdata/time_window.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,23 +135,23 @@
create table t (v1 varchar, v2 timestamp, v3 float);
select v1, window_end, avg(v3) as avg from hop( t, v2, interval '1' minute, interval '10' minute) group by v1, window_end;
logical_plan: |
LogicalProject { exprs: [t.v1, window_end, (sum(t.v3) / count(t.v3)::Float64) as $expr1] }
LogicalProject { exprs: [t.v1, window_end, (sum(t.v3) / count(t.v3)) as $expr1] }
└─LogicalAgg { group_key: [t.v1, window_end], aggs: [sum(t.v3), count(t.v3)] }
└─LogicalProject { exprs: [t.v1, window_end, t.v3] }
└─LogicalHopWindow { time_col: t.v2, slide: 00:01:00, size: 00:10:00, output: all }
└─LogicalFilter { predicate: IsNotNull(t.v2) }
└─LogicalScan { table: t, columns: [t.v1, t.v2, t.v3, t._row_id] }
batch_plan: |
BatchExchange { order: [], dist: Single }
└─BatchProject { exprs: [t.v1, window_end, (sum(t.v3) / count(t.v3)::Float64) as $expr1] }
└─BatchProject { exprs: [t.v1, window_end, (sum(t.v3) / count(t.v3)) as $expr1] }
└─BatchHashAgg { group_key: [t.v1, window_end], aggs: [sum(t.v3), count(t.v3)] }
└─BatchHopWindow { time_col: t.v2, slide: 00:01:00, size: 00:10:00, output: [t.v1, t.v3, window_end] }
└─BatchExchange { order: [], dist: HashShard(t.v1) }
└─BatchFilter { predicate: IsNotNull(t.v2) }
└─BatchScan { table: t, columns: [t.v1, t.v2, t.v3], distribution: SomeShard }
stream_plan: |
StreamMaterialize { columns: [v1, window_end, avg], pk_columns: [v1, window_end], pk_conflict: "no check" }
└─StreamProject { exprs: [t.v1, window_end, (sum(t.v3) / count(t.v3)::Float64) as $expr1] }
└─StreamProject { exprs: [t.v1, window_end, (sum(t.v3) / count(t.v3)) as $expr1] }
└─StreamHashAgg { group_key: [t.v1, window_end], aggs: [sum(t.v3), count(t.v3), count] }
└─StreamExchange { dist: HashShard(t.v1, window_end) }
└─StreamHopWindow { time_col: t.v2, slide: 00:01:00, size: 00:10:00, output: [t.v1, t.v3, window_end, t._row_id] }
Expand Down
17 changes: 17 additions & 0 deletions src/frontend/src/expr/type_inference/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,26 @@ pub fn infer_some_all(
];
let sig = infer_type_name(&FUNC_SIG_MAP, final_type, &actuals)?;
if DataTypeName::from(inputs[0].return_type()) != sig.inputs_type[0] {
if matches!(
sig.inputs_type[0],
DataTypeName::List | DataTypeName::Struct
) {
return Err(ErrorCode::BindError(
"array of array/struct on right are not supported yet".into(),
)
.into());
}
inputs[0] = inputs[0].clone().cast_implicit(sig.inputs_type[0].into())?;
}
if element_type != Some(sig.inputs_type[1]) {
if matches!(
sig.inputs_type[1],
DataTypeName::List | DataTypeName::Struct
) {
return Err(
ErrorCode::BindError("array/struct on left are not supported yet".into()).into(),
);
}
inputs[1] = inputs[1].clone().cast_implicit(DataType::List {
datatype: Box::new(sig.inputs_type[1].into()),
})?;
Expand Down

0 comments on commit 65a83b6

Please sign in to comment.