== Abstract Syntax Tree ==
LogicalSink(table=[default_catalog.default_database.sink], fields=[category, EXPR$1])
+- LogicalAggregate(group=[{0}], EXPR$1=[AVG($1)])
   +- LogicalProject(category=[$1], final=[$0])
      +- LogicalProject(final=[$2], category=[$1])
         +- LogicalAggregate(group=[{0, 1}], final=[MAX($2)])
            +- LogicalProject(id=[$0], category=[$8], price=[$12])
               +- 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=[585])
+- NativeColumnarGroupAggregate(reuseBarrier=[584])
   +- NativeColumnarExchange(reuseBarrier=[583])
      +- NativeCalc(reuseBarrier=[582])
         +- NativeColumnarGroupAggregate(reuseBarrier=[581])
            +- NativeColumnarExchange(reuseBarrier=[580])
               +- NativeCalc(reuseBarrier=[579])
                  +- NativeColumnarUpdatingJoin(reuseBarrier=[578], leftJoinKeyUnique=[false], rightJoinKeyUnique=[false])
                     :- NativeColumnarExchange(reuseBarrier=[564])
                     :  +- NativeCalc(reuseBarrier=[563])
                     :     +- NativeShare(consumers=[2], shareToken=[561])
                     :        +- NativeKafkaDecode(topic=[nexmark], format=[json], watermarkColumn=[dateTime], watermarkExpression=[-(TO_TIMESTAMP_LTZ($4, 3), 4000:INTERVAL SECOND)], shareToken=[561])
                     +- NativeColumnarExchange(reuseBarrier=[577])
                        +- NativeCalc(reuseBarrier=[576])
                           +- NativeShare(consumers=[2], shareToken=[561])
                              +- NativeKafkaDecode(topic=[nexmark], format=[json], watermarkColumn=[dateTime], watermarkExpression=[-(TO_TIMESTAMP_LTZ($4, 3), 4000:INTERVAL SECOND)], shareToken=[561])

== Optimized Execution Plan ==
NativePaimonSink
+- NativeColumnarGroupAggregate
   +- NativeColumnarExchange
      +- NativeCalc
         +- NativeColumnarGroupAggregate
            +- 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" : 1332,
    "type" : "Source: native-kafka-source",
    "pact" : "Data Source",
    "contents" : "Source: native-kafka-source",
    "parallelism" : 4
  }, {
    "id" : 1333,
    "type" : "NativeShareExecNode[612]",
    "pact" : "Operator",
    "contents" : "[612]:NativeShare(consumers=[2])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1332,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1334,
    "type" : "NativeCalcExecNode[613]",
    "pact" : "Operator",
    "contents" : "[613]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1333,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1335,
    "type" : "NativeColumnarExchangeExecNode[614]",
    "pact" : "Operator",
    "contents" : "[614]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1334,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1337,
    "type" : "NativeCalcExecNode[615]",
    "pact" : "Operator",
    "contents" : "[615]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1333,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1338,
    "type" : "NativeColumnarExchangeExecNode[616]",
    "pact" : "Operator",
    "contents" : "[616]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1337,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1340,
    "type" : "NativeColumnarUpdatingJoinExecNode[617]",
    "pact" : "Operator",
    "contents" : "[617]:NativeColumnarUpdatingJoin(leftJoinKeyUnique=[false], rightJoinKeyUnique=[false])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1335,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    }, {
      "id" : 1338,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    } ]
  }, {
    "id" : 1341,
    "type" : "NativeCalcExecNode[618]",
    "pact" : "Operator",
    "contents" : "[618]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1340,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1342,
    "type" : "NativeColumnarExchangeExecNode[619]",
    "pact" : "Operator",
    "contents" : "[619]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1341,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1344,
    "type" : "NativeColumnarGroupAggExecNode[620]",
    "pact" : "Operator",
    "contents" : "[620]:NativeColumnarGroupAggregate",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1342,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    } ]
  }, {
    "id" : 1345,
    "type" : "NativeCalcExecNode[621]",
    "pact" : "Operator",
    "contents" : "[621]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1344,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1346,
    "type" : "NativeColumnarExchangeExecNode[622]",
    "pact" : "Operator",
    "contents" : "[622]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1345,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1348,
    "type" : "NativeColumnarGroupAggExecNode[623]",
    "pact" : "Operator",
    "contents" : "[623]:NativeColumnarGroupAggregate",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1346,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    } ]
  }, {
    "id" : 1349,
    "type" : "native-paimon-not-null-enforcer",
    "pact" : "Operator",
    "contents" : "native-paimon-not-null-enforcer",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1348,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1350,
    "type" : "native-paimon-bucket-route",
    "pact" : "Operator",
    "contents" : "native-paimon-bucket-route",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1349,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1352,
    "type" : "Writer : table",
    "pact" : "Operator",
    "contents" : "Writer : table",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1350,
      "ship_strategy" : "shuffle by bucket",
      "side" : "second"
    } ]
  }, {
    "id" : 1353,
    "type" : "Global Committer : table",
    "pact" : "Operator",
    "contents" : "Global Committer : table",
    "parallelism" : 1,
    "predecessors" : [ {
      "id" : 1352,
      "ship_strategy" : "REBALANCE",
      "side" : "second"
    } ]
  }, {
    "id" : 1360,
    "type" : "end: Writer",
    "pact" : "Operator",
    "contents" : "end: Writer",
    "parallelism" : 1,
    "predecessors" : [ {
      "id" : 1353,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  } ]
}