== Abstract Syntax Tree ==
LogicalSink(table=[default_catalog.default_database.sink], fields=[auction, bidder, price, channel, url, dateTime, extra, itemName, description, initialBid, reserve, dateTime0, expires, seller, category, extra0])
+- LogicalProject(auction=[$0], bidder=[$1], price=[$2], channel=[$3], url=[$4], dateTime=[$5], extra=[$6], itemName=[$8], description=[$9], initialBid=[$10], reserve=[$11], dateTime0=[$12], expires=[$13], seller=[$14], category=[$15], extra0=[$16])
   +- LogicalFilter(condition=[=($15, 10)])
      +- LogicalJoin(condition=[=($0, $7)], 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)])
         :     +- 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=[[default_catalog, default_database, src]])
         +- 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)])
               +- 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=[[default_catalog, default_database, src]])

== Optimized Physical Plan ==
Sink(table=[default_catalog.default_database.sink], fields=[auction, bidder, price, channel, url, dateTime, extra, itemName, description, initialBid, reserve, dateTime0, expires, seller, category, extra0])
+- Calc(select=[auction, bidder, price, channel, url, dateTime, extra, itemName, description, initialBid, reserve, dateTime0, expires, seller, CAST(10:BIGINT AS BIGINT) AS category, extra0])
   +- Join(joinType=[InnerJoin], where=[=(auction, id)], select=[auction, bidder, price, channel, url, dateTime, extra, id, itemName, description, initialBid, reserve, dateTime0, expires, seller, extra0], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey])
      :- Exchange(distribution=[hash[auction]])
      :  +- Calc(select=[bid.auction AS auction, bid.bidder AS bidder, bid.price AS price, bid.channel AS channel, bid.url AS url, CAST(Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS TIMESTAMP_WITH_LOCAL_TIME_ZONE(3)) AS dateTime, bid.extra AS extra], where=[=(event_type, 2)])
      :     +- TableSourceScan(table=[[default_catalog, default_database, src, watermark=[-(TO_TIMESTAMP_LTZ(dateTime, 3), 4000:INTERVAL SECOND)], watermarkEmitStrategy=[on-periodic]]], fields=[event_type, person, auction, bid, dateTime])
      +- Exchange(distribution=[hash[id]])
         +- Calc(select=[auction.id AS id, auction.itemName AS itemName, auction.description AS description, auction.initialBid AS initialBid, auction.reserve AS reserve, CAST(Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS TIMESTAMP_WITH_LOCAL_TIME_ZONE(3)) AS dateTime, TO_TIMESTAMP_LTZ(auction.expires, 3) AS expires, auction.seller AS seller, auction.extra AS extra], where=[AND(=(event_type, 1), =(auction.category, 10:BIGINT))])
            +- TableSourceScan(table=[[default_catalog, default_database, src, watermark=[-(TO_TIMESTAMP_LTZ(dateTime, 3), 4000:INTERVAL SECOND)], watermarkEmitStrategy=[on-periodic]]], fields=[event_type, person, auction, bid, dateTime])

== Optimized Execution Plan ==
Sink(table=[default_catalog.default_database.sink], fields=[auction, bidder, price, channel, url, dateTime, extra, itemName, description, initialBid, reserve, dateTime0, expires, seller, category, extra0])
+- Calc(select=[auction, bidder, price, channel, url, dateTime, extra, itemName, description, initialBid, reserve, dateTime0, expires, seller, CAST(10 AS BIGINT) AS category, extra0])
   +- Join(joinType=[InnerJoin], where=[(auction = id)], select=[auction, bidder, price, channel, url, dateTime, extra, id, itemName, description, initialBid, reserve, dateTime0, expires, seller, extra0], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey])
      :- Exchange(distribution=[hash[auction]])
      :  +- Calc(select=[bid.auction AS auction, bid.bidder AS bidder, bid.price AS price, bid.channel AS channel, bid.url AS url, CAST(Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS TIMESTAMP_WITH_LOCAL_TIME_ZONE(3)) AS dateTime, bid.extra AS extra], where=[(event_type = 2)])
      :     +- TableSourceScan(table=[[default_catalog, default_database, src, watermark=[-(TO_TIMESTAMP_LTZ(dateTime, 3), 4000:INTERVAL SECOND)], watermarkEmitStrategy=[on-periodic]]], fields=[event_type, person, auction, bid, dateTime])(reuse_id=[1])
      +- Exchange(distribution=[hash[id]])
         +- Calc(select=[auction.id AS id, auction.itemName AS itemName, auction.description AS description, auction.initialBid AS initialBid, auction.reserve AS reserve, CAST(Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS TIMESTAMP_WITH_LOCAL_TIME_ZONE(3)) AS dateTime, TO_TIMESTAMP_LTZ(auction.expires, 3) AS expires, auction.seller AS seller, auction.extra AS extra], where=[((event_type = 1) AND (auction.category = 10))])
            +- Reused(reference_id=[1])

== Physical Execution Plan ==
{
  "nodes" : [ {
    "id" : 5567,
    "type" : "Source: src[2539]",
    "pact" : "Data Source",
    "contents" : "[2539]:TableSourceScan(table=[[default_catalog, default_database, src, watermark=[-(TO_TIMESTAMP_LTZ(dateTime, 3), 4000:INTERVAL SECOND)], watermarkEmitStrategy=[on-periodic]]], fields=[event_type, person, auction, bid, dateTime])",
    "parallelism" : 4
  }, {
    "id" : 5568,
    "type" : "Calc[2540]",
    "pact" : "Operator",
    "contents" : "[2540]:Calc(select=[bid.auction AS auction, bid.bidder AS bidder, bid.price AS price, bid.channel AS channel, bid.url AS url, CAST(Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS TIMESTAMP_WITH_LOCAL_TIME_ZONE(3)) AS dateTime, bid.extra AS extra], where=[(event_type = 2)])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 5567,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 5570,
    "type" : "Calc[2542]",
    "pact" : "Operator",
    "contents" : "[2542]:Calc(select=[auction.id AS id, auction.itemName AS itemName, auction.description AS description, auction.initialBid AS initialBid, auction.reserve AS reserve, CAST(Reinterpret(TO_TIMESTAMP_LTZ(dateTime, 3)) AS TIMESTAMP_WITH_LOCAL_TIME_ZONE(3)) AS dateTime, TO_TIMESTAMP_LTZ(auction.expires, 3) AS expires, auction.seller AS seller, auction.extra AS extra], where=[((event_type = 1) AND (auction.category = 10))])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 5567,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 5572,
    "type" : "Join[2544]",
    "pact" : "Operator",
    "contents" : "[2544]:Join(joinType=[InnerJoin], where=[(auction = id)], select=[auction, bidder, price, channel, url, dateTime, extra, id, itemName, description, initialBid, reserve, dateTime0, expires, seller, extra0], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 5568,
      "ship_strategy" : "HASH",
      "side" : "second"
    }, {
      "id" : 5570,
      "ship_strategy" : "HASH",
      "side" : "second"
    } ]
  }, {
    "id" : 5573,
    "type" : "Calc[2545]",
    "pact" : "Operator",
    "contents" : "[2545]:Calc(select=[auction, bidder, price, channel, url, dateTime, extra, itemName, description, initialBid, reserve, dateTime0, expires, seller, CAST(10 AS BIGINT) AS category, extra0])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 5572,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 5574,
    "type" : "Map",
    "pact" : "Operator",
    "contents" : "Map",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 5573,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 5576,
    "type" : "Writer : table",
    "pact" : "Operator",
    "contents" : "Writer : table",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 5574,
      "ship_strategy" : "shuffle by bucket",
      "side" : "second"
    } ]
  }, {
    "id" : 5577,
    "type" : "Global Committer : table",
    "pact" : "Operator",
    "contents" : "Global Committer : table",
    "parallelism" : 1,
    "predecessors" : [ {
      "id" : 5576,
      "ship_strategy" : "REBALANCE",
      "side" : "second"
    } ]
  }, {
    "id" : 5582,
    "type" : "end: Writer",
    "pact" : "Operator",
    "contents" : "end: Writer",
    "parallelism" : 1,
    "predecessors" : [ {
      "id" : 5577,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  } ]
}