== Abstract Syntax Tree ==
LogicalSink(table=[fluss.nexmark.output_42d1aad5c4204df8bcf11296ef46fff4], fields=[day, total_bids, rank1_bids, rank2_bids, rank3_bids, total_bidders, rank1_bidders, rank2_bidders, rank3_bidders, total_auctions, rank1_auctions, rank2_auctions, rank3_auctions])
+- LogicalAggregate(group=[{0}], total_bids=[COUNT()], rank1_bids=[COUNT() FILTER $1], rank2_bids=[COUNT() FILTER $2], rank3_bids=[COUNT() FILTER $3], total_bidders=[COUNT(DISTINCT $4)], rank1_bidders=[COUNT(DISTINCT $4) FILTER $1], rank2_bidders=[COUNT(DISTINCT $4) FILTER $2], rank3_bidders=[COUNT(DISTINCT $4) FILTER $3], total_auctions=[COUNT(DISTINCT $5)], rank1_auctions=[COUNT(DISTINCT $5) FILTER $1], rank2_auctions=[COUNT(DISTINCT $5) FILTER $2], rank3_auctions=[COUNT(DISTINCT $5) FILTER $3])
   +- LogicalProject(day=[DATE_FORMAT($5, _UTF-16LE'yyyy-MM-dd')], $f1=[IS TRUE(<($2, 10000))], $f2=[IS TRUE(SEARCH($2, Sarg[[10000..1000000)]))], $f3=[IS TRUE(>=($2, 1000000))], bidder=[$1], auction=[$0])
      +- 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_42d1aad5c4204df8bcf11296ef46fff4], fields=[day, total_bids, rank1_bids, rank2_bids, rank3_bids, total_bidders, rank1_bidders, rank2_bidders, rank3_bidders, total_auctions, rank1_auctions, rank2_auctions, rank3_auctions])
+- GlobalGroupAggregate(groupBy=[day], select=[day, COUNT(count1$0) AS total_bids, COUNT(count1$1) AS rank1_bids, COUNT(count1$2) AS rank2_bids, COUNT(count1$3) AS rank3_bids, COUNT(distinct$0 count$4) AS total_bidders, COUNT(distinct$0 count$5) AS rank1_bidders, COUNT(distinct$0 count$6) AS rank2_bidders, COUNT(distinct$0 count$7) AS rank3_bidders, COUNT(distinct$1 count$8) AS total_auctions, COUNT(distinct$1 count$9) AS rank1_auctions, COUNT(distinct$1 count$10) AS rank2_auctions, COUNT(distinct$1 count$11) AS rank3_auctions])
   +- Exchange(distribution=[hash[day]])
      +- LocalGroupAggregate(groupBy=[day], select=[day, COUNT(*) AS count1$0, COUNT(*) FILTER $f1 AS count1$1, COUNT(*) FILTER $f2 AS count1$2, COUNT(*) FILTER $f3 AS count1$3, COUNT(distinct$0 bidder) AS count$4, COUNT(distinct$0 bidder) FILTER $f1 AS count$5, COUNT(distinct$0 bidder) FILTER $f2 AS count$6, COUNT(distinct$0 bidder) FILTER $f3 AS count$7, COUNT(distinct$1 auction) AS count$8, COUNT(distinct$1 auction) FILTER $f1 AS count$9, COUNT(distinct$1 auction) FILTER $f2 AS count$10, COUNT(distinct$1 auction) FILTER $f3 AS count$11, DISTINCT(bidder) AS distinct$0, DISTINCT(auction) AS distinct$1])
         +- Calc(select=[DATE_FORMAT(CAST(Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS TIMESTAMP_WITH_LOCAL_TIME_ZONE(3)), _UTF-16LE'yyyy-MM-dd') AS day, IS TRUE(<(bid.price, 10000)) AS $f1, IS TRUE(SEARCH(bid.price, Sarg[[10000..1000000)])) AS $f2, IS TRUE(>=(bid.price, 1000000)) AS $f3, bid.bidder AS bidder, bid.auction AS auction], 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])

== Optimized Execution Plan ==
Sink(table=[fluss.nexmark.output_42d1aad5c4204df8bcf11296ef46fff4], fields=[day, total_bids, rank1_bids, rank2_bids, rank3_bids, total_bidders, rank1_bidders, rank2_bidders, rank3_bidders, total_auctions, rank1_auctions, rank2_auctions, rank3_auctions])
+- GlobalGroupAggregate(groupBy=[day], select=[day, COUNT(count1$0) AS total_bids, COUNT(count1$1) AS rank1_bids, COUNT(count1$2) AS rank2_bids, COUNT(count1$3) AS rank3_bids, COUNT(distinct$0 count$4) AS total_bidders, COUNT(distinct$0 count$5) AS rank1_bidders, COUNT(distinct$0 count$6) AS rank2_bidders, COUNT(distinct$0 count$7) AS rank3_bidders, COUNT(distinct$1 count$8) AS total_auctions, COUNT(distinct$1 count$9) AS rank1_auctions, COUNT(distinct$1 count$10) AS rank2_auctions, COUNT(distinct$1 count$11) AS rank3_auctions])
   +- Exchange(distribution=[hash[day]])
      +- LocalGroupAggregate(groupBy=[day], select=[day, COUNT(*) AS count1$0, COUNT(*) FILTER $f1 AS count1$1, COUNT(*) FILTER $f2 AS count1$2, COUNT(*) FILTER $f3 AS count1$3, COUNT(distinct$0 bidder) AS count$4, COUNT(distinct$0 bidder) FILTER $f1 AS count$5, COUNT(distinct$0 bidder) FILTER $f2 AS count$6, COUNT(distinct$0 bidder) FILTER $f3 AS count$7, COUNT(distinct$1 auction) AS count$8, COUNT(distinct$1 auction) FILTER $f1 AS count$9, COUNT(distinct$1 auction) FILTER $f2 AS count$10, COUNT(distinct$1 auction) FILTER $f3 AS count$11, DISTINCT(bidder) AS distinct$0, DISTINCT(auction) AS distinct$1])
         +- Calc(select=[DATE_FORMAT(CAST(Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS TIMESTAMP_WITH_LOCAL_TIME_ZONE(3)), 'yyyy-MM-dd') AS day, (bid.price < 10000) IS TRUE AS $f1, SEARCH(bid.price, Sarg[[10000..1000000)]) IS TRUE AS $f2, (bid.price >= 1000000) IS TRUE AS $f3, bid.bidder AS bidder, bid.auction AS auction], 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])

== Physical Execution Plan ==
{
  "nodes" : [ {
    "id" : 2715,
    "type" : "Source: events[1889]",
    "pact" : "Data Source",
    "contents" : "[1889]: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" : 2716,
    "type" : "MiniBatchAssigner[1890]",
    "pact" : "Operator",
    "contents" : "[1890]:MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2715,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2717,
    "type" : "Calc[1891]",
    "pact" : "Operator",
    "contents" : "[1891]:Calc(select=[DATE_FORMAT(CAST(Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS TIMESTAMP_WITH_LOCAL_TIME_ZONE(3)), 'yyyy-MM-dd') AS day, (bid.price < 10000) IS TRUE AS $f1, SEARCH(bid.price, Sarg[[10000..1000000)]) IS TRUE AS $f2, (bid.price >= 1000000) IS TRUE AS $f3, bid.bidder AS bidder, bid.auction AS auction], where=[(event_type = 2)])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2716,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2718,
    "type" : "LocalGroupAggregate[1892]",
    "pact" : "Operator",
    "contents" : "[1892]:LocalGroupAggregate(groupBy=[day], select=[day, COUNT(*) AS count1$0, COUNT(*) FILTER $f1 AS count1$1, COUNT(*) FILTER $f2 AS count1$2, COUNT(*) FILTER $f3 AS count1$3, COUNT(distinct$0 bidder) AS count$4, COUNT(distinct$0 bidder) FILTER $f1 AS count$5, COUNT(distinct$0 bidder) FILTER $f2 AS count$6, COUNT(distinct$0 bidder) FILTER $f3 AS count$7, COUNT(distinct$1 auction) AS count$8, COUNT(distinct$1 auction) FILTER $f1 AS count$9, COUNT(distinct$1 auction) FILTER $f2 AS count$10, COUNT(distinct$1 auction) FILTER $f3 AS count$11, DISTINCT(bidder) AS distinct$0, DISTINCT(auction) AS distinct$1])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2717,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2720,
    "type" : "GlobalGroupAggregate[1894]",
    "pact" : "Operator",
    "contents" : "[1894]:GlobalGroupAggregate(groupBy=[day], select=[day, COUNT(count1$0) AS total_bids, COUNT(count1$1) AS rank1_bids, COUNT(count1$2) AS rank2_bids, COUNT(count1$3) AS rank3_bids, COUNT(distinct$0 count$4) AS total_bidders, COUNT(distinct$0 count$5) AS rank1_bidders, COUNT(distinct$0 count$6) AS rank2_bidders, COUNT(distinct$0 count$7) AS rank3_bidders, COUNT(distinct$1 count$8) AS total_auctions, COUNT(distinct$1 count$9) AS rank1_auctions, COUNT(distinct$1 count$10) AS rank2_auctions, COUNT(distinct$1 count$11) AS rank3_auctions])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2718,
      "ship_strategy" : "HASH",
      "side" : "second"
    } ]
  }, {
    "id" : 2721,
    "type" : "ConstraintEnforcer[1895]",
    "pact" : "Operator",
    "contents" : "[1895]:ConstraintEnforcer[NotNullEnforcer(fields=[day])]",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2720,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2726,
    "type" : "Sink(nexmark.output_42d1aad5c4204df8bcf11296ef46fff4): Writer",
    "pact" : "Operator",
    "contents" : "Sink(nexmark.output_42d1aad5c4204df8bcf11296ef46fff4): Writer",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2721,
      "ship_strategy" : "BUCKET",
      "side" : "second"
    } ]
  } ]
}