Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
04c80f8
refactor(sql): use structural matching for aggregate/UDAF deduplication
forsaken628 Mar 24, 2026
fa8f708
feat(sql): add query-local UDF definition cache in BindContext
forsaken628 Mar 18, 2026
505a45f
refactor(sql): rewrite aggregate binder with intern/lookup pattern
forsaken628 Mar 24, 2026
d3727a5
fix(sql): make grouping() rewrite idempotent and add window aggregate…
forsaken628 Mar 19, 2026
b9050a5
test: migrate tests to integration framework with golden files
forsaken628 Mar 24, 2026
5b33901
fix(sql): reject aggregate functions in window partition/order spec
forsaken628 Mar 20, 2026
a5c455b
refactor(sql): add lookup_existing methods for pre-argument-replaceme…
forsaken628 Mar 20, 2026
802885d
refactor(sql): simplify project_set and qualify binder
forsaken628 Mar 20, 2026
b879728
test(sql): add comprehensive binder semantic tests
forsaken628 Mar 24, 2026
3b7056b
refactor(sql): simplify aggregate argument replacement logic
forsaken628 Mar 20, 2026
8edc264
fix(sql): fix window function type checking for nested aggregates
forsaken628 Mar 23, 2026
4c3b935
test: add UserApiProvider support to test framework
forsaken628 Mar 23, 2026
082b2cc
refactor(sql): update aggregate binding, qualify, and sort handling
forsaken628 Mar 23, 2026
507b9c8
refactor(sql): simplify qualify clause and improve grouping check
forsaken628 Mar 23, 2026
288e75a
feat(sql): add push_down_filter for ProjectSet and fix SRF ordering i…
forsaken628 Mar 24, 2026
1259f6f
fix
forsaken628 Mar 24, 2026
f4e00ba
fix
forsaken628 Mar 24, 2026
ecf76d3
init
forsaken628 Mar 24, 2026
a3e27b5
x
forsaken628 Mar 24, 2026
2ea5478
Merge remote-tracking branch 'up/main' into projection-bind
forsaken628 Apr 1, 2026
aabc196
fix
forsaken628 Apr 2, 2026
1809872
fix
forsaken628 Apr 2, 2026
d119cbb
Merge remote-tracking branch 'up/main' into projection-bind
forsaken628 Apr 2, 2026
2983534
fix
forsaken628 Apr 2, 2026
49600e9
refine
forsaken628 Apr 3, 2026
ec77883
fix
forsaken628 Apr 3, 2026
eb53805
refine
forsaken628 Apr 7, 2026
0705861
Merge branch 'main' into projection-bind
forsaken628 Apr 7, 2026
57ee744
fix
forsaken628 Apr 8, 2026
1fd2422
Merge remote-tracking branch 'up/main' into projection-bind
forsaken628 Apr 8, 2026
75bda64
fix
forsaken628 Apr 8, 2026
51e0b7b
refine
forsaken628 Apr 9, 2026
6f31ef1
x
forsaken628 Apr 17, 2026
ece4ed1
Merge remote-tracking branch 'up/main' into projection-bind
forsaken628 Apr 17, 2026
8e217b0
refine
forsaken628 Apr 17, 2026
b0d0042
Merge branch 'main' into projection-bind
forsaken628 Apr 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/query/service/tests/it/sql/exec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,4 @@ pub async fn test_snapshot_consistency() -> anyhow::Result<()> {
}

mod get_table_bind_test;
mod window;
101 changes: 101 additions & 0 deletions src/query/service/tests/it/sql/exec/window.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// Copyright 2021 Datafuse Labs
//
// Licensed 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.

use databend_common_exception::Result;
use databend_query::test_kits::TestFixture;
use databend_query::test_kits::expects_ok;

#[tokio::test(flavor = "multi_thread")]
async fn test_window_grouping_over_rollup() -> Result<()> {
let fixture = TestFixture::setup().await?;
let db = fixture.default_db_name();

fixture
.execute_command(&format!("create database {db}"))
.await?;
fixture
.execute_command(&format!(
"create table {db}.empsalary (depname string, empno bigint, salary int, enroll_date date)"
))
.await?;
fixture
.execute_command(&format!(
"insert into {db}.empsalary values \
('develop', 10, 5200, '2007-08-01'), \
('sales', 1, 5000, '2006-10-01'), \
('personnel', 5, 3500, '2007-12-10'), \
('sales', 4, 4800, '2007-08-08'), \
('personnel', 2, 3900, '2006-12-23'), \
('develop', 7, 4200, '2008-01-01'), \
('develop', 9, 4500, '2008-01-01'), \
('sales', 3, 4800, '2007-08-01'), \
('develop', 8, 6000, '2006-10-01'), \
('develop', 11, 5200, '2007-08-15')"
))
.await?;

expects_ok(
"window grouping over rollup",
fixture
.execute_query(&format!(
"select grouping(salary), grouping(depname), \
sum(grouping(salary)) over (partition by grouping(salary) + grouping(depname) \
order by grouping(depname) desc) \
from {db}.empsalary group by rollup (depname, salary) order by 1,2,3"
))
.await,
vec![
"+----------+----------+----------+",
"| Column 0 | Column 1 | Column 2 |",
"+----------+----------+----------+",
"| 0 | 0 | 0 |",
"| 0 | 0 | 0 |",
"| 0 | 0 | 0 |",
"| 0 | 0 | 0 |",
"| 0 | 0 | 0 |",
"| 0 | 0 | 0 |",
"| 0 | 0 | 0 |",
"| 0 | 0 | 0 |",
"| 1 | 0 | 3 |",
"| 1 | 0 | 3 |",
"| 1 | 0 | 3 |",
"| 1 | 1 | 1 |",
"+----------+----------+----------+",
],
)
.await?;

Ok(())
}

#[tokio::test(flavor = "multi_thread")]
async fn test_unnest_aggregate_argument() -> Result<()> {
let fixture = TestFixture::setup().await?;

expects_ok(
"unnest aggregate argument",
fixture.execute_query("select unnest(max([11,12]))").await,
vec![
"+----------+",
"| Column 0 |",
"+----------+",
"| 11 |",
"| 12 |",
"+----------+",
],
)
.await?;

Ok(())
}
13 changes: 0 additions & 13 deletions src/query/service/tests/it/sql/planner/builders/binder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,3 @@ async fn test_query_kind() -> anyhow::Result<()> {
assert_eq!(kind, QueryKind::CopyIntoTable);
Ok(())
}

#[tokio::test(flavor = "multi_thread")]
async fn test_planner() -> anyhow::Result<()> {
let fixture = TestFixture::setup().await?;

let ctx = fixture.new_query_ctx().await?;
let mut planner = Planner::new(ctx.clone());
planner
.plan_sql("SELECT avg(number) from numbers_mt(10000)")
.await?;

Ok(())
}
Loading
Loading