Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • core/sbroad
1 result
Show changes
Commits on Source (1)
  • Arseniy Volynets's avatar
    fix: vtable max rows limit not applied · b6574768
    Arseniy Volynets authored
    - We didn't apply vtable max rows value
    when executing local sql. We tried to lookup
    it in the execute options hashmap and took
    the default value instead, though it was
    not stored in the hashmap.
    b6574768
......@@ -137,6 +137,16 @@ option_queries.test_vtable_max_rows_on_storage = function()
r, err = api:call("sbroad.execute", { query_str .. [[ option(vtable_max_rows = 6) ]] })
t.assert_equals(err, nil)
t.assert_equals(r, { row_count = 6 })
query_str = [[delete from "testing_space" ]]
_, err = api:call("sbroad.execute", { query_str .. [[option(vtable_max_rows = 1) ]] })
-- we can't test whole error message
-- because on different storages there will be different amount
t.assert_str_contains(err, [[Exceeded maximum number of rows (1) in virtual table]])
r, err = api:call("sbroad.execute", { query_str .. [[ option(vtable_max_rows = 12) ]] })
t.assert_equals(err, nil)
t.assert_equals(r, { row_count = 12 })
end
option_queries.test_vtable_max_rows_insert_values = function()
......
......@@ -1294,7 +1294,7 @@ impl RequiredPlanInfo for QueryInfo<'_> {
}
fn vtable_max_rows(&self) -> u64 {
self.required.options.execute_options.vtable_max_rows()
self.required.options.vtable_max_rows
}
fn extract_data(&mut self) -> EncodedTables {
......@@ -1342,7 +1342,7 @@ impl RequiredPlanInfo for EncodedQueryInfo<'_> {
}
fn vtable_max_rows(&self) -> u64 {
self.required.options.execute_options.vtable_max_rows()
self.required.options.vtable_max_rows
}
fn extract_data(&mut self) -> EncodedTables {
......
......@@ -154,8 +154,7 @@ fn repack_data(
let rows = rmpv::ext::from_value::<Vec<rmpv::Value>>(data).expect("failed to decode DQL data");
if rows.len() as u64 > max_rows {
return Err(SbroadError::UnexpectedNumberOfValues(format_smolstr!(
"expected at most {} rows, got {}",
max_rows,
"Exceeded maximum number of rows ({max_rows}) in virtual table: {}",
rows.len()
)));
}
......