Inf1mum commented on code in PR #219:
URL: https://github.com/apache/datafusion-site/pull/219#discussion_r4698588882


##########
content/blog/2026-11-13-topk-per-partition.md:
##########
@@ -0,0 +1,377 @@
+---
+layout: post
+title: Top N Per Group with PartitionedTopKExec in Apache DataFusion
+date: 2026-11-13
+author: Vadim Lazuk
+categories: [performance]
+---
+
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+
+[TOC]
+
+*[Vadim Lazuk](https://github.com/Inf1mum)*
+
+"Find the top N rows within each group" is one of the most common shapes in

Review Comment:
   Done -- the intro keeps only the top-five-products example; the 
latest-events and highest-paid variants are cut.



##########
content/blog/2026-11-13-topk-per-partition.md:
##########
@@ -0,0 +1,377 @@
+---
+layout: post
+title: Top N Per Group with PartitionedTopKExec in Apache DataFusion
+date: 2026-11-13
+author: Vadim Lazuk
+categories: [performance]
+---
+
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+
+[TOC]
+
+*[Vadim Lazuk](https://github.com/Inf1mum)*
+
+"Find the top N rows within each group" is one of the most common shapes in
+analytics: the five best-selling products in each category, the three most
+recent events per device, the two highest-revenue rows per store. In SQL this
+is usually written with a ranking window function and an outer filter:
+
+```sql
+SELECT * FROM (
+    SELECT ROW_NUMBER() OVER (PARTITION BY category ORDER BY revenue DESC) AS 
rn, *
+    FROM sales
+) WHERE rn <= 5;
+```
+
+Until recently, DataFusion evaluated this query by sorting the *entire* input
+to compute the window function, and then throwing almost all of the sorted
+output away. DataFusion 55 recognizes the pattern: with
+[datafusion.optimizer.enable_window_topn] enabled, the full sort is replaced
+by a new `PartitionedTopKExec` operator that keeps only the top N rows per

Review Comment:
   Done -- the flag name in the intro links to the configuration documentation, 
and the operator and rule names link to their source files.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to