kosiew commented on code in PR #26831:
URL: https://github.com/apache/datafusion/pull/26831#discussion_r4598323866


##########
datafusion/sql/tests/cases/plan_to_sql.rs:
##########
@@ -153,6 +153,9 @@ fn roundtrip_statement() -> Result<()> {
             "select id, count(*) as cnt from (select id from person) group by 
id",
             "select (id-1)/2, count(*) / (sum(id/10)-1) as agg_expr from 
(select (id-1) as id from person) group by id",
             "select CAST(id/2 as VARCHAR) NOT LIKE 'foo*' from person where 
NOT EXISTS (select ta.j1_id, tb.j2_string from j1 ta join j2 tb on (ta.j1_id = 
tb.j2_id))",
+            "select j1_string from j1 where j1_string SIMILAR TO 'a(b|c)%'",
+            "select j1_string NOT SIMILAR TO '_b%' from j1",
+            "select j1_string from j1 where j1_string SIMILAR TO 'a!%%' ESCAPE 
'!'",

Review Comment:
   Optional: could we also add `select j1_string NOT SIMILAR TO 'a!%%' ESCAPE 
'!' from j1`? Negation and escaping are already covered separately, but this 
would protect their combination through planning and unparsing. No production 
change is needed.



##########
datafusion/sql/tests/cases/plan_to_sql.rs:
##########
@@ -153,6 +153,9 @@ fn roundtrip_statement() -> Result<()> {
             "select id, count(*) as cnt from (select id from person) group by 
id",
             "select (id-1)/2, count(*) / (sum(id/10)-1) as agg_expr from 
(select (id-1) as id from person) group by id",
             "select CAST(id/2 as VARCHAR) NOT LIKE 'foo*' from person where 
NOT EXISTS (select ta.j1_id, tb.j2_string from j1 ta join j2 tb on (ta.j1_id = 
tb.j2_id))",
+            "select j1_string from j1 where j1_string SIMILAR TO 'a(b|c)%'",

Review Comment:
   Optional follow-up: could we add a focused textual round trip that renders 
the generated SQL with `to_string()`, reparses it, and compares the 
reconstructed plan for the operator-rich and escaped patterns? 
`roundtrip_statement` replans the AST directly, while the existing textual 
round-trip tests do not cover `SIMILAR TO`. No rendering defect is 
demonstrated, so this can remain a small, separate coverage improvement.



-- 
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