datafusion icon indicating copy to clipboard operation
datafusion copied to clipboard

initial prettier unparse

Open MohamedAbdeen21 opened this issue 1 year ago • 1 comments

Which issue does this PR close?

Takes a shot at #10633 .

Rationale for this change

Algorithm adopted from this SO answer.

What changes are included in this PR?

Make unparsed binary expressions easier to read.

Are these changes tested?

Can use more tests/statements/plans to unparse.

Are there any user-facing changes?

New pretty_expr_to_sql unparser function. Also IMHO I think this is better (and easier to implement, review and maintain) than directly changing the existing expr_to_sql.

MohamedAbdeen21 avatar Jun 30 '24 14:06 MohamedAbdeen21

Hi @alamb this can use more testing, match cases and moving stuff around as I'm not too familiar with the unparser. ~~And I'm still working on subtraction and division~~

Appreciate if you can provide other cases/expressions that should be tested.

MohamedAbdeen21 avatar Jun 30 '24 14:06 MohamedAbdeen21

I plan to review this tomorrow

alamb avatar Jul 01 '24 21:07 alamb

FYI @phillipleblanc

alamb avatar Jul 02 '24 16:07 alamb

Thanks @alamb and @phillipleblanc. Updated PR accordingly

I'm aware of a failing test, will look into it later today.

MohamedAbdeen21 avatar Jul 03 '24 05:07 MohamedAbdeen21

thanks @MohamedAbdeen21 -- I am very behind on reviews. I put this one on my list again

alamb avatar Jul 09 '24 21:07 alamb

cc @backkem and @devinjdangelo

alamb avatar Jul 10 '24 16:07 alamb

Here is a PR to improve the documentation https://github.com/apache/datafusion/pull/11395 (based on this one)

alamb avatar Jul 10 '24 17:07 alamb

Thanks again @MohamedAbdeen21

alamb avatar Jul 11 '24 16:07 alamb