== 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=[429])
+- NativeColumnarGroupAggregate(reuseBarrier=[428])
   +- NativeColumnarExchange(reuseBarrier=[427])
      +- NativeCalc(reuseBarrier=[426])
         +- NativeColumnarGroupAggregate(reuseBarrier=[425])
            +- NativeColumnarExchange(reuseBarrier=[424])
               +- NativeCalc(reuseBarrier=[423])
                  +- NativeColumnarUpdatingJoin(reuseBarrier=[422], leftJoinKeyUnique=[false], rightJoinKeyUnique=[false])
                     :- NativeColumnarExchange(reuseBarrier=[408])
                     :  +- NativeCalc(reuseBarrier=[407])
                     :     +- NativeShare(consumers=[2], shareToken=[405])
                     :        +- NativeKafkaDecode(topic=[nexmark], format=[json], watermarkColumn=[dateTime], watermarkExpression=[-(TO_TIMESTAMP_LTZ($4, 3), 4000:INTERVAL SECOND)], shareToken=[405])
                     +- NativeColumnarExchange(reuseBarrier=[421])
                        +- NativeCalc(reuseBarrier=[420])
                           +- NativeShare(consumers=[2], shareToken=[405])
                              +- NativeKafkaDecode(topic=[nexmark], format=[json], watermarkColumn=[dateTime], watermarkExpression=[-(TO_TIMESTAMP_LTZ($4, 3), 4000:INTERVAL SECOND)], shareToken=[405])

== 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" : 1108,
    "type" : "Source: native-kafka-source",
    "pact" : "Data Source",
    "contents" : "Source: native-kafka-source",
    "parallelism" : 4
  }, {
    "id" : 1109,
    "type" : "NativeShareExecNode[496]",
    "pact" : "Operator",
    "contents" : "[496]:NativeShare(consumers=[2])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1108,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1110,
    "type" : "NativeCalcExecNode[497]",
    "pact" : "Operator",
    "contents" : "[497]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1109,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1111,
    "type" : "NativeColumnarExchangeExecNode[498]",
    "pact" : "Operator",
    "contents" : "[498]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1110,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1113,
    "type" : "NativeCalcExecNode[499]",
    "pact" : "Operator",
    "contents" : "[499]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1109,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1114,
    "type" : "NativeColumnarExchangeExecNode[500]",
    "pact" : "Operator",
    "contents" : "[500]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1113,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1116,
    "type" : "NativeColumnarUpdatingJoinExecNode[501]",
    "pact" : "Operator",
    "contents" : "[501]:NativeColumnarUpdatingJoin(leftJoinKeyUnique=[false], rightJoinKeyUnique=[false])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1111,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    }, {
      "id" : 1114,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    } ]
  }, {
    "id" : 1117,
    "type" : "NativeCalcExecNode[502]",
    "pact" : "Operator",
    "contents" : "[502]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1116,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1118,
    "type" : "NativeColumnarExchangeExecNode[503]",
    "pact" : "Operator",
    "contents" : "[503]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1117,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1120,
    "type" : "NativeColumnarGroupAggExecNode[504]",
    "pact" : "Operator",
    "contents" : "[504]:NativeColumnarGroupAggregate",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1118,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    } ]
  }, {
    "id" : 1121,
    "type" : "NativeCalcExecNode[505]",
    "pact" : "Operator",
    "contents" : "[505]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1120,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1122,
    "type" : "NativeColumnarExchangeExecNode[506]",
    "pact" : "Operator",
    "contents" : "[506]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1121,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1124,
    "type" : "NativeColumnarGroupAggExecNode[507]",
    "pact" : "Operator",
    "contents" : "[507]:NativeColumnarGroupAggregate",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1122,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    } ]
  }, {
    "id" : 1125,
    "type" : "native-paimon-not-null-enforcer",
    "pact" : "Operator",
    "contents" : "native-paimon-not-null-enforcer",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1124,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1126,
    "type" : "native-paimon-bucket-route",
    "pact" : "Operator",
    "contents" : "native-paimon-bucket-route",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1125,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1128,
    "type" : "Writer : table",
    "pact" : "Operator",
    "contents" : "Writer : table",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1126,
      "ship_strategy" : "shuffle by bucket",
      "side" : "second"
    } ]
  }, {
    "id" : 1129,
    "type" : "Global Committer : table",
    "pact" : "Operator",
    "contents" : "Global Committer : table",
    "parallelism" : 1,
    "predecessors" : [ {
      "id" : 1128,
      "ship_strategy" : "REBALANCE",
      "side" : "second"
    } ]
  }, {
    "id" : 1136,
    "type" : "end: Writer",
    "pact" : "Operator",
    "contents" : "end: Writer",
    "parallelism" : 1,
    "predecessors" : [ {
      "id" : 1129,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  } ]
}