== Abstract Syntax Tree ==
LogicalSink(table=[fluss.nexmark.output_b721f1a794d348f68835f18e8ebb6daf], 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_b721f1a794d348f68835f18e8ebb6daf], 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_b721f1a794d348f68835f18e8ebb6daf], 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" : 4553,
    "type" : "Source: events[3105]",
    "pact" : "Data Source",
    "contents" : "[3105]: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" : 4554,
    "type" : "MiniBatchAssigner[3106]",
    "pact" : "Operator",
    "contents" : "[3106]:MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 4553,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 4555,
    "type" : "Calc[3107]",
    "pact" : "Operator",
    "contents" : "[3107]:Calc(select=[bid.auction AS auction, bid.bidder AS bidder, bid.price AS price], where=[(event_type = 2)])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 4554,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 4557,
    "type" : "Source: events[3109]",
    "pact" : "Data Source",
    "contents" : "[3109]: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" : 4558,
    "type" : "MiniBatchAssigner[3110]",
    "pact" : "Operator",
    "contents" : "[3110]:MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 4557,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 4559,
    "type" : "Calc[3111]",
    "pact" : "Operator",
    "contents" : "[3111]:Calc(select=[person.id AS id], where=[(event_type = 0)])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 4558,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 4561,
    "type" : "Join[3113]",
    "pact" : "Operator",
    "contents" : "[3113]:Join(joinType=[InnerJoin], where=[(id = bidder)], select=[auction, bidder, price, id], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey], miniBatch=[true])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 4555,
      "ship_strategy" : "HASH",
      "side" : "second"
    }, {
      "id" : 4559,
      "ship_strategy" : "HASH",
      "side" : "second"
    } ]
  }, {
    "id" : 4562,
    "type" : "Calc[3114]",
    "pact" : "Operator",
    "contents" : "[3114]:Calc(select=[auction, bidder, price])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 4561,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 4564,
    "type" : "Source: events[3116]",
    "pact" : "Data Source",
    "contents" : "[3116]: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" : 4565,
    "type" : "MiniBatchAssigner[3117]",
    "pact" : "Operator",
    "contents" : "[3117]:MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 4564,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 4566,
    "type" : "Calc[3118]",
    "pact" : "Operator",
    "contents" : "[3118]: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" : 4565,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 4568,
    "type" : "Join[3120]",
    "pact" : "Operator",
    "contents" : "[3120]:Join(joinType=[InnerJoin], where=[(seller = bidder)], select=[auction, bidder, price, itemName, dateTime, seller], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey], miniBatch=[true])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 4562,
      "ship_strategy" : "HASH",
      "side" : "second"
    }, {
      "id" : 4566,
      "ship_strategy" : "HASH",
      "side" : "second"
    } ]
  }, {
    "id" : 4574,
    "type" : "Sink(nexmark.output_b721f1a794d348f68835f18e8ebb6daf): Writer",
    "pact" : "Operator",
    "contents" : "Sink(nexmark.output_b721f1a794d348f68835f18e8ebb6daf): Writer",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 4568,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  } ]
}