== Abstract Syntax Tree ==
LogicalSink(table=[fluss.nexmark.output_babdbb2139044e68bafac827bb48d026], 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_babdbb2139044e68bafac827bb48d026], 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_babdbb2139044e68bafac827bb48d026], 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" : 2805,
    "type" : "Source: events[1931]",
    "pact" : "Data Source",
    "contents" : "[1931]: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" : 2806,
    "type" : "MiniBatchAssigner[1932]",
    "pact" : "Operator",
    "contents" : "[1932]:MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2805,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2807,
    "type" : "Calc[1933]",
    "pact" : "Operator",
    "contents" : "[1933]: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" : 2806,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2808,
    "type" : "LocalGroupAggregate[1934]",
    "pact" : "Operator",
    "contents" : "[1934]: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" : 2807,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2810,
    "type" : "GlobalGroupAggregate[1936]",
    "pact" : "Operator",
    "contents" : "[1936]: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" : 2808,
      "ship_strategy" : "HASH",
      "side" : "second"
    } ]
  }, {
    "id" : 2811,
    "type" : "ConstraintEnforcer[1937]",
    "pact" : "Operator",
    "contents" : "[1937]:ConstraintEnforcer[NotNullEnforcer(fields=[channel, day])]",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2810,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2816,
    "type" : "Sink(nexmark.output_babdbb2139044e68bafac827bb48d026): Writer",
    "pact" : "Operator",
    "contents" : "Sink(nexmark.output_babdbb2139044e68bafac827bb48d026): Writer",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2811,
      "ship_strategy" : "BUCKET",
      "side" : "second"
    } ]
  } ]
}