== Abstract Syntax Tree ==
LogicalSink(table=[default_catalog.default_database.sink], fields=[id, itemName, description, initialBid, reserve, dateTime, expires, seller, category, extra, auction, bidder, price, bid_dateTime, bid_extra])
+- LogicalProject(id=[$0], itemName=[$1], description=[$2], initialBid=[$3], reserve=[$4], dateTime=[$5], expires=[$6], seller=[$7], category=[$8], extra=[$9], auction=[$10], bidder=[$11], price=[$12], bid_dateTime=[$13], bid_extra=[$14])
   +- LogicalFilter(condition=[<=($15, 1)])
      +- LogicalProject(id=[$0], itemName=[$1], description=[$2], initialBid=[$3], reserve=[$4], dateTime=[$5], expires=[$6], seller=[$7], category=[$8], extra=[$9], auction=[$10], bidder=[$11], price=[$12], bid_dateTime=[$15], bid_extra=[$16], rownum=[ROW_NUMBER() OVER (PARTITION BY $0 ORDER BY $12 DESC NULLS LAST, $15 NULLS FIRST)])
         +- LogicalFilter(condition=[AND(=($0, $10), >=($15, $5), <=($15, $6))])
            +- LogicalJoin(condition=[true], 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)])
               :     +- 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(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]])

== Optimized Physical Plan ==
NativePaimonSink(reuseBarrier=[1254])
+- NativeColumnarTopN(reuseBarrier=[1253])
   +- NativeColumnarExchange(reuseBarrier=[1252])
      +- NativeCalc(reuseBarrier=[1251])
         +- NativeColumnarUpdatingJoin(reuseBarrier=[1250], leftJoinKeyUnique=[false], rightJoinKeyUnique=[false])
            :- NativeColumnarExchange(reuseBarrier=[1239])
            :  +- NativeCalc(reuseBarrier=[1238])
            :     +- NativeShare(consumers=[2], shareToken=[1236])
            :        +- NativeKafkaDecode(topic=[nexmark], format=[json], watermarkColumn=[dateTime], watermarkExpression=[-(TO_TIMESTAMP_LTZ($4, 3), 4000:INTERVAL SECOND)], shareToken=[1236])
            +- NativeColumnarExchange(reuseBarrier=[1249])
               +- NativeCalc(reuseBarrier=[1248])
                  +- NativeShare(consumers=[2], shareToken=[1236])
                     +- NativeKafkaDecode(topic=[nexmark], format=[json], watermarkColumn=[dateTime], watermarkExpression=[-(TO_TIMESTAMP_LTZ($4, 3), 4000:INTERVAL SECOND)], shareToken=[1236])

== Optimized Execution Plan ==
NativePaimonSink
+- NativeColumnarTopN
   +- NativeColumnarExchange
      +- NativeCalc
         +- NativeColumnarUpdatingJoin(leftJoinKeyUnique=[false], rightJoinKeyUnique=[false])
            :- NativeColumnarExchange
            :  +- NativeCalc
            :     +- NativeShare(consumers=[2])(reuse_id=[1])
            :        +- NativeKafkaDecode(topic=[nexmark], format=[json], watermarkColumn=[dateTime], watermarkExpression=[-(TO_TIMESTAMP_LTZ($4, 3), 4000:INTERVAL SECOND)])
            +- NativeColumnarExchange
               +- NativeCalc
                  +- Reused(reference_id=[1])

== Physical Execution Plan ==
{
  "nodes" : [ {
    "id" : 2217,
    "type" : "Source: native-kafka-source",
    "pact" : "Data Source",
    "contents" : "Source: native-kafka-source",
    "parallelism" : 4
  }, {
    "id" : 2218,
    "type" : "NativeShareExecNode[1106]",
    "pact" : "Operator",
    "contents" : "[1106]:NativeShare(consumers=[2])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2217,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2219,
    "type" : "NativeCalcExecNode[1107]",
    "pact" : "Operator",
    "contents" : "[1107]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2218,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2220,
    "type" : "NativeColumnarExchangeExecNode[1108]",
    "pact" : "Operator",
    "contents" : "[1108]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2219,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2222,
    "type" : "NativeCalcExecNode[1109]",
    "pact" : "Operator",
    "contents" : "[1109]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2218,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2223,
    "type" : "NativeColumnarExchangeExecNode[1110]",
    "pact" : "Operator",
    "contents" : "[1110]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2222,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2225,
    "type" : "NativeColumnarUpdatingJoinExecNode[1111]",
    "pact" : "Operator",
    "contents" : "[1111]:NativeColumnarUpdatingJoin(leftJoinKeyUnique=[false], rightJoinKeyUnique=[false])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2220,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    }, {
      "id" : 2223,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    } ]
  }, {
    "id" : 2226,
    "type" : "NativeCalcExecNode[1112]",
    "pact" : "Operator",
    "contents" : "[1112]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2225,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2227,
    "type" : "NativeColumnarExchangeExecNode[1113]",
    "pact" : "Operator",
    "contents" : "[1113]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2226,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2229,
    "type" : "NativeColumnarTopNExecNode[1114]",
    "pact" : "Operator",
    "contents" : "[1114]:NativeColumnarTopN",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2227,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    } ]
  }, {
    "id" : 2230,
    "type" : "native-paimon-not-null-enforcer",
    "pact" : "Operator",
    "contents" : "native-paimon-not-null-enforcer",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2229,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2231,
    "type" : "native-paimon-bucket-route",
    "pact" : "Operator",
    "contents" : "native-paimon-bucket-route",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2230,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2233,
    "type" : "Writer : table",
    "pact" : "Operator",
    "contents" : "Writer : table",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2231,
      "ship_strategy" : "shuffle by bucket",
      "side" : "second"
    } ]
  }, {
    "id" : 2234,
    "type" : "Global Committer : table",
    "pact" : "Operator",
    "contents" : "Global Committer : table",
    "parallelism" : 1,
    "predecessors" : [ {
      "id" : 2233,
      "ship_strategy" : "REBALANCE",
      "side" : "second"
    } ]
  }, {
    "id" : 2240,
    "type" : "end: Writer",
    "pact" : "Operator",
    "contents" : "end: Writer",
    "parallelism" : 1,
    "predecessors" : [ {
      "id" : 2234,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  } ]
}