Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(query): fix topk in native #17003

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
6 changes: 3 additions & 3 deletions scripts/setup/rust-tools.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cargo-audit@0.18.3
cargo-machete@0.6.0
cargo-nextest@0.9.67
taplo-cli@0.8.1
typos-cli@1.17.2
cargo-nextest@0.9.85
taplo-cli@0.9.3
typos-cli@1.28.2
17 changes: 7 additions & 10 deletions src/query/catalog/src/plan/pushdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,19 +226,16 @@ impl PushDownInfo {
}

let leaf_fields = schema.leaf_fields();
let (leaf_id, f) = leaf_fields
leaf_fields
.iter()
.enumerate()
.find(|&(_, p)| p.name() == id)
.unwrap();

let top_k = TopK {
limit: self.limit.unwrap(),
field: f.clone(),
asc: order.1,
leaf_id,
};
Some(top_k)
.map(|(leaf_id, f)| TopK {
limit: self.limit.unwrap(),
field: f.clone(),
asc: order.1,
leaf_id,
})
} else {
None
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,18 @@ select * from test where url like '%google%' order by event_time limit 10;
0 2024-01-03 00:00:00.000000 http://www.google.com/xxx/
0 2024-01-04 00:00:00.000000 http://www.google.com/xxx/


statement ok
create table test_k storage_format = 'native' as select * from test;


query ITT
select * from test_k where url like '%google%' order by event_time limit 1;
----
0 2024-01-01 00:00:00.000000 http://www.google.com/xxx/

statement ok
drop table test

statement ok
drop table test_k
Loading