-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wasm-qe] fix chunking tests (#4656)
Co-authored-by: Alexey Orlenko <[email protected]>
- Loading branch information
Showing
14 changed files
with
169 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 15 additions & 19 deletions
34
query-engine/connector-test-kit-rs/query-engine-tests/tests/new/regressions/prisma_7434.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...y-engine-tests/tests/queries/batch/mod.rs → ...ngine-tests/tests/queries/batching/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
mod in_selection_batching; | ||
mod select_one_compound; | ||
mod select_one_singular; | ||
mod transactional_batch; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
query-engine/connector-test-kit-rs/query-engine-tests/tests/queries/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
mod aggregation; | ||
mod batch; | ||
mod batching; | ||
mod chunking; | ||
mod data_types; | ||
mod distinct; | ||
mod filters; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 8 additions & 27 deletions
35
query-engine/connectors/sql-query-connector/src/context.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,31 @@ | ||
use quaint::{connector::SqlFamily, prelude::ConnectionInfo}; | ||
use quaint::prelude::ConnectionInfo; | ||
|
||
pub(super) struct Context<'a> { | ||
connection_info: &'a ConnectionInfo, | ||
pub(crate) trace_id: Option<&'a str>, | ||
/// Maximum rows allowed at once for an insert query. | ||
/// None is unlimited. | ||
pub(crate) max_rows: Option<usize>, | ||
pub(crate) max_insert_rows: Option<usize>, | ||
/// Maximum number of bind parameters allowed for a single query. | ||
/// None is unlimited. | ||
pub(crate) max_bind_values: Option<usize>, | ||
} | ||
|
||
impl<'a> Context<'a> { | ||
pub(crate) fn new(connection_info: &'a ConnectionInfo, trace_id: Option<&'a str>) -> Self { | ||
let (max_rows, default_batch_size) = match connection_info.sql_family() { | ||
SqlFamily::Postgres => (None, 32766), | ||
// See https://stackoverflow.com/a/11131824/788562 | ||
SqlFamily::Mysql => (None, 65535), | ||
SqlFamily::Mssql => (Some(1000), 2099), | ||
SqlFamily::Sqlite => (Some(999), 999), | ||
}; | ||
let sql_family = connection_info.sql_family(); | ||
let max_insert_rows = sql_family.max_insert_rows(); | ||
let max_bind_values = sql_family.max_bind_values(); | ||
|
||
Context { | ||
connection_info, | ||
trace_id, | ||
max_rows, | ||
max_bind_values: get_batch_size(default_batch_size), | ||
max_insert_rows, | ||
max_bind_values: Some(max_bind_values), | ||
} | ||
} | ||
|
||
pub(crate) fn schema_name(&self) -> &str { | ||
self.connection_info.schema_name() | ||
} | ||
} | ||
|
||
fn get_batch_size(default: usize) -> Option<usize> { | ||
use once_cell::sync::Lazy; | ||
|
||
/// Overrides the default number of allowed elements in query's `IN` or `NOT IN` | ||
/// statement for the currently loaded connector. | ||
/// Certain databases error out if querying with too many items. For test | ||
/// purposes, this value can be set with the `QUERY_BATCH_SIZE` environment | ||
/// value to a smaller number. | ||
static BATCH_SIZE_OVERRIDE: Lazy<Option<usize>> = Lazy::new(|| { | ||
std::env::var("QUERY_BATCH_SIZE") | ||
.ok() | ||
.map(|size| size.parse().expect("QUERY_BATCH_SIZE: not a valid size")) | ||
}); | ||
(*BATCH_SIZE_OVERRIDE).or(Some(default)) | ||
} |
Oops, something went wrong.