== 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=[507])
+- NativeColumnarGroupAggregate(reuseBarrier=[506])
   +- NativeColumnarExchange(reuseBarrier=[505])
      +- NativeCalc(reuseBarrier=[504])
         +- NativeColumnarGroupAggregate(reuseBarrier=[503])
            +- NativeColumnarExchange(reuseBarrier=[502])
               +- NativeCalc(reuseBarrier=[501])
                  +- NativeColumnarUpdatingJoin(reuseBarrier=[500], leftJoinKeyUnique=[false], rightJoinKeyUnique=[false])
                     :- NativeColumnarExchange(reuseBarrier=[486])
                     :  +- NativeCalc(reuseBarrier=[485])
                     :     +- NativeShare(consumers=[2], shareToken=[483])
                     :        +- NativeKafkaDecode(topic=[nexmark], format=[json], watermarkColumn=[dateTime], watermarkExpression=[-(TO_TIMESTAMP_LTZ($4, 3), 4000:INTERVAL SECOND)], shareToken=[483])
                     +- NativeColumnarExchange(reuseBarrier=[499])
                        +- NativeCalc(reuseBarrier=[498])
                           +- NativeShare(consumers=[2], shareToken=[483])
                              +- NativeKafkaDecode(topic=[nexmark], format=[json], watermarkColumn=[dateTime], watermarkExpression=[-(TO_TIMESTAMP_LTZ($4, 3), 4000:INTERVAL SECOND)], shareToken=[483])

== 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" : 1169,
    "type" : "Source: native-kafka-source",
    "pact" : "Data Source",
    "contents" : "Source: native-kafka-source",
    "parallelism" : 4
  }, {
    "id" : 1170,
    "type" : "NativeShareExecNode[526]",
    "pact" : "Operator",
    "contents" : "[526]:NativeShare(consumers=[2])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1169,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1171,
    "type" : "NativeCalcExecNode[527]",
    "pact" : "Operator",
    "contents" : "[527]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1170,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1172,
    "type" : "NativeColumnarExchangeExecNode[528]",
    "pact" : "Operator",
    "contents" : "[528]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1171,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1174,
    "type" : "NativeCalcExecNode[529]",
    "pact" : "Operator",
    "contents" : "[529]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1170,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1175,
    "type" : "NativeColumnarExchangeExecNode[530]",
    "pact" : "Operator",
    "contents" : "[530]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1174,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1177,
    "type" : "NativeColumnarUpdatingJoinExecNode[531]",
    "pact" : "Operator",
    "contents" : "[531]:NativeColumnarUpdatingJoin(leftJoinKeyUnique=[false], rightJoinKeyUnique=[false])",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1172,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    }, {
      "id" : 1175,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    } ]
  }, {
    "id" : 1178,
    "type" : "NativeCalcExecNode[532]",
    "pact" : "Operator",
    "contents" : "[532]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1177,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1179,
    "type" : "NativeColumnarExchangeExecNode[533]",
    "pact" : "Operator",
    "contents" : "[533]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1178,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1181,
    "type" : "NativeColumnarGroupAggExecNode[534]",
    "pact" : "Operator",
    "contents" : "[534]:NativeColumnarGroupAggregate",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1179,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    } ]
  }, {
    "id" : 1182,
    "type" : "NativeCalcExecNode[535]",
    "pact" : "Operator",
    "contents" : "[535]:NativeCalc",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1181,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1183,
    "type" : "NativeColumnarExchangeExecNode[536]",
    "pact" : "Operator",
    "contents" : "[536]:NativeColumnarExchange",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1182,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1185,
    "type" : "NativeColumnarGroupAggExecNode[537]",
    "pact" : "Operator",
    "contents" : "[537]:NativeColumnarGroupAggregate",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1183,
      "ship_strategy" : "columnar-key-group",
      "side" : "second"
    } ]
  }, {
    "id" : 1186,
    "type" : "native-paimon-not-null-enforcer",
    "pact" : "Operator",
    "contents" : "native-paimon-not-null-enforcer",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1185,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1187,
    "type" : "native-paimon-bucket-route",
    "pact" : "Operator",
    "contents" : "native-paimon-bucket-route",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1186,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  }, {
    "id" : 1189,
    "type" : "Writer : table",
    "pact" : "Operator",
    "contents" : "Writer : table",
    "parallelism" : 4,
    "predecessors" : [ {
      "id" : 1187,
      "ship_strategy" : "shuffle by bucket",
      "side" : "second"
    } ]
  }, {
    "id" : 1190,
    "type" : "Global Committer : table",
    "pact" : "Operator",
    "contents" : "Global Committer : table",
    "parallelism" : 1,
    "predecessors" : [ {
      "id" : 1189,
      "ship_strategy" : "REBALANCE",
      "side" : "second"
    } ]
  }, {
    "id" : 1197,
    "type" : "end: Writer",
    "pact" : "Operator",
    "contents" : "end: Writer",
    "parallelism" : 1,
    "predecessors" : [ {
      "id" : 1190,
      "ship_strategy" : "FORWARD",
      "side" : "second"
    } ]
  } ]
}