feat(vector): add qdrant and milvus support
This commit is contained in:
1 parent
fffdcb9db1
commit
e27d34a34a
45 files changed
+1116
-29
No files matched your search
@@ -82,6 +82,10 @@ pub fn build_table_data_select_sql(options: TableDataSelectSqlOptions) -> String
|
||||
);
|
||||
}
|
||||
|
||||
if database_type == Some(DatabaseType::OceanbaseOracle) {
|
||||
return build_oceanbase_oracle_table_select_sql(&table_alias, &where_clause, &order, &select_columns, limit);
|
||||
}
|
||||
|
||||
if database_type == Some(DatabaseType::Oracle) {
|
||||
return format!("SELECT {select_columns} FROM {table_alias}{where_clause}{order}");
|
||||
}
|
||||
@@ -165,6 +169,11 @@ pub fn build_table_select_sql(options: TableSelectSqlOptions<'_>) -> String {
|
||||
return format!("SELECT FIRST {limit} {select_columns} FROM {table}{order_by}");
|
||||
}
|
||||
|
||||
if database_type == Some(DatabaseType::OceanbaseOracle) {
|
||||
let inner_select = format!("SELECT {select_columns} FROM {table}{order_by}");
|
||||
return format!("SELECT {select_columns} FROM ({inner_select}) WHERE ROWNUM <= {limit}");
|
||||
}
|
||||
|
||||
if database_type.is_some_and(uses_fetch_first) {
|
||||
return format!("SELECT {select_columns} FROM {table}{order_by} FETCH FIRST {limit} ROWS ONLY");
|
||||
}
|
||||
@@ -189,6 +198,17 @@ fn informix_row_limit_clause(limit: usize, offset: usize) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
fn build_oceanbase_oracle_table_select_sql(
|
||||
table: &str,
|
||||
where_clause: &str,
|
||||
order: &str,
|
||||
select_columns: &str,
|
||||
limit: usize,
|
||||
) -> String {
|
||||
let inner_select = format!("SELECT {select_columns} FROM {table}{where_clause}{order}");
|
||||
format!("SELECT {select_columns} FROM ({inner_select}) WHERE ROWNUM <= {limit}")
|
||||
}
|
||||
|
||||
pub(super) fn is_oracle_row_id(database_type: Option<DatabaseType>, name: &str) -> bool {
|
||||
database_type == Some(DatabaseType::Oracle) && name.eq_ignore_ascii_case(DBX_ROWID_COLUMN)
|
||||
}
|
||||
|
||||
@@ -90,6 +90,17 @@ fn builds_select_sql_with_limit_syntax_for_database_type() {
|
||||
}),
|
||||
"SELECT \"id\", \"name\" FROM \"DB2INST1\".\"USERS\" ORDER BY \"id\" ASC FETCH FIRST 100 ROWS ONLY"
|
||||
);
|
||||
assert_eq!(
|
||||
build_table_select_sql(TableSelectSqlOptions {
|
||||
database_type: Some(DatabaseType::OceanbaseOracle),
|
||||
schema: Some("DBXTEST"),
|
||||
table_name: "USERS",
|
||||
columns: &columns,
|
||||
order_columns: &keys,
|
||||
limit: 100,
|
||||
}),
|
||||
"SELECT \"id\", \"name\" FROM (SELECT \"id\", \"name\" FROM \"DBXTEST\".\"USERS\" ORDER BY \"id\" ASC) WHERE ROWNUM <= 100"
|
||||
);
|
||||
// JDBC connections skip SQL-level row limiting — the JDBC agent handles
|
||||
// it via Statement.setMaxRows() which is universally supported.
|
||||
assert_eq!(
|
||||
@@ -269,6 +280,38 @@ fn builds_table_data_where_and_schema_queries() {
|
||||
}),
|
||||
"SELECT * FROM \"DB2INST1\".\"ORDERS\" WHERE (amount > 10) FETCH FIRST 50 ROWS ONLY"
|
||||
);
|
||||
assert_eq!(
|
||||
build_table_data_select_sql(TableDataSelectSqlOptions {
|
||||
database_type: Some(DatabaseType::OceanbaseOracle),
|
||||
schema: Some("DBXTEST".to_string()),
|
||||
table_name: "ORDERS".to_string(),
|
||||
primary_keys: Vec::new(),
|
||||
columns: Vec::new(),
|
||||
fallback_order_columns: Vec::new(),
|
||||
order_by: None,
|
||||
limit: Some(100),
|
||||
offset: None,
|
||||
where_input: None,
|
||||
include_row_id: false,
|
||||
}),
|
||||
"SELECT * FROM (SELECT * FROM \"DBXTEST\".\"ORDERS\") WHERE ROWNUM <= 100"
|
||||
);
|
||||
assert_eq!(
|
||||
build_table_data_select_sql(TableDataSelectSqlOptions {
|
||||
database_type: Some(DatabaseType::OceanbaseOracle),
|
||||
schema: Some("DBXTEST".to_string()),
|
||||
table_name: "ORDERS".to_string(),
|
||||
primary_keys: vec!["ID".to_string()],
|
||||
columns: Vec::new(),
|
||||
fallback_order_columns: Vec::new(),
|
||||
order_by: None,
|
||||
limit: Some(50),
|
||||
offset: None,
|
||||
where_input: Some("WHERE amount > 10".to_string()),
|
||||
include_row_id: false,
|
||||
}),
|
||||
"SELECT * FROM (SELECT * FROM \"DBXTEST\".\"ORDERS\" WHERE (amount > 10) ORDER BY \"ID\" ASC) WHERE ROWNUM <= 50"
|
||||
);
|
||||
assert_eq!(
|
||||
build_table_data_select_sql(TableDataSelectSqlOptions {
|
||||
database_type: Some(DatabaseType::Db2),
|
||||
|
||||
Reference in new issue
Block a user