Skip to content

Commit

Permalink
handle single pq file
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahyurick committed Dec 4, 2023
1 parent 779b6bb commit 92a5b09
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/sql/optimizer/dynamic_partition_pruning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,18 @@ fn read_table(
field_string: String,
tables: HashMap<String, TableInfo>,
) -> Option<HashSet<RowValue>> {
// Obtain filepaths to all relevant Parquet files, e.g., in a directory of Parquet files
let paths = fs::read_dir(tables.get(&table_string).unwrap().filepath.clone()).unwrap();
let file_path = tables.get(&table_string).unwrap().filepath.clone();
let paths: fs::ReadDir;
let mut files = vec![];
for path in paths {
files.push(path.unwrap().path().display().to_string())
if fs::metadata(&file_path).map(|metadata| metadata.is_dir()).unwrap_or(false) {
// Obtain filepaths to all relevant Parquet files, e.g., in a directory of Parquet files
paths = fs::read_dir(&file_path).unwrap();
for path in paths {
files.push(path.unwrap().path().display().to_string())
}
} else {
// Obtain single Parquet file
files.push(file_path);
}

// Using the filepaths to the Parquet tables, obtain the schemas of the relevant tables
Expand Down

0 comments on commit 92a5b09

Please sign in to comment.