qstommyshu commented on code in PR #15499: URL: https://github.com/apache/datafusion/pull/15499#discussion_r2021991253
########## datafusion/sql/tests/sql_integration.rs: ########## @@ -157,219 +157,282 @@ fn parse_ident_normalization() { #[test] fn select_no_relation() { - quick_test( - "SELECT 1", - "Projection: Int64(1)\ - \n EmptyRelation", + let plan = generate_logical_plan("SELECT 1"); + assert_snapshot!( + plan, + @r#" + Projection: Int64(1) + EmptyRelation + "# ); } #[test] fn test_real_f32() { - quick_test( - "SELECT CAST(1.1 AS REAL)", - "Projection: CAST(Float64(1.1) AS Float32)\ - \n EmptyRelation", + let plan = generate_logical_plan("SELECT CAST(1.1 AS REAL)"); + assert_snapshot!( + plan, + @r#" + Projection: CAST(Float64(1.1) AS Float32) + EmptyRelation + "# ); } #[test] fn test_int_decimal_default() { - quick_test( - "SELECT CAST(10 AS DECIMAL)", - "Projection: CAST(Int64(10) AS Decimal128(38, 10))\ - \n EmptyRelation", + let plan = generate_logical_plan("SELECT CAST(10 AS DECIMAL)"); + assert_snapshot!( + plan, + @r#" + Projection: CAST(Int64(10) AS Decimal128(38, 10)) + EmptyRelation + "# ); } #[test] fn test_int_decimal_no_scale() { - quick_test( - "SELECT CAST(10 AS DECIMAL(5))", - "Projection: CAST(Int64(10) AS Decimal128(5, 0))\ - \n EmptyRelation", + let plan = generate_logical_plan("SELECT CAST(10 AS DECIMAL(5))"); + assert_snapshot!( + plan, + @r#" + Projection: CAST(Int64(10) AS Decimal128(5, 0)) + EmptyRelation + "# ); } #[test] fn test_tinyint() { - quick_test( - "SELECT CAST(6 AS TINYINT)", - "Projection: CAST(Int64(6) AS Int8)\ - \n EmptyRelation", + let plan = generate_logical_plan("SELECT CAST(6 AS TINYINT)"); + assert_snapshot!( + plan, + @r#" + Projection: CAST(Int64(6) AS Int8) + EmptyRelation + "# ); } #[test] fn cast_from_subquery() { - quick_test( - "SELECT CAST (a AS FLOAT) FROM (SELECT 1 AS a)", - "Projection: CAST(a AS Float32)\ - \n Projection: Int64(1) AS a\ - \n EmptyRelation", + let plan = generate_logical_plan("SELECT CAST (a AS FLOAT) FROM (SELECT 1 AS a)"); + assert_snapshot!( + plan, + @r#" + Projection: CAST(a AS Float32) + Projection: Int64(1) AS a + EmptyRelation + "# ); } #[test] fn try_cast_from_aggregation() { - quick_test( - "SELECT TRY_CAST(sum(age) AS FLOAT) FROM person", - "Projection: TRY_CAST(sum(person.age) AS Float32)\ - \n Aggregate: groupBy=[[]], aggr=[[sum(person.age)]]\ - \n TableScan: person", + let plan = generate_logical_plan("SELECT TRY_CAST(sum(age) AS FLOAT) FROM person"); + assert_snapshot!( + plan, + @r#" + Projection: TRY_CAST(sum(person.age) AS Float32) + Aggregate: groupBy=[[]], aggr=[[sum(person.age)]] + TableScan: person + "# ); } #[test] fn cast_to_invalid_decimal_type_precision_0() { // precision == 0 - { Review Comment: I was confused when looking at the code initially lol. I told myself, "Maybe this bracket has some use I don't know about" 🥲 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org