== Abstract Syntax Tree ==
LogicalSink(table=[fluss.nexmark.output_7623767ef88f40639a74626b78239016], fields=[auction, bidder, price, itemName, dateTime, seller])
+- LogicalProject(auction=[$0], bidder=[$1], price=[$2], itemName=[$16], dateTime=[$20], seller=[$22])
   +- LogicalJoin(condition=[=($22, $1)], joinType=[inner])
      :- LogicalJoin(condition=[=($7, $1)], joinType=[inner])
      :  :- LogicalProject(auction=[$3.auction], bidder=[$3.bidder], price=[$3.price], channel=[$3.channel], url=[$3.url], dateTime=[$5], extra=[$3.extra])
      :  :  +- LogicalFilter(condition=[=($0, 2)])
      :  :     +- LogicalProject(event_type=[$0], person=[$1], auction=[$2], bid=[$3], dateTime=[$4], rowtime=[$5])
      :  :        +- LogicalWatermarkAssigner(rowtime=[rowtime], watermark=[-($5, 4000:INTERVAL SECOND)])
      :  :           +- LogicalProject(event_type=[$0], person=[$1], auction=[$2], bid=[$3], dateTime=[$4], rowtime=[TO_TIMESTAMP_LTZ($4, 3)])
      :  :              +- LogicalTableScan(table=[[fluss, nexmark, events]])
      :  +- LogicalProject(id=[$1.id], name=[$1.name], emailAddress=[$1.emailAddress], creditCard=[$1.creditCard], city=[$1.city], state=[$1.state], dateTime=[$5], extra=[$1.extra])
      :     +- LogicalFilter(condition=[=($0, 0)])
      :        +- LogicalProject(event_type=[$0], person=[$1], auction=[$2], bid=[$3], dateTime=[$4], rowtime=[$5])
      :           +- LogicalWatermarkAssigner(rowtime=[rowtime], watermark=[-($5, 4000:INTERVAL SECOND)])
      :              +- LogicalProject(event_type=[$0], person=[$1], auction=[$2], bid=[$3], dateTime=[$4], rowtime=[TO_TIMESTAMP_LTZ($4, 3)])
      :                 +- LogicalTableScan(table=[[fluss, nexmark, events]])
      +- LogicalProject(id=[$2.id], itemName=[$2.itemName], description=[$2.description], initialBid=[$2.initialBid], reserve=[$2.reserve], dateTime=[$5], expires=[TO_TIMESTAMP_LTZ($2.expires, 3)], seller=[$2.seller], category=[$2.category], extra=[$2.extra])
         +- LogicalFilter(condition=[=($0, 1)])
            +- LogicalProject(event_type=[$0], person=[$1], auction=[$2], bid=[$3], dateTime=[$4], rowtime=[$5])
               +- LogicalWatermarkAssigner(rowtime=[rowtime], watermark=[-($5, 4000:INTERVAL SECOND)])
                  +- LogicalProject(event_type=[$0], person=[$1], auction=[$2], bid=[$3], dateTime=[$4], rowtime=[TO_TIMESTAMP_LTZ($4, 3)])
                     +- LogicalTableScan(table=[[fluss, nexmark, events]])

== Optimized Physical Plan ==
Sink(table=[fluss.nexmark.output_7623767ef88f40639a74626b78239016], fields=[auction, bidder, price, itemName, dateTime, seller])
+- Join(joinType=[InnerJoin], where=[=(seller, bidder)], select=[auction, bidder, price, itemName, dateTime, seller], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey], miniBatch=[true])
   :- Exchange(distribution=[hash[bidder]])
   :  +- Calc(select=[auction, bidder, price])
   :     +- Join(joinType=[InnerJoin], where=[=(id, bidder)], select=[auction, bidder, price, id], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey], miniBatch=[true])
   :        :- Exchange(distribution=[hash[bidder]])
   :        :  +- Calc(select=[bid.auction AS auction, bid.bidder AS bidder, bid.price AS price], where=[=(event_type, 2)])
   :        :     +- MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])
   :        :        +- TableSourceScan(table=[[fluss, nexmark, events, project=[event_type, bid, dateTime], watermark=[-(TO_TIMESTAMP_LTZ(dateTime, 3), 4000:INTERVAL SECOND)], watermarkEmitStrategy=[on-periodic], filter=[]]], fields=[event_type, bid, dateTime])
   :        +- Exchange(distribution=[hash[id]])
   :           +- Calc(select=[person.id AS id], where=[=(event_type, 0)])
   :              +- MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])
   :                 +- TableSourceScan(table=[[fluss, nexmark, events, project=[event_type, person, dateTime], watermark=[-(TO_TIMESTAMP_LTZ(dateTime, 3), 4000:INTERVAL SECOND)], watermarkEmitStrategy=[on-periodic], filter=[]]], fields=[event_type, person, dateTime])
   +- Exchange(distribution=[hash[seller]])
      +- Calc(select=[auction.itemName AS itemName, CAST(Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS TIMESTAMP_WITH_LOCAL_TIME_ZONE(3)) AS dateTime, auction.seller AS seller], where=[=(event_type, 1)])
         +- MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])
            +- TableSourceScan(table=[[fluss, nexmark, events, project=[event_type, auction, dateTime], watermark=[-(TO_TIMESTAMP_LTZ(dateTime, 3), 4000:INTERVAL SECOND)], watermarkEmitStrategy=[on-periodic], filter=[]]], fields=[event_type, auction, dateTime])

== Optimized Execution Plan ==
Sink(table=[fluss.nexmark.output_7623767ef88f40639a74626b78239016], fields=[auction, bidder, price, itemName, dateTime, seller])
+- Join(joinType=[InnerJoin], where=[(seller = bidder)], select=[auction, bidder, price, itemName, dateTime, seller], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey], miniBatch=[true])
   :- Exchange(distribution=[hash[bidder]])
   :  +- Calc(select=[auction, bidder, price])
   :     +- Join(joinType=[InnerJoin], where=[(id = bidder)], select=[auction, bidder, price, id], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey], miniBatch=[true])
   :        :- Exchange(distribution=[hash[bidder]])
   :        :  +- Calc(select=[bid.auction AS auction, bid.bidder AS bidder, bid.price AS price], where=[(event_type = 2)])
   :        :     +- MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])
   :        :        +- TableSourceScan(table=[[fluss, nexmark, events, project=[event_type, bid, dateTime], watermark=[-(TO_TIMESTAMP_LTZ(dateTime, 3), 4000:INTERVAL SECOND)], watermarkEmitStrategy=[on-periodic], filter=[]]], fields=[event_type, bid, dateTime])
   :        +- Exchange(distribution=[hash[id]])
   :           +- Calc(select=[person.id AS id], where=[(event_type = 0)])
   :              +- MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])
   :                 +- TableSourceScan(table=[[fluss, nexmark, events, project=[event_type, person, dateTime], watermark=[-(TO_TIMESTAMP_LTZ(dateTime, 3), 4000:INTERVAL SECOND)], watermarkEmitStrategy=[on-periodic], filter=[]]], fields=[event_type, person, dateTime])
   +- Exchange(distribution=[hash[seller]])
      +- Calc(select=[auction.itemName AS itemName, CAST(Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS TIMESTAMP_WITH_LOCAL_TIME_ZONE(3)) AS dateTime, auction.seller AS seller], where=[(event_type = 1)])
         +- MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])
            +- TableSourceScan(table=[[fluss, nexmark, events, project=[event_type, auction, dateTime], watermark=[-(TO_TIMESTAMP_LTZ(dateTime, 3), 4000:INTERVAL SECOND)], watermarkEmitStrategy=[on-periodic], filter=[]]], fields=[event_type, auction, dateTime])

== Physical Execution Plan ==
{
  "nodes" : [ {
    "id" : 4671,
    "type" : "Source: events[3183]",
    "pact" : "Data Source",
    "contents" : "[3183]:TableSourceScan(table=[[fluss, nexmark, events, project=[event_type, bid, dateTime], watermark=[-(TO_TIMESTAMP_LTZ(dateTime, 3), 4000:INTERVAL SECOND)], watermarkEmitStrategy=[on-periodic], filter=[]]], fields=[event_type, bid, dateTime])",
    "parallelism" : 4
  }, {
    "id" : 4672,
    "type" : "MiniBatchAssigner[3184]",
    "pact" : "Operator",
    "contents" : "[3184]:MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 4671,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 4673,
    "type" : "Calc[3185]",
    "pact" : "Operator",
    "contents" : "[3185]:Calc(select=[bid.auction AS auction, bid.bidder AS bidder, bid.price AS price], where=[(event_type = 2)])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 4672,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 4675,
    "type" : "Source: events[3187]",
    "pact" : "Data Source",
    "contents" : "[3187]:TableSourceScan(table=[[fluss, nexmark, events, project=[event_type, person, dateTime], watermark=[-(TO_TIMESTAMP_LTZ(dateTime, 3), 4000:INTERVAL SECOND)], watermarkEmitStrategy=[on-periodic], filter=[]]], fields=[event_type, person, dateTime])",
    "parallelism" : 4
  }, {
    "id" : 4676,
    "type" : "MiniBatchAssigner[3188]",
    "pact" : "Operator",
    "contents" : "[3188]:MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 4675,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 4677,
    "type" : "Calc[3189]",
    "pact" : "Operator",
    "contents" : "[3189]:Calc(select=[person.id AS id], where=[(event_type = 0)])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 4676,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 4679,
    "type" : "Join[3191]",
    "pact" : "Operator",
    "contents" : "[3191]:Join(joinType=[InnerJoin], where=[(id = bidder)], select=[auction, bidder, price, id], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey], miniBatch=[true])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 4673,
      "ship_strategy" : "HASH",
      "side" : "second"
    }, {
      "id" : 4677,
      "ship_strategy" : "HASH",
      "side" : "second"
    } ]
  }, {
    "id" : 4680,
    "type" : "Calc[3192]",
    "pact" : "Operator",
    "contents" : "[3192]:Calc(select=[auction, bidder, price])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 4679,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 4682,
    "type" : "Source: events[3194]",
    "pact" : "Data Source",
    "contents" : "[3194]:TableSourceScan(table=[[fluss, nexmark, events, project=[event_type, auction, dateTime], watermark=[-(TO_TIMESTAMP_LTZ(dateTime, 3), 4000:INTERVAL SECOND)], watermarkEmitStrategy=[on-periodic], filter=[]]], fields=[event_type, auction, dateTime])",
    "parallelism" : 4
  }, {
    "id" : 4683,
    "type" : "MiniBatchAssigner[3195]",
    "pact" : "Operator",
    "contents" : "[3195]:MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 4682,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 4684,
    "type" : "Calc[3196]",
    "pact" : "Operator",
    "contents" : "[3196]:Calc(select=[auction.itemName AS itemName, CAST(Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS TIMESTAMP_WITH_LOCAL_TIME_ZONE(3)) AS dateTime, auction.seller AS seller], where=[(event_type = 1)])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 4683,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 4686,
    "type" : "Join[3198]",
    "pact" : "Operator",
    "contents" : "[3198]:Join(joinType=[InnerJoin], where=[(seller = bidder)], select=[auction, bidder, price, itemName, dateTime, seller], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey], miniBatch=[true])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 4680,
      "ship_strategy" : "HASH",
      "side" : "second"
    }, {
      "id" : 4684,
      "ship_strategy" : "HASH",
      "side" : "second"
    } ]
  }, {
    "id" : 4692,
    "type" : "Sink(nexmark.output_7623767ef88f40639a74626b78239016): Writer",
    "pact" : "Operator",
    "contents" : "Sink(nexmark.output_7623767ef88f40639a74626b78239016): Writer",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 4686,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  } ]
}