== Abstract Syntax Tree ==
LogicalSink(table=[fluss.nexmark.output_fb230d584887436997d2698e8a0060e5], fields=[channel, day, minute, 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, 1}], minute=[MAX($2)], total_bids=[COUNT()], rank1_bids=[COUNT() FILTER $3], rank2_bids=[COUNT() FILTER $4], rank3_bids=[COUNT() FILTER $5], total_bidders=[COUNT(DISTINCT $6)], rank1_bidders=[COUNT(DISTINCT $6) FILTER $3], rank2_bidders=[COUNT(DISTINCT $6) FILTER $4], rank3_bidders=[COUNT(DISTINCT $6) FILTER $5], total_auctions=[COUNT(DISTINCT $7)], rank1_auctions=[COUNT(DISTINCT $7) FILTER $3], rank2_auctions=[COUNT(DISTINCT $7) FILTER $4], rank3_auctions=[COUNT(DISTINCT $7) FILTER $5])
   +- LogicalProject(channel=[$3], day=[DATE_FORMAT($5, _UTF-16LE'yyyy-MM-dd')], $f2=[DATE_FORMAT($5, _UTF-16LE'HH:mm')], $f3=[IS TRUE(<($2, 10000))], $f4=[IS TRUE(SEARCH($2, Sarg[[10000..1000000)]))], $f5=[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_fb230d584887436997d2698e8a0060e5], fields=[channel, day, minute, 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=[channel, day], select=[channel, day, MAX(max$0) AS minute, COUNT(count1$1) AS total_bids, COUNT(count1$2) AS rank1_bids, COUNT(count1$3) AS rank2_bids, COUNT(count1$4) AS rank3_bids, COUNT(distinct$0 count$5) AS total_bidders, COUNT(distinct$0 count$6) AS rank1_bidders, COUNT(distinct$0 count$7) AS rank2_bidders, COUNT(distinct$0 count$8) AS rank3_bidders, COUNT(distinct$1 count$9) AS total_auctions, COUNT(distinct$1 count$10) AS rank1_auctions, COUNT(distinct$1 count$11) AS rank2_auctions, COUNT(distinct$1 count$12) AS rank3_auctions])
   +- Exchange(distribution=[hash[channel, day]])
      +- LocalGroupAggregate(groupBy=[channel, day], select=[channel, day, MAX($f2) AS max$0, COUNT(*) AS count1$1, COUNT(*) FILTER $f3 AS count1$2, COUNT(*) FILTER $f4 AS count1$3, COUNT(*) FILTER $f5 AS count1$4, COUNT(distinct$0 bidder) AS count$5, COUNT(distinct$0 bidder) FILTER $f3 AS count$6, COUNT(distinct$0 bidder) FILTER $f4 AS count$7, COUNT(distinct$0 bidder) FILTER $f5 AS count$8, COUNT(distinct$1 auction) AS count$9, COUNT(distinct$1 auction) FILTER $f3 AS count$10, COUNT(distinct$1 auction) FILTER $f4 AS count$11, COUNT(distinct$1 auction) FILTER $f5 AS count$12, DISTINCT(bidder) AS distinct$0, DISTINCT(auction) AS distinct$1])
         +- Calc(select=[bid.channel AS channel, DATE_FORMAT(CAST(Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS TIMESTAMP_WITH_LOCAL_TIME_ZONE(3)), _UTF-16LE'yyyy-MM-dd') AS day, DATE_FORMAT(CAST(Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS TIMESTAMP_WITH_LOCAL_TIME_ZONE(3)), _UTF-16LE'HH:mm') AS $f2, IS TRUE(<(bid.price, 10000)) AS $f3, IS TRUE(SEARCH(bid.price, Sarg[[10000..1000000)])) AS $f4, IS TRUE(>=(bid.price, 1000000)) AS $f5, 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_fb230d584887436997d2698e8a0060e5], fields=[channel, day, minute, 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=[channel, day], select=[channel, day, MAX(max$0) AS minute, COUNT(count1$1) AS total_bids, COUNT(count1$2) AS rank1_bids, COUNT(count1$3) AS rank2_bids, COUNT(count1$4) AS rank3_bids, COUNT(distinct$0 count$5) AS total_bidders, COUNT(distinct$0 count$6) AS rank1_bidders, COUNT(distinct$0 count$7) AS rank2_bidders, COUNT(distinct$0 count$8) AS rank3_bidders, COUNT(distinct$1 count$9) AS total_auctions, COUNT(distinct$1 count$10) AS rank1_auctions, COUNT(distinct$1 count$11) AS rank2_auctions, COUNT(distinct$1 count$12) AS rank3_auctions])
   +- Exchange(distribution=[hash[channel, day]])
      +- LocalGroupAggregate(groupBy=[channel, day], select=[channel, day, MAX($f2) AS max$0, COUNT(*) AS count1$1, COUNT(*) FILTER $f3 AS count1$2, COUNT(*) FILTER $f4 AS count1$3, COUNT(*) FILTER $f5 AS count1$4, COUNT(distinct$0 bidder) AS count$5, COUNT(distinct$0 bidder) FILTER $f3 AS count$6, COUNT(distinct$0 bidder) FILTER $f4 AS count$7, COUNT(distinct$0 bidder) FILTER $f5 AS count$8, COUNT(distinct$1 auction) AS count$9, COUNT(distinct$1 auction) FILTER $f3 AS count$10, COUNT(distinct$1 auction) FILTER $f4 AS count$11, COUNT(distinct$1 auction) FILTER $f5 AS count$12, DISTINCT(bidder) AS distinct$0, DISTINCT(auction) AS distinct$1])
         +- Calc(select=[bid.channel AS channel, DATE_FORMAT(CAST(Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS TIMESTAMP_WITH_LOCAL_TIME_ZONE(3)), 'yyyy-MM-dd') AS day, DATE_FORMAT(CAST(Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS TIMESTAMP_WITH_LOCAL_TIME_ZONE(3)), 'HH:mm') AS $f2, (bid.price < 10000) IS TRUE AS $f3, SEARCH(bid.price, Sarg[[10000..1000000)]) IS TRUE AS $f4, (bid.price >= 1000000) IS TRUE AS $f5, 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" : 2923,
    "type" : "Source: events[2009]",
    "pact" : "Data Source",
    "contents" : "[2009]: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" : 2924,
    "type" : "MiniBatchAssigner[2010]",
    "pact" : "Operator",
    "contents" : "[2010]:MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2923,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2925,
    "type" : "Calc[2011]",
    "pact" : "Operator",
    "contents" : "[2011]:Calc(select=[bid.channel AS channel, DATE_FORMAT(CAST(Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS TIMESTAMP_WITH_LOCAL_TIME_ZONE(3)), 'yyyy-MM-dd') AS day, DATE_FORMAT(CAST(Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS TIMESTAMP_WITH_LOCAL_TIME_ZONE(3)), 'HH:mm') AS $f2, (bid.price < 10000) IS TRUE AS $f3, SEARCH(bid.price, Sarg[[10000..1000000)]) IS TRUE AS $f4, (bid.price >= 1000000) IS TRUE AS $f5, bid.bidder AS bidder, bid.auction AS auction], where=[(event_type = 2)])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2924,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2926,
    "type" : "LocalGroupAggregate[2012]",
    "pact" : "Operator",
    "contents" : "[2012]:LocalGroupAggregate(groupBy=[channel, day], select=[channel, day, MAX($f2) AS max$0, COUNT(*) AS count1$1, COUNT(*) FILTER $f3 AS count1$2, COUNT(*) FILTER $f4 AS count1$3, COUNT(*) FILTER $f5 AS count1$4, COUNT(distinct$0 bidder) AS count$5, COUNT(distinct$0 bidder) FILTER $f3 AS count$6, COUNT(distinct$0 bidder) FILTER $f4 AS count$7, COUNT(distinct$0 bidder) FILTER $f5 AS count$8, COUNT(distinct$1 auction) AS count$9, COUNT(distinct$1 auction) FILTER $f3 AS count$10, COUNT(distinct$1 auction) FILTER $f4 AS count$11, COUNT(distinct$1 auction) FILTER $f5 AS count$12, DISTINCT(bidder) AS distinct$0, DISTINCT(auction) AS distinct$1])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2925,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2928,
    "type" : "GlobalGroupAggregate[2014]",
    "pact" : "Operator",
    "contents" : "[2014]:GlobalGroupAggregate(groupBy=[channel, day], select=[channel, day, MAX(max$0) AS minute, COUNT(count1$1) AS total_bids, COUNT(count1$2) AS rank1_bids, COUNT(count1$3) AS rank2_bids, COUNT(count1$4) AS rank3_bids, COUNT(distinct$0 count$5) AS total_bidders, COUNT(distinct$0 count$6) AS rank1_bidders, COUNT(distinct$0 count$7) AS rank2_bidders, COUNT(distinct$0 count$8) AS rank3_bidders, COUNT(distinct$1 count$9) AS total_auctions, COUNT(distinct$1 count$10) AS rank1_auctions, COUNT(distinct$1 count$11) AS rank2_auctions, COUNT(distinct$1 count$12) AS rank3_auctions])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2926,
      "ship_strategy" : "HASH",
      "side" : "second"
    } ]
  }, {
    "id" : 2929,
    "type" : "ConstraintEnforcer[2015]",
    "pact" : "Operator",
    "contents" : "[2015]:ConstraintEnforcer[NotNullEnforcer(fields=[channel, day])]",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2928,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2934,
    "type" : "Sink(nexmark.output_fb230d584887436997d2698e8a0060e5): Writer",
    "pact" : "Operator",
    "contents" : "Sink(nexmark.output_fb230d584887436997d2698e8a0060e5): Writer",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2929,
      "ship_strategy" : "BUCKET",
      "side" : "second"
    } ]
  } ]
}