mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-12 14:52:26 +00:00
feat(sql): rename dedup table functions
This commit is contained in:
@@ -76,7 +76,7 @@ pub trait DuplicatePairsResolver: std::fmt::Debug + Send + Sync {
|
||||
) -> Result<Arc<dyn TableProvider>>;
|
||||
}
|
||||
|
||||
/// `vector_duplicate_pairs('table', version, 'column', threshold)`.
|
||||
/// `duplicate_pairs('table', version, 'column', threshold)`.
|
||||
/// Registration is explicit so the host controls catalog access and execution.
|
||||
#[derive(Debug)]
|
||||
pub struct DuplicatePairsTableFunction {
|
||||
@@ -108,7 +108,7 @@ impl TableFunctionImpl for DuplicatePairsTableFunction {
|
||||
fn call(&self, args: &[Expr]) -> Result<Arc<dyn TableProvider>> {
|
||||
if args.len() != 4 {
|
||||
return plan_err!(
|
||||
"vector_duplicate_pairs requires (table, dataset_version, column, distance_threshold)"
|
||||
"duplicate_pairs requires (table, dataset_version, column, distance_threshold)"
|
||||
);
|
||||
}
|
||||
let string = |expr: &Expr| match expr {
|
||||
|
||||
@@ -193,7 +193,7 @@ impl VectorQueryTable {
|
||||
|| options.output.id_column.is_some())
|
||||
{
|
||||
return plan_err!(
|
||||
"vector_dedup requires all partitions and returns original rows; sampling and id_column are pair-query options"
|
||||
"dedupe requires all partitions and returns original rows; sampling and id_column are pair-query options"
|
||||
);
|
||||
}
|
||||
let config = DuplicatePairsConfig {
|
||||
|
||||
@@ -168,7 +168,7 @@ async fn sql_pairs_match_native_snapshot_and_partition_tasks() -> anyhow::Result
|
||||
let ctx =
|
||||
SessionContext::new_with_config_rt(datafusion::prelude::SessionConfig::new(), runtime);
|
||||
ctx.register_udtf(
|
||||
"vector_duplicate_pairs",
|
||||
"duplicate_pairs",
|
||||
Arc::new(DuplicatePairsTableFunction::new(resolver.clone())),
|
||||
);
|
||||
ctx.register_udtf(
|
||||
@@ -192,7 +192,7 @@ async fn sql_pairs_match_native_snapshot_and_partition_tasks() -> anyhow::Result
|
||||
.try_collect::<Vec<_>>()
|
||||
.await?;
|
||||
let sql = format!(
|
||||
"SELECT * FROM vector_duplicate_pairs('source', {version}, 'vector', {threshold})"
|
||||
"SELECT * FROM duplicate_pairs('source', {version}, 'vector', {threshold})"
|
||||
);
|
||||
let actual = ctx.sql(&sql).await?.collect().await?;
|
||||
assert_eq!(pairs(&actual), pairs(&expected));
|
||||
@@ -361,7 +361,7 @@ async fn sql_pairs_match_native_snapshot_and_partition_tasks() -> anyhow::Result
|
||||
table.delete("id = 1").await?;
|
||||
let actual = ctx
|
||||
.sql(&format!(
|
||||
"SELECT * FROM vector_duplicate_pairs('source', {version}, 'vector', 1.0)"
|
||||
"SELECT * FROM duplicate_pairs('source', {version}, 'vector', 1.0)"
|
||||
))
|
||||
.await?
|
||||
.collect()
|
||||
@@ -369,7 +369,7 @@ async fn sql_pairs_match_native_snapshot_and_partition_tasks() -> anyhow::Result
|
||||
assert_eq!(pairs(&actual).len(), 8);
|
||||
assert!(
|
||||
ctx.sql(&format!(
|
||||
"SELECT * FROM vector_duplicate_pairs('source', {version}, 'missing', 1.0)"
|
||||
"SELECT * FROM duplicate_pairs('source', {version}, 'missing', 1.0)"
|
||||
))
|
||||
.await?
|
||||
.collect()
|
||||
|
||||
Reference in New Issue
Block a user