Skip to content

Commit

Permalink
Fix column filter for * query
Browse files Browse the repository at this point in the history
  • Loading branch information
cswinter committed Aug 19, 2024
1 parent 389dd66 commit 6ceb2c4
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/locustdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,15 @@ impl LocustDB {
Err(err) => return Ok(Err(err)),
};

let referenced_cols: Vec<_> = query.find_referenced_cols().into_iter().collect();
let mut data = match self.inner_locustdb.snapshot(&query.table, Some(&referenced_cols[..])) {
let referenced_cols = query.find_referenced_cols();
let colsvec;
let column_filter = if referenced_cols.contains("*") {
None
} else {
colsvec = referenced_cols.into_iter().collect::<Vec<_>>();
Some(&colsvec[..])
};
let mut data = match self.inner_locustdb.snapshot(&query.table, column_filter) {
Some(data) => data,
None => {
return Ok(Err(QueryError::NotImplemented(format!(
Expand Down Expand Up @@ -164,7 +171,11 @@ impl LocustDB {
InnerLocustDB::start_worker_threads(&self.inner_locustdb);
}

pub async fn mem_tree(&self, depth: usize, table: Option<String>) -> Result<Vec<MemTreeTable>, oneshot::Canceled> {
pub async fn mem_tree(
&self,
depth: usize,
table: Option<String>,
) -> Result<Vec<MemTreeTable>, oneshot::Canceled> {
let inner = self.inner_locustdb.clone();
let (task, receiver) = <dyn Task>::from_fn(move || inner.mem_tree(depth, table.clone()));
self.schedule(task);
Expand Down Expand Up @@ -231,7 +242,7 @@ impl Default for Options {
mem_lz4: true,
readahead: 256 * 1024 * 1024, // 256 MiB
seq_disk_read: false,
max_wal_size_bytes: 64 * 1024 * 1024, // 64 MiB
max_wal_size_bytes: 64 * 1024 * 1024, // 64 MiB
max_partition_size_bytes: 8 * 1024 * 1024, // 8 MiB
partition_combine_factor: 4,
batch_size: 1024,
Expand Down

0 comments on commit 6ceb2c4

Please sign in to comment.