incubator-wayang icon indicating copy to clipboard operation
incubator-wayang copied to clipboard

[Question] How to print/explain plans?

Open wangxiaoying opened this issue 1 year ago • 5 comments

Is there a way to explain (print out) the logical and physical plan for wayang?

wangxiaoying avatar Mar 18 '24 23:03 wangxiaoying

A quick and dirty solution as a workaround: https://github.com/apache/incubator-wayang/blob/b134ec4a8b8038486025b47091920d1a85d3f298/wayang-api/wayang-api-sql/src/test/java/org/apache/wayang/api/sql/SqlToWayangRelTest.java#L109

kbeedkar avatar Mar 19 '24 07:03 kbeedkar

Besides that, @juripetersen is currently implementing an explain() functionality in the plan builder that will print the logical, inflated, and physical plans. It should be ready soon :)

zkaoudi avatar Mar 19 '24 08:03 zkaoudi

Thanks @kbeedkar @zkaoudi for the quick reply : )

Besides that, @juripetersen is currently implementing an explain() functionality in the plan builder that will print the logical, inflated, and physical plans. It should be ready soon :)

Looking forward to this feature! I tried the one using PlanTraversal as suggested above, but it seems like the result is hard to read. For example, the Q1 and Q3 plan it printed from the wayang-benchmark TPCH test is as follows:

Q1:
Map[Calculate result fields]LocalCallbackSink[collect()]Map[Post-process line item aggregates]ReduceBy[Aggregate line items]PostgresTableSource[Load LINEITEM table]Filter[Filter line items]Map[Project line items]

Q3:
Map[Project customer-order join product]Filter[Filter line items]LocalCallbackSink[collect()]PostgresTableSource[Load LINEITEM table]Map[Extract customer ID]PostgresTableSource[Load ORDERS table]Join[Join CO with line items]PostgresTableSource[Load CUSTOMER table]Map[Unpack orders]Map[Project orders]Map[Extract line item data]Map[Project CO-line-item join product]Map[Project customers]Filter[Filter customers]Join[Join customers with orders]Map[Project line items]Filter[Filter orders]ReduceBy[Aggregate revenue]

It is a bit confusing how to interpret these outputs.

wangxiaoying avatar Mar 19 '24 18:03 wangxiaoying

Hi @wangxiaoying,

I assume you saw the last merged commit adding the explain functionality. Let us know if you have any further questions. More than happy to help out.

zkaoudi avatar Mar 24 '24 09:03 zkaoudi

Hi @wangxiaoying,

I assume you saw the last merged commit adding the explain functionality. Let us know if you have any further questions. More than happy to help out.

Thank you, I will definitely try!

wangxiaoying avatar Mar 27 '24 00:03 wangxiaoying