From 1e8dd2f6bb64b3662a21b0e287b7aaafca624328 Mon Sep 17 00:00:00 2001 From: TennyZhuang Date: Wed, 8 May 2024 17:22:44 +0800 Subject: [PATCH] fix lambda test Signed-off-by: TennyZhuang --- src/sqlparser/tests/testdata/lambda.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sqlparser/tests/testdata/lambda.yaml b/src/sqlparser/tests/testdata/lambda.yaml index a3c502805d0b3..e82dab805171c 100644 --- a/src/sqlparser/tests/testdata/lambda.yaml +++ b/src/sqlparser/tests/testdata/lambda.yaml @@ -3,4 +3,6 @@ formatted_sql: SELECT array_transform(ARRAY[1, 2, 3], |x| x * 2) formatted_ast: 'Query(Query { with: None, body: Select(Select { distinct: All, projection: [UnnamedExpr(Function(Function { name: ObjectName([Ident { value: "array_transform", quote_style: None }]), args: [Unnamed(Expr(Array(Array { elem: [Value(Number("1")), Value(Number("2")), Value(Number("3"))], named: true }))), Unnamed(Expr(LambdaFunction { args: [Ident { value: "x", quote_style: None }], body: BinaryOp { left: Identifier(Ident { value: "x", quote_style: None }), op: Multiply, right: Value(Number("2")) } }))], variadic: false, over: None, distinct: false, order_by: [], filter: None, within_group: None }))], from: [], lateral_views: [], selection: None, group_by: [], having: None }), order_by: [], limit: None, offset: None, fetch: None })' - input: select array_transform(array[], |s| case when s ilike 'apple%' then 'apple' when s ilike 'google%' then 'google' else 'unknown' end) + formatted_sql: SELECT array_transform(ARRAY[], |s| CASE WHEN s ILIKE 'apple%' THEN 'apple' WHEN s ILIKE 'google%' THEN 'google' ELSE 'unknown' END) - input: select array_transform(array[], |x, y| x + y * 2) + formatted_sql: SELECT array_transform(ARRAY[], |x, y| x + y * 2)