From 10a7707dace71b305157fc5bae314dd406202cef Mon Sep 17 00:00:00 2001 From: xxhZs <1060434431@qq.com> Date: Thu, 6 Jun 2024 11:05:31 +0800 Subject: [PATCH] fix ci fix ci fmt fix ci --- src/frontend/src/binder/mod.rs | 290 +++++++++--------- .../plan_node/logical_changed_log.rs | 2 +- src/sqlparser/tests/sqlparser_common.rs | 10 +- 3 files changed, 155 insertions(+), 147 deletions(-) diff --git a/src/frontend/src/binder/mod.rs b/src/frontend/src/binder/mod.rs index 224ae0718a32..5c8e191c8319 100644 --- a/src/frontend/src/binder/mod.rs +++ b/src/frontend/src/binder/mod.rs @@ -574,165 +574,167 @@ mod tests { Share( BoundShare { share_id: 0, - input: Right( - RecursiveUnion { - all: true, - base: Select( - BoundSelect { - distinct: All, - select_items: [ - Literal( - Literal { - data: Some( - Int32( - 1, + input: Query( + Right( + RecursiveUnion { + all: true, + base: Select( + BoundSelect { + distinct: All, + select_items: [ + Literal( + Literal { + data: Some( + Int32( + 1, + ), ), - ), - data_type: Some( - Int32, - ), - }, - ), - ], - aliases: [ - Some( - "a", - ), - ], - from: None, - where_clause: None, - group_by: GroupKey( - [], - ), - having: None, - schema: Schema { - fields: [ - a:Int32, + data_type: Some( + Int32, + ), + }, + ), ], + aliases: [ + Some( + "a", + ), + ], + from: None, + where_clause: None, + group_by: GroupKey( + [], + ), + having: None, + schema: Schema { + fields: [ + a:Int32, + ], + }, }, - }, - ), - recursive: Select( - BoundSelect { - distinct: All, - select_items: [ - FunctionCall( - FunctionCall { - func_type: Add, - return_type: Int32, - inputs: [ - InputRef( - InputRef { - index: 0, - data_type: Int32, - }, - ), - Literal( - Literal { - data: Some( - Int32( - 1, + ), + recursive: Select( + BoundSelect { + distinct: All, + select_items: [ + FunctionCall( + FunctionCall { + func_type: Add, + return_type: Int32, + inputs: [ + InputRef( + InputRef { + index: 0, + data_type: Int32, + }, + ), + Literal( + Literal { + data: Some( + Int32( + 1, + ), ), + data_type: Some( + Int32, + ), + }, + ), + ], + }, + ), + ], + aliases: [ + None, + ], + from: Some( + BackCteRef( + BoundBackCteRef { + share_id: 0, + base: Select( + BoundSelect { + distinct: All, + select_items: [ + Literal( + Literal { + data: Some( + Int32( + 1, + ), + ), + data_type: Some( + Int32, + ), + }, + ), + ], + aliases: [ + Some( + "a", + ), + ], + from: None, + where_clause: None, + group_by: GroupKey( + [], ), - data_type: Some( - Int32, - ), + having: None, + schema: Schema { + fields: [ + a:Int32, + ], + }, }, ), - ], - }, + }, + ), ), - ], - aliases: [ - None, - ], - from: Some( - BackCteRef( - BoundBackCteRef { - share_id: 0, - base: Select( - BoundSelect { - distinct: All, - select_items: [ - Literal( - Literal { - data: Some( - Int32( - 1, - ), - ), - data_type: Some( - Int32, + where_clause: Some( + FunctionCall( + FunctionCall { + func_type: LessThan, + return_type: Boolean, + inputs: [ + InputRef( + InputRef { + index: 0, + data_type: Int32, + }, + ), + Literal( + Literal { + data: Some( + Int32( + 10, ), - }, - ), - ], - aliases: [ - Some( - "a", - ), - ], - from: None, - where_clause: None, - group_by: GroupKey( - [], + ), + data_type: Some( + Int32, + ), + }, ), - having: None, - schema: Schema { - fields: [ - a:Int32, - ], - }, - }, - ), - }, + ], + }, + ), ), - ), - where_clause: Some( - FunctionCall( - FunctionCall { - func_type: LessThan, - return_type: Boolean, - inputs: [ - InputRef( - InputRef { - index: 0, - data_type: Int32, - }, - ), - Literal( - Literal { - data: Some( - Int32( - 10, - ), - ), - data_type: Some( - Int32, - ), - }, - ), - ], - }, + group_by: GroupKey( + [], ), - ), - group_by: GroupKey( - [], - ), - having: None, - schema: Schema { - fields: [ - ?column?:Int32, - ], + having: None, + schema: Schema { + fields: [ + ?column?:Int32, + ], + }, }, + ), + schema: Schema { + fields: [ + a:Int32, + ], }, - ), - schema: Schema { - fields: [ - a:Int32, - ], }, - }, + ), ), }, ), diff --git a/src/frontend/src/optimizer/plan_node/logical_changed_log.rs b/src/frontend/src/optimizer/plan_node/logical_changed_log.rs index e0c77e230b66..f4153b1a1dfc 100644 --- a/src/frontend/src/optimizer/plan_node/logical_changed_log.rs +++ b/src/frontend/src/optimizer/plan_node/logical_changed_log.rs @@ -14,13 +14,13 @@ use super::expr_visitable::ExprVisitable; use super::generic::GenericPlanRef; -use crate::error::ErrorCode::BindError; use super::utils::impl_distill_by_unit; use super::{ gen_filter_and_pushdown, generic, ColPrunable, ColumnPruningContext, ExprRewritable, Logical, PlanBase, PlanTreeNodeUnary, PredicatePushdown, RewriteStreamContext, StreamChangedLog, StreamRowIdGen, ToBatch, ToStream, ToStreamContext, }; +use crate::error::ErrorCode::BindError; use crate::error::Result; use crate::optimizer::property::Distribution; use crate::utils::{ColIndexMapping, Condition}; diff --git a/src/sqlparser/tests/sqlparser_common.rs b/src/sqlparser/tests/sqlparser_common.rs index dc04f4de98dc..f2e7dc0bf770 100644 --- a/src/sqlparser/tests/sqlparser_common.rs +++ b/src/sqlparser/tests/sqlparser_common.rs @@ -2690,7 +2690,7 @@ fn parse_ctes() { fn assert_ctes_in_select(expected: &[&str], sel: &Query) { for (i, exp) in expected.iter().enumerate() { let Cte { alias, query, .. } = &sel.with.as_ref().unwrap().cte_tables[i]; - assert_eq!(*exp, query.to_string()); + assert_eq!(*exp, query.as_ref().unwrap().to_string()); assert_eq!( if i == 0 { Ident::new_unchecked("a") @@ -2732,7 +2732,13 @@ fn parse_ctes() { // CTE in a CTE... let sql = &format!("WITH outer_cte AS ({}) SELECT * FROM outer_cte", with); let select = verified_query(sql); - assert_ctes_in_select(&cte_sqls, &only(&select.with.unwrap().cte_tables).query); + assert_ctes_in_select( + &cte_sqls, + only(&select.with.unwrap().cte_tables) + .query + .as_ref() + .unwrap(), + ); } #[test]