== Abstract Syntax Tree ==
LogicalSink(table=[fluss.nexmark.output_85f246704164456db5062162016e7e1d], fields=[name, city, state, id])
+- LogicalProject(name=[$11], city=[$14], state=[$15], id=[$0])
   +- LogicalFilter(condition=[AND(=($8, 10), OR(=($15, _UTF-16LE'OR'), =($15, _UTF-16LE'ID'), =($15, _UTF-16LE'CA')))])
      +- LogicalJoin(condition=[=($7, $10)], joinType=[inner])
         :- 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)])
         :     +- 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]])
         +- LogicalProject(id=[$1.id], name=[$1.name], emailAddress=[$1.emailAddress], creditCard=[$1.creditCard], city=[$1.city], state=[$1.state], dateTime=[$5], extra=[$1.extra])
            +- LogicalFilter(condition=[=($0, 0)])
               +- 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_85f246704164456db5062162016e7e1d], fields=[name, city, state, id])
+- Calc(select=[name, city, state, id])
   +- Join(joinType=[InnerJoin], where=[=(seller, id0)], select=[id, seller, id0, name, city, state], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey], miniBatch=[true])
      :- Exchange(distribution=[hash[seller]])
      :  +- Calc(select=[auction.id AS id, auction.seller AS seller], where=[AND(=(event_type, 1), =(auction.category, 10:BIGINT))])
      :     +- MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])
      :        +- TableSourceScan(table=[[fluss, nexmark, events, project=[event_type, auction, dateTime], watermark=[-(TO_TIMESTAMP_LTZ(dateTime, 3), 4000:INTERVAL SECOND)], watermarkEmitStrategy=[on-periodic], filter=[]]], fields=[event_type, auction, dateTime])
      +- Exchange(distribution=[hash[id]])
         +- Calc(select=[person.id AS id, person.name AS name, person.city AS city, person.state AS state], where=[AND(=(event_type, 0), SEARCH(person.state, Sarg[_UTF-16LE'CA':VARCHAR(2147483647) CHARACTER SET "UTF-16LE", _UTF-16LE'ID':VARCHAR(2147483647) CHARACTER SET "UTF-16LE", _UTF-16LE'OR':VARCHAR(2147483647) CHARACTER SET "UTF-16LE"]:VARCHAR(2147483647) CHARACTER SET "UTF-16LE"))])
            +- MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])
               +- TableSourceScan(table=[[fluss, nexmark, events, project=[event_type, person, dateTime], watermark=[-(TO_TIMESTAMP_LTZ(dateTime, 3), 4000:INTERVAL SECOND)], watermarkEmitStrategy=[on-periodic], filter=[]]], fields=[event_type, person, dateTime])

== Optimized Execution Plan ==
Sink(table=[fluss.nexmark.output_85f246704164456db5062162016e7e1d], fields=[name, city, state, id])
+- Calc(select=[name, city, state, id])
   +- Join(joinType=[InnerJoin], where=[(seller = id0)], select=[id, seller, id0, name, city, state], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey], miniBatch=[true])
      :- Exchange(distribution=[hash[seller]])
      :  +- Calc(select=[auction.id AS id, auction.seller AS seller], where=[((event_type = 1) AND (auction.category = 10))])
      :     +- MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])
      :        +- TableSourceScan(table=[[fluss, nexmark, events, project=[event_type, auction, dateTime], watermark=[-(TO_TIMESTAMP_LTZ(dateTime, 3), 4000:INTERVAL SECOND)], watermarkEmitStrategy=[on-periodic], filter=[]]], fields=[event_type, auction, dateTime])
      +- Exchange(distribution=[hash[id]])
         +- Calc(select=[person.id AS id, person.name AS name, person.city AS city, person.state AS state], where=[((event_type = 0) AND SEARCH(person.state, Sarg[_UTF-16LE'CA', _UTF-16LE'ID', _UTF-16LE'OR']))])
            +- MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])
               +- TableSourceScan(table=[[fluss, nexmark, events, project=[event_type, person, dateTime], watermark=[-(TO_TIMESTAMP_LTZ(dateTime, 3), 4000:INTERVAL SECOND)], watermarkEmitStrategy=[on-periodic], filter=[]]], fields=[event_type, person, dateTime])

== Physical Execution Plan ==
{
  "nodes" : [ {
    "id" : 559,
    "type" : "Source: events[415]",
    "pact" : "Data Source",
    "contents" : "[415]:TableSourceScan(table=[[fluss, nexmark, events, project=[event_type, auction, dateTime], watermark=[-(TO_TIMESTAMP_LTZ(dateTime, 3), 4000:INTERVAL SECOND)], watermarkEmitStrategy=[on-periodic], filter=[]]], fields=[event_type, auction, dateTime])",
    "parallelism" : 4
  }, {
    "id" : 560,
    "type" : "MiniBatchAssigner[416]",
    "pact" : "Operator",
    "contents" : "[416]:MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 559,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 561,
    "type" : "Calc[417]",
    "pact" : "Operator",
    "contents" : "[417]:Calc(select=[auction.id AS id, auction.seller AS seller], where=[((event_type = 1) AND (auction.category = 10))])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 560,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 563,
    "type" : "Source: events[419]",
    "pact" : "Data Source",
    "contents" : "[419]:TableSourceScan(table=[[fluss, nexmark, events, project=[event_type, person, dateTime], watermark=[-(TO_TIMESTAMP_LTZ(dateTime, 3), 4000:INTERVAL SECOND)], watermarkEmitStrategy=[on-periodic], filter=[]]], fields=[event_type, person, dateTime])",
    "parallelism" : 4
  }, {
    "id" : 564,
    "type" : "MiniBatchAssigner[420]",
    "pact" : "Operator",
    "contents" : "[420]:MiniBatchAssigner(interval=[2000ms], mode=[ProcTime])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 563,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 565,
    "type" : "Calc[421]",
    "pact" : "Operator",
    "contents" : "[421]:Calc(select=[person.id AS id, person.name AS name, person.city AS city, person.state AS state], where=[((event_type = 0) AND SEARCH(person.state, Sarg[_UTF-16LE'CA', _UTF-16LE'ID', _UTF-16LE'OR']))])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 564,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 567,
    "type" : "Join[423]",
    "pact" : "Operator",
    "contents" : "[423]:Join(joinType=[InnerJoin], where=[(seller = id0)], select=[id, seller, id0, name, city, state], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey], miniBatch=[true])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 561,
      "ship_strategy" : "HASH",
      "side" : "second"
    }, {
      "id" : 565,
      "ship_strategy" : "HASH",
      "side" : "second"
    } ]
  }, {
    "id" : 568,
    "type" : "Calc[424]",
    "pact" : "Operator",
    "contents" : "[424]:Calc(select=[name, city, state, id])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 567,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 572,
    "type" : "Sink(nexmark.output_85f246704164456db5062162016e7e1d): Writer",
    "pact" : "Operator",
    "contents" : "Sink(nexmark.output_85f246704164456db5062162016e7e1d): Writer",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 568,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  } ]
}