fix(cassandra): use cursor pagination for table data and exports
Closes #7465
This commit is contained in:
1 parent
d452346082
commit
4190bab5ad
17 files changed
+1099
-88
No files matched your search
@@ -338,6 +338,22 @@ mod tests {
|
||||
assert!(query.sql.contains("FROM \"public\".\"orders\""));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cassandra_bounded_search_keeps_its_limit() {
|
||||
let query = build_database_search_sql(DatabaseSearchSqlOptions {
|
||||
database_type: Some(DatabaseType::Cassandra),
|
||||
driver_profile: None,
|
||||
schema: Some("app".to_string()),
|
||||
table_name: "events".to_string(),
|
||||
columns: vec![col("id", "int", true)],
|
||||
term: "42".to_string(),
|
||||
limit: Some(17),
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
assert!(query.sql.ends_with(" LIMIT 17;"), "sql was: {}", query.sql);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn builds_oceanbase_oracle_search_query_with_rownum_limit() {
|
||||
let query = build_database_search_sql(DatabaseSearchSqlOptions {
|
||||
|
||||
@@ -335,6 +335,9 @@ pub fn build_count_query_sql(options: CountQuerySqlOptions) -> QuerySqlBuildResu
|
||||
if unsupported_pagination_type(options.database_type) {
|
||||
return err("unsupported");
|
||||
}
|
||||
if options.database_type == Some(DatabaseType::Cassandra) {
|
||||
return err("unsupported");
|
||||
}
|
||||
let (execution_hint, statement) = split_leading_execution_hint(&statement, options.database_type);
|
||||
// A locking clause does not affect cardinality and cannot appear inside
|
||||
// every dialect's derived-table count query. PostgreSQL permits pagination
|
||||
@@ -4784,6 +4787,25 @@ WHERE u.id = picked.id;
|
||||
assert_eq!(plan.page_offset, Some(200));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cassandra_offset_jump_keeps_agent_result_session_without_sql_pagination() {
|
||||
let plan = build_query_pagination_execution_plan(QueryPaginationExecutionPlanOptions {
|
||||
sql: "SELECT * FROM events".to_string(),
|
||||
query_base_sql: "SELECT * FROM events".to_string(),
|
||||
database_type: Some(DatabaseType::Cassandra),
|
||||
pagination: QueryPagination { limit: 100, offset: 200, session_id: None },
|
||||
use_agent_cursor: true,
|
||||
first_page_uses_actual_sql: false,
|
||||
});
|
||||
|
||||
assert_eq!(plan.sql_to_execute, "SELECT * FROM events;");
|
||||
assert_eq!(plan.page_limit, Some(100));
|
||||
assert_eq!(plan.page_offset, Some(200));
|
||||
assert!(plan.page_sql.is_some());
|
||||
assert!(plan.count_sql.is_none());
|
||||
assert!(plan.use_agent_result_session);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rewritten_offset_jump_does_not_use_agent_result_session() {
|
||||
let plan = build_query_pagination_execution_plan(QueryPaginationExecutionPlanOptions {
|
||||
|
||||
Reference in new issue
Block a user