Skip to content

Commit

Permalink
refactor: only mutate file_path
Browse files Browse the repository at this point in the history
  • Loading branch information
de-sh committed Dec 8, 2024
1 parent 8a7cbf8 commit 871fc3f
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions src/query/stream_schema_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ use datafusion::{
scalar::ScalarValue,
};

use futures_util::{stream::FuturesOrdered, StreamExt, TryFutureExt, TryStreamExt};
use futures_util::{stream::FuturesOrdered, StreamExt, TryStreamExt};
use itertools::Itertools;
use object_store::{path::Path, ObjectStore};
use relative_path::RelativePathBuf;
Expand Down Expand Up @@ -379,8 +379,9 @@ fn partitioned_files(
.enumerate()
.map(|(x, y)| (x % target_partition, y))
{
#[allow(unused_mut)]
let catalog::manifest::File {
file_path,
mut file_path,
num_rows,
columns,
..
Expand All @@ -392,23 +393,15 @@ fn partitioned_files(
// the github issue- https://github.com/parseablehq/parseable/issues/824
// For some reason, the `from_absolute_path()` doesn't work for macos, hence the ugly solution
// TODO: figure out an elegant solution to this
let pf;

#[cfg(unix)]
{
pf = PartitionedFile::new(file_path, file.file_size);
}
#[cfg(windows)]
{
pf = if CONFIG.storage_name.eq("drive") {
let file_path = object_store::path::Path::from_absolute_path(file_path).unwrap();
PartitionedFile::new(file_path, file.file_size)
} else {
PartitionedFile::new(file_path, file.file_size)
};
if CONFIG.storage_name.eq("drive") {
file_path = object_store::path::Path::from_absolute_path(file_path).unwrap();
}
}

let pf = PartitionedFile::new(file_path, file.file_size);
partitioned_files[index].push(pf);

columns.into_iter().for_each(|col| {
column_statistics
.entry(col.name)
Expand Down

0 comments on commit 871fc3f

Please sign in to comment.