nuno-faria commented on code in PR #27005:
URL: https://github.com/apache/datafusion/pull/27005#discussion_r4460911960


##########
datafusion/core/benches/sql_planner.rs:
##########
@@ -1013,6 +1013,66 @@ fn criterion_benchmark(c: &mut Criterion) {
         })
     });
 
+    // --- CTE materialization (unmarked, MATERIALIZED, NOT MATERIALIZED) ---
+    // A materialized CTE body is optimized on its own before the rest of the
+    // plan, so these measure that extra planning against inlined CTEs.
+    {
+        // sqlparser only parses `[NOT] MATERIALIZED` for the PostgreSQL 
dialect.
+        let cte_ctx = create_context();
+        rt.block_on(cte_ctx.sql("SET datafusion.sql_parser.dialect = 
'PostgreSQL'"))
+            .unwrap();
+
+        let body = "SELECT a0, a1, SUM(a2) AS s FROM t1 WHERE a3 > 0 GROUP BY 
a0, a1";
+        let two_refs = "SELECT x.a0, x.s, y.s FROM c x JOIN c y ON x.a0 = 
y.a1";
+        for (name, marker) in [
+            ("unmarked", ""),
+            ("materialized", "MATERIALIZED "),
+            ("not_materialized", "NOT MATERIALIZED "),

Review Comment:
   Makes sense, thanks.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to