This is an automated email from the ASF dual-hosted git repository.
JingsongLi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/paimon-rust.git
The following commit(s) were added to refs/heads/main by this push:
new df52f335 fix(datafusion): allow vector search without table definition
(#735)
df52f335 is described below
commit df52f335a6b09b608544637d4b1be8f57d35303a
Author: jerry <[email protected]>
AuthorDate: Fri Aug 21 13:30:26 2026 +0800
fix(datafusion): allow vector search without table definition (#735)
---
crates/integrations/datafusion/src/table/mod.rs | 4 ++--
.../datafusion/tests/sql_context_tests.rs | 28 ++++++++++++++++++++++
2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/crates/integrations/datafusion/src/table/mod.rs
b/crates/integrations/datafusion/src/table/mod.rs
index 3e4ad496..8a18d476 100644
--- a/crates/integrations/datafusion/src/table/mod.rs
+++ b/crates/integrations/datafusion/src/table/mod.rs
@@ -113,8 +113,8 @@ impl PaimonTableProvider {
///
/// Loads the table schema and converts it to Arrow for DataFusion.
pub fn try_new(table: Table) -> DFResult<Self> {
- let table_definition = build_table_definition(&table)?;
- Self::try_new_with_table_definition(table, Some(table_definition))
+ let table_definition = build_table_definition(&table).ok();
+ Self::try_new_with_table_definition(table, table_definition)
}
fn try_new_with_table_definition(
diff --git a/crates/integrations/datafusion/tests/sql_context_tests.rs
b/crates/integrations/datafusion/tests/sql_context_tests.rs
index e308d192..2e550631 100644
--- a/crates/integrations/datafusion/tests/sql_context_tests.rs
+++ b/crates/integrations/datafusion/tests/sql_context_tests.rs
@@ -2834,3 +2834,31 @@ async fn
test_show_create_table_rejects_non_round_trippable_types() {
);
}
}
+
+#[tokio::test]
+async fn test_vector_search_plans_vector_column_without_show_create_support() {
+ let (_tmp, catalog) = create_test_env();
+ let sql_context = create_sql_context(catalog.clone()).await;
+ let identifier = Identifier::new("default", "vector_t");
+ let schema = paimon::spec::Schema::builder()
+ .column("id", DataType::Int(IntType::new()))
+ .column(
+ "embedding",
+ DataType::Vector(VectorType::new(2,
DataType::Float(FloatType::new())).unwrap()),
+ )
+ .build()
+ .unwrap();
+
+ catalog
+ .create_table(&identifier, schema, false)
+ .await
+ .unwrap();
+
+ sql_context
+ .sql(
+ "SELECT * FROM vector_search(\
+ 'paimon.default.vector_t', 'embedding', '[1.0, 2.0]', 1)",
+ )
+ .await
+ .expect("vector_search should plan without requiring SHOW CREATE TABLE
support");
+}