== 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=[351])
+- NativeColumnarGroupAggregate(reuseBarrier=[350])
   +- NativeColumnarExchange(reuseBarrier=[349])
      +- NativeCalc(reuseBarrier=[348])
         +- NativeColumnarGroupAggregate(reuseBarrier=[347])
            +- NativeColumnarExchange(reuseBarrier=[346])
               +- NativeCalc(reuseBarrier=[345])
                  +- NativeColumnarUpdatingJoin(reuseBarrier=[344], leftJoinKeyUnique=[false], rightJoinKeyUnique=[false])
                     :- NativeColumnarExchange(reuseBarrier=[330])
                     :  +- NativeCalc(reuseBarrier=[329])
                     :     +- NativeShare(consumers=[2], shareToken=[327])
                     :        +- NativeKafkaDecode(topic=[nexmark], format=[json], watermarkColumn=[dateTime], watermarkExpression=[-(TO_TIMESTAMP_LTZ($4, 3), 4000:INTERVAL SECOND)], shareToken=[327])
                     +- NativeColumnarExchange(reuseBarrier=[343])
                        +- NativeCalc(reuseBarrier=[342])
                           +- NativeShare(consumers=[2], shareToken=[327])
                              +- NativeKafkaDecode(topic=[nexmark], format=[json], watermarkColumn=[dateTime], watermarkExpression=[-(TO_TIMESTAMP_LTZ($4, 3), 4000:INTERVAL SECOND)], shareToken=[327])

== 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" : 945,
    "type" : "Source: native-kafka-source",
    "pact" : "Data Source",
    "contents" : "Source: native-kafka-source",
    "parallelism" : 4
  }, {
    "id" : 946,
    "type" : "NativeShareExecNode[410]",
    "pact" : "Operator",
    "contents" : "[410]:NativeShare(consumers=[2])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 945,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 947,
    "type" : "NativeCalcExecNode[411]",
    "pact" : "Operator",
    "contents" : "[411]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 946,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 948,
    "type" : "NativeColumnarExchangeExecNode[412]",
    "pact" : "Operator",
    "contents" : "[412]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 947,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 950,
    "type" : "NativeCalcExecNode[413]",
    "pact" : "Operator",
    "contents" : "[413]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 946,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 951,
    "type" : "NativeColumnarExchangeExecNode[414]",
    "pact" : "Operator",
    "contents" : "[414]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 950,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 953,
    "type" : "NativeColumnarUpdatingJoinExecNode[415]",
    "pact" : "Operator",
    "contents" : "[415]:NativeColumnarUpdatingJoin(leftJoinKeyUnique=[false], rightJoinKeyUnique=[false])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 948,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    }, {
      "id" : 951,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    } ]
  }, {
    "id" : 954,
    "type" : "NativeCalcExecNode[416]",
    "pact" : "Operator",
    "contents" : "[416]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 953,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 955,
    "type" : "NativeColumnarExchangeExecNode[417]",
    "pact" : "Operator",
    "contents" : "[417]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 954,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 957,
    "type" : "NativeColumnarGroupAggExecNode[418]",
    "pact" : "Operator",
    "contents" : "[418]:NativeColumnarGroupAggregate",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 955,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    } ]
  }, {
    "id" : 958,
    "type" : "NativeCalcExecNode[419]",
    "pact" : "Operator",
    "contents" : "[419]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 957,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 959,
    "type" : "NativeColumnarExchangeExecNode[420]",
    "pact" : "Operator",
    "contents" : "[420]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 958,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 961,
    "type" : "NativeColumnarGroupAggExecNode[421]",
    "pact" : "Operator",
    "contents" : "[421]:NativeColumnarGroupAggregate",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 959,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    } ]
  }, {
    "id" : 962,
    "type" : "native-paimon-not-null-enforcer",
    "pact" : "Operator",
    "contents" : "native-paimon-not-null-enforcer",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 961,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 963,
    "type" : "native-paimon-bucket-route",
    "pact" : "Operator",
    "contents" : "native-paimon-bucket-route",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 962,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 965,
    "type" : "Writer : table",
    "pact" : "Operator",
    "contents" : "Writer : table",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 963,
      "ship_strategy" : "shuffle by bucket",
      "side" : "second"
    } ]
  }, {
    "id" : 966,
    "type" : "Global Committer : table",
    "pact" : "Operator",
    "contents" : "Global Committer : table",
    "parallelism" : 1,
    "predecessors" : [ {
      "id" : 965,
      "ship_strategy" : "REBALANCE",
      "side" : "second"
    } ]
  }, {
    "id" : 973,
    "type" : "end: Writer",
    "pact" : "Operator",
    "contents" : "end: Writer",
    "parallelism" : 1,
    "predecessors" : [ {
      "id" : 966,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  } ]
}