apache / apache/gluten

[CH] A case where converting a window to a top-k computation failed.

Open
#11,522 0 comments 0 reactions 0 assignees View on GitHub
bug triage
Dominant language
Scala
Stars
1.6k
Forks
657
Avg merge
2d 14h
Merged PRs (30d)
80

Description

### Backend

CH (ClickHouse)

### Bug description

[Expected behavior] and [actual behavior]. If this issue was written with the assistance of AI, please note that at the end of the description.

Following sql case an exception
```sql

select a, row_number() over (partition by a ,b order by b) from t
```

```
2026/01/29 15:21:30.893 ERROR [Executor task launch worker for task 1.0 in stage 8.0 (TID 1780)] spark.task.TaskResources: Task 1780 failed by error:
org.apache.gluten.exception.GlutenException: Empty query
0. Poco::Exception::Exception(String const&, int) @ 0x000000001a5751b2
1. DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x000000000f20af9b
2. DB::Exception::createDeprecated(String const&, int, bool) @ 0x000000000f4ff32d
3. DB::parseQueryAndMovePosition(DB::IParser&, char const*&, char const*, String const&, bool, unsigned long, unsigned long, unsigned long) @ 0x000000000f4fe236
4. DB::parseQuery(DB::IParser&, String const&, unsigned long, unsigned long, unsigned long) @ 0x000000000f4fe449
5. local_engine::RowNumGroupArraySorted::parseSortOrderFields(String const&) const @ 0x000000000f8bcf47
6. local_engine::RowNumGroupArraySorted::RowNumGroupArraySorted(std::shared_ptr, DB::Array const&) @ 0x000000000f8bcb08
7. std::shared_ptr std::allocate_shared[abi:ne190107], std::shared_ptr const&, DB::Array const&, 0>(std::allocator const&, std::shared_ptr const&, DB::Array const&) @ 0x000000000f8bc04e
8. local_engine::createAggregateFunctionRowNumGroupArray(String const&, std::vector, std::allocator>> const&, DB::Array const&, DB::Settings const*) @ 0x000000000f8bbe51
9. DB::AggregateFunctionFactory::getImpl(String const&, DB::NullsAction, std::vector, std::allocator>> const&, DB::Array const&, DB::AggregateFunctionProperties&, bool) const @ 0x0000000011fd1133
10. DB::AggregateFunctionFactory::get(String const&, DB::NullsAction, std::vector, std::allocator>> const&, DB::Array const&, DB::AggregateFunctionProperties&) const @ 0x0000000011fcf881
11. local_engine::RelParser::getAggregateFunction(String const&, std::vector, std::allocator>>, DB::AggregateFunctionProperties&, DB::Array const&) @ 0x000000000f6a7d88
12. local_engine::AggregateGroupLimitRelParser::buildAggregateDescription(DB::QueryPlan&) @ 0x000000000f6b3378
13. local_engine::AggregateGroupLimitRelParser::addGroupLmitAggregationStep(DB::QueryPlan&) @ 0x000000000f6ae55e
14. local_engine::AggregateGroupLimitRelParser::parse(std::unique_ptr>, substrait::Rel const&, std::list>&) @ 0x000000000f6a9c14
15. local_engine::GroupLimitRelParser::parse(std::unique_ptr>, substrait::Rel const&, std::list>&) @ 0x000000000f6a9432
16. local_engine::SerializedPlanParser::parseOp(substrait::Rel const&, std::list>&) @ 0x000000000f67d53a
17. local_engine::SerializedPlanParser::parseOp(substrait::Rel const&, std::list>&) @ 0x000000000f67cf79
18. local_engine::SerializedPlanParser::parseOp(substrait::Rel const&, std::list>&) @ 0x000000000f67cf79
19. local_engine::SerializedPlanParser::parse(substrait::Plan const&) @ 0x000000000f67cbef
20. local_engine::SerializedPlanParser::createExecutor(substrait::Plan const&) @ 0x000000000f67e08f
21. Java_org_apache_gluten_vectorized_ExpressionEvaluatorJniWrapper_nativeCreateKernelWithIterator @ 0x00000000075fc121
```

### Gluten version

main branch

### Spark version

Spark-3.3.x

### Spark configurations

_No response_

### System information

_No response_

### Relevant logs

```bash

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.