From 90fdc6550edd71eeff9a253a574dca4277ca82d2 Mon Sep 17 00:00:00 2001 From: Runji Wang Date: Tue, 12 Sep 2023 01:53:19 +0800 Subject: [PATCH] fix unit test Signed-off-by: Runji Wang --- .../planner_test/tests/testdata/output/insert.yaml | 2 +- .../planner_test/tests/testdata/output/struct_query.yaml | 2 +- src/frontend/src/expr/type_inference/func.rs | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/frontend/planner_test/tests/testdata/output/insert.yaml b/src/frontend/planner_test/tests/testdata/output/insert.yaml index 578569b172dc9..cdab33a72a6f9 100644 --- a/src/frontend/planner_test/tests/testdata/output/insert.yaml +++ b/src/frontend/planner_test/tests/testdata/output/insert.yaml @@ -175,7 +175,7 @@ sql: | create table t (v1 timestamp, v2 real); insert into t select time '01:02:03', 4.5 from t; - binder_error: 'Bind error: cannot cast type "time without time zone" to "timestamp without time zone" in Assign context' + binder_error: 'Bind error: cannot cast type "time" to "timestamp" in Assign context' - name: insert into select mismatch columns length sql: | create table t (v1 int, v2 real); diff --git a/src/frontend/planner_test/tests/testdata/output/struct_query.yaml b/src/frontend/planner_test/tests/testdata/output/struct_query.yaml index acf1dafc9a11a..0a4bac599662a 100644 --- a/src/frontend/planner_test/tests/testdata/output/struct_query.yaml +++ b/src/frontend/planner_test/tests/testdata/output/struct_query.yaml @@ -274,7 +274,7 @@ Bind error: failed to bind expression: (country + country) Caused by: - Feature is not yet implemented: Add[Struct, Struct] + Feature is not yet implemented: Add[Struct(StructType { field_names: ["address", "zipcode"], field_types: [Varchar, Varchar] }), Struct(StructType { field_names: ["address", "zipcode"], field_types: [Varchar, Varchar] })] Tracking issue: https://github.com/risingwavelabs/risingwave/issues/112 create_source: format: plain diff --git a/src/frontend/src/expr/type_inference/func.rs b/src/frontend/src/expr/type_inference/func.rs index 4339f56beac23..a3f75b37a7c70 100644 --- a/src/frontend/src/expr/type_inference/func.rs +++ b/src/frontend/src/expr/type_inference/func.rs @@ -100,7 +100,7 @@ pub fn infer_some_all( if !matches!(&element_type, Some(e) if sig.inputs_type[1].matches(e)) { let SigDataType::Exact(t) = &sig.inputs_type[1] else { return Err(ErrorCode::BindError( - "array of array/struct on left are not supported yet".into(), + "array/struct on left are not supported yet".into(), ) .into()); }; @@ -756,9 +756,9 @@ fn narrow_category<'a>( // candidate. let Ok(selected) = &category else { continue }; // least_restrictive or mark temporary conflict err - if implicit_ok(formal.as_exact(), selected, true) { + if formal.is_exact() && implicit_ok(formal.as_exact(), selected, true) { // noop - } else if implicit_ok(selected.as_exact(), formal, false) { + } else if selected.is_exact() && implicit_ok(selected.as_exact(), formal, false) { category = Ok(formal); } else { category = Err(()); @@ -785,6 +785,7 @@ fn narrow_category<'a>( }; formal == *selected || !is_preferred(selected) + && formal.is_exact() && implicit_ok(formal.as_exact(), selected, false) }) })