-
Notifications
You must be signed in to change notification settings - Fork 74
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
feat: robustify pre-signed URL checks #760
Changes from 2 commits
1f378d0
40e989a
9fe90b3
c310284
f89f4f0
88d41dd
b2c6915
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,23 +4,24 @@ use std::collections::HashMap; | |
use std::ops::Range; | ||
use std::sync::Arc; | ||
|
||
use crate::arrow::array::builder::{MapBuilder, MapFieldNames, StringBuilder}; | ||
use crate::arrow::array::{BooleanArray, Int64Array, RecordBatch, StringArray}; | ||
use crate::parquet::arrow::arrow_reader::{ | ||
ArrowReaderMetadata, ArrowReaderOptions, ParquetRecordBatchReaderBuilder, | ||
}; | ||
use crate::parquet::arrow::arrow_writer::ArrowWriter; | ||
use crate::parquet::arrow::async_reader::{ParquetObjectReader, ParquetRecordBatchStreamBuilder}; | ||
use futures::StreamExt; | ||
use object_store::path::Path; | ||
use object_store::DynObjectStore; | ||
use uuid::Uuid; | ||
|
||
use super::file_stream::{FileOpenFuture, FileOpener, FileStream}; | ||
use super::UrlExt; | ||
use crate::arrow::array::builder::{MapBuilder, MapFieldNames, StringBuilder}; | ||
use crate::arrow::array::{BooleanArray, Int64Array, RecordBatch, StringArray}; | ||
use crate::engine::arrow_data::ArrowEngineData; | ||
use crate::engine::arrow_utils::{fixup_parquet_read, generate_mask, get_requested_indices}; | ||
use crate::engine::default::executor::TaskExecutor; | ||
use crate::engine::parquet_row_group_skipping::ParquetRowGroupSkipping; | ||
use crate::parquet::arrow::arrow_reader::{ | ||
ArrowReaderMetadata, ArrowReaderOptions, ParquetRecordBatchReaderBuilder, | ||
}; | ||
use crate::parquet::arrow::arrow_writer::ArrowWriter; | ||
use crate::parquet::arrow::async_reader::{ParquetObjectReader, ParquetRecordBatchStreamBuilder}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i actually hesitate to move these crate::{arrow/parquet} items down here since they aren't really our crate (just re-exports). I generally group my imports into one of: std, external, and crate. I would advocate for having a new grouping just for arrow/parquet (or alternatively just leave in external group) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. makes a lot of sense. reverted for now to leave that for a future decision ... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sounds good, thanks! |
||
use crate::schema::SchemaRef; | ||
use crate::{ | ||
DeltaResult, EngineData, Error, ExpressionRef, FileDataReadResultIterator, FileMeta, | ||
|
@@ -191,18 +192,19 @@ impl<E: TaskExecutor> ParquetHandler for DefaultParquetHandler<E> { | |
// -> reqwest to get data | ||
// -> parse to parquet | ||
// SAFETY: we did is_empty check above, this is ok. | ||
let file_opener: Box<dyn FileOpener> = match files[0].location.scheme() { | ||
"http" | "https" => Box::new(PresignedUrlOpener::new( | ||
let file_opener: Box<dyn FileOpener> = if files[0].location.is_presigned() { | ||
Box::new(PresignedUrlOpener::new( | ||
1024, | ||
physical_schema.clone(), | ||
predicate, | ||
)), | ||
_ => Box::new(ParquetOpener::new( | ||
)) | ||
} else { | ||
Box::new(ParquetOpener::new( | ||
1024, | ||
physical_schema.clone(), | ||
predicate, | ||
self.store.clone(), | ||
)), | ||
)) | ||
}; | ||
FileStream::new_async_read_iterator( | ||
self.task_executor.clone(), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so only material change is checking that the query is Some? maybe link docs to the guarantee?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the checks to explicitly consider some well known cases. Initially i thought covering all cases would not be feasible, so just make the heuristic a bit more concrete. Then again, hopefully people will leet us know in case there are servers out there using different signing schemes.