== Abstract Syntax Tree ==
LogicalSink(table=[fluss.nexmark.output_0eef4376a7e34ff09c25632312760070], fields=[auction, bidder, price, channel, url, dateTime, extra])
+- LogicalProject(auction=[$0], bidder=[$1], price=[$2], channel=[$3], url=[$4], dateTime=[$5], extra=[$6])
   +- LogicalFilter(condition=[<=($7, 1)])
      +- LogicalProject(auction=[$0], bidder=[$1], price=[$2], channel=[$3], url=[$4], dateTime=[$5], extra=[$6], rank_number=[ROW_NUMBER() OVER (PARTITION BY $1, $0 ORDER BY $5 DESC NULLS LAST)])
         +- 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]])

== Optimized Physical Plan ==
Sink(table=[fluss.nexmark.output_0eef4376a7e34ff09c25632312760070], fields=[auction, bidder, price, channel, url, dateTime, extra])
+- Calc(select=[$1 AS auction, $2 AS bidder, $3 AS price, $4 AS channel, $5 AS url, rowtime AS dateTime, $6 AS extra])
   +- Rank(strategy=[AppendFastStrategy], rankType=[ROW_NUMBER], rankRange=[rankStart=1, rankEnd=1], partitionBy=[$1, $2], orderBy=[ROWTIME rowtime DESC], select=[rowtime, $1, $2, $3, $4, $5, $6])
      +- Exchange(distribution=[hash[$1, $2]])
         +- Calc(select=[Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS rowtime, bid.auction AS $1, bid.bidder AS $2, bid.price AS $3, bid.channel AS $4, bid.url AS $5, bid.extra AS $6], where=[=(event_type, 2)])
            +- 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])

== Optimized Execution Plan ==
Sink(table=[fluss.nexmark.output_0eef4376a7e34ff09c25632312760070], fields=[auction, bidder, price, channel, url, dateTime, extra])
+- Calc(select=[$1 AS auction, $2 AS bidder, $3 AS price, $4 AS channel, $5 AS url, rowtime AS dateTime, $6 AS extra])
   +- Deduplicate(keep=[LastRow], key=[$1, $2], order=[ROWTIME], outputInsertOnly=[false])
      +- Exchange(distribution=[hash[$1, $2]])
         +- Calc(select=[Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS rowtime, bid.auction AS $1, bid.bidder AS $2, bid.price AS $3, bid.channel AS $4, bid.url AS $5, bid.extra AS $6], where=[(event_type = 2)])
            +- 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])

== Physical Execution Plan ==
{
  "nodes" : [ {
    "id" : 2853,
    "type" : "Source: events[1791]",
    "pact" : "Data Source",
    "contents" : "[1791]: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" : 2854,
    "type" : "Calc[1792]",
    "pact" : "Operator",
    "contents" : "[1792]:Calc(select=[Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS rowtime, bid.auction AS $1, bid.bidder AS $2, bid.price AS $3, bid.channel AS $4, bid.url AS $5, bid.extra AS $6], where=[(event_type = 2)])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2853,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2856,
    "type" : "Deduplicate[1794]",
    "pact" : "Operator",
    "contents" : "[1794]:Deduplicate(keep=[LastRow], key=[$1, $2], order=[ROWTIME], outputInsertOnly=[false])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2854,
      "ship_strategy" : "HASH",
      "side" : "second"
    } ]
  }, {
    "id" : 2857,
    "type" : "Calc[1795]",
    "pact" : "Operator",
    "contents" : "[1795]:Calc(select=[$1 AS auction, $2 AS bidder, $3 AS price, $4 AS channel, $5 AS url, rowtime AS dateTime, $6 AS extra])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2856,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2858,
    "type" : "ConstraintEnforcer[1796]",
    "pact" : "Operator",
    "contents" : "[1796]:ConstraintEnforcer[NotNullEnforcer(fields=[auction, bidder])]",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2857,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2859,
    "type" : "StreamRecordTimestampInserter[1796]",
    "pact" : "Operator",
    "contents" : "[1796]:StreamRecordTimestampInserter(rowtime field: 5)",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2858,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2864,
    "type" : "Sink(nexmark.output_0eef4376a7e34ff09c25632312760070): Writer",
    "pact" : "Operator",
    "contents" : "Sink(nexmark.output_0eef4376a7e34ff09c25632312760070): Writer",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2859,
      "ship_strategy" : "BUCKET",
      "side" : "second"
    } ]
  } ]
}