== 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=[1314])
+- NativeColumnarTopN(reuseBarrier=[1313])
   +- NativeColumnarExchange(reuseBarrier=[1312])
      +- NativeCalc(reuseBarrier=[1311])
         +- NativeColumnarUpdatingJoin(reuseBarrier=[1310], leftJoinKeyUnique=[false], rightJoinKeyUnique=[false])
            :- NativeColumnarExchange(reuseBarrier=[1299])
            :  +- NativeCalc(reuseBarrier=[1298])
            :     +- NativeShare(consumers=[2], shareToken=[1296])
            :        +- NativeKafkaDecode(topic=[nexmark], format=[json], watermarkColumn=[dateTime], watermarkExpression=[-(TO_TIMESTAMP_LTZ($4, 3), 4000:INTERVAL SECOND)], shareToken=[1296])
            +- NativeColumnarExchange(reuseBarrier=[1309])
               +- NativeCalc(reuseBarrier=[1308])
                  +- NativeShare(consumers=[2], shareToken=[1296])
                     +- NativeKafkaDecode(topic=[nexmark], format=[json], watermarkColumn=[dateTime], watermarkExpression=[-(TO_TIMESTAMP_LTZ($4, 3), 4000:INTERVAL SECOND)], shareToken=[1296])

== 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" : 2354,
    "type" : "Source: native-kafka-source",
    "pact" : "Data Source",
    "contents" : "Source: native-kafka-source",
    "parallelism" : 4
  }, {
    "id" : 2355,
    "type" : "NativeShareExecNode[1174]",
    "pact" : "Operator",
    "contents" : "[1174]:NativeShare(consumers=[2])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2354,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2356,
    "type" : "NativeCalcExecNode[1175]",
    "pact" : "Operator",
    "contents" : "[1175]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2355,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2357,
    "type" : "NativeColumnarExchangeExecNode[1176]",
    "pact" : "Operator",
    "contents" : "[1176]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2356,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2359,
    "type" : "NativeCalcExecNode[1177]",
    "pact" : "Operator",
    "contents" : "[1177]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2355,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2360,
    "type" : "NativeColumnarExchangeExecNode[1178]",
    "pact" : "Operator",
    "contents" : "[1178]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2359,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2362,
    "type" : "NativeColumnarUpdatingJoinExecNode[1179]",
    "pact" : "Operator",
    "contents" : "[1179]:NativeColumnarUpdatingJoin(leftJoinKeyUnique=[false], rightJoinKeyUnique=[false])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2357,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    }, {
      "id" : 2360,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    } ]
  }, {
    "id" : 2363,
    "type" : "NativeCalcExecNode[1180]",
    "pact" : "Operator",
    "contents" : "[1180]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2362,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2364,
    "type" : "NativeColumnarExchangeExecNode[1181]",
    "pact" : "Operator",
    "contents" : "[1181]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2363,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2366,
    "type" : "NativeColumnarTopNExecNode[1182]",
    "pact" : "Operator",
    "contents" : "[1182]:NativeColumnarTopN",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2364,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    } ]
  }, {
    "id" : 2367,
    "type" : "native-paimon-not-null-enforcer",
    "pact" : "Operator",
    "contents" : "native-paimon-not-null-enforcer",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2366,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2368,
    "type" : "native-paimon-bucket-route",
    "pact" : "Operator",
    "contents" : "native-paimon-bucket-route",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2367,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 2370,
    "type" : "Writer : table",
    "pact" : "Operator",
    "contents" : "Writer : table",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 2368,
      "ship_strategy" : "shuffle by bucket",
      "side" : "second"
    } ]
  }, {
    "id" : 2371,
    "type" : "Global Committer : table",
    "pact" : "Operator",
    "contents" : "Global Committer : table",
    "parallelism" : 1,
    "predecessors" : [ {
      "id" : 2370,
      "ship_strategy" : "REBALANCE",
      "side" : "second"
    } ]
  }, {
    "id" : 2377,
    "type" : "end: Writer",
    "pact" : "Operator",
    "contents" : "end: Writer",
    "parallelism" : 1,
    "predecessors" : [ {
      "id" : 2371,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  } ]
}