diff --git a/Cargo.toml b/Cargo.toml index 882298a09d..ff8a401cde 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -166,7 +166,7 @@ zstd = "0.13.3" # Spice links iceberg-rust against its arrow-rs and DataFusion forks, so the tests here run # against the same forks. [patch.crates-io] -# arrow-rs 59.3.0 with Spice patches — branch: spiceai-59-patches +# arrow-rs 59.3.0 with Spice patches — branch: spiceai-59 arrow = { git = "https://github.com/spiceai/arrow-rs.git", rev = "2e2cc330c64ac8a9e44d2a5f2da171b391f775b8" } arrow-arith = { git = "https://github.com/spiceai/arrow-rs.git", rev = "2e2cc330c64ac8a9e44d2a5f2da171b391f775b8" } arrow-array = { git = "https://github.com/spiceai/arrow-rs.git", rev = "2e2cc330c64ac8a9e44d2a5f2da171b391f775b8" } @@ -185,7 +185,7 @@ arrow-select = { git = "https://github.com/spiceai/arrow-rs.git", rev = "2e2cc33 arrow-string = { git = "https://github.com/spiceai/arrow-rs.git", rev = "2e2cc330c64ac8a9e44d2a5f2da171b391f775b8" } parquet = { git = "https://github.com/spiceai/arrow-rs.git", rev = "2e2cc330c64ac8a9e44d2a5f2da171b391f775b8" } -# DataFusion 55.1.0 with Spice patches — branch: spiceai-55-patches +# DataFusion 55.1.0 with Spice patches — branch: spiceai-55 datafusion = { git = "https://github.com/spiceai/datafusion.git", rev = "02550cf9462b9f56506b6b1cd07eabf08c46e200" } datafusion-catalog = { git = "https://github.com/spiceai/datafusion.git", rev = "02550cf9462b9f56506b6b1cd07eabf08c46e200" } datafusion-catalog-listing = { git = "https://github.com/spiceai/datafusion.git", rev = "02550cf9462b9f56506b6b1cd07eabf08c46e200" } diff --git a/crates/integrations/datafusion/src/table/table_provider_factory.rs b/crates/integrations/datafusion/src/table/table_provider_factory.rs index 6ba93237f9..6b5c10cad4 100644 --- a/crates/integrations/datafusion/src/table/table_provider_factory.rs +++ b/crates/integrations/datafusion/src/table/table_provider_factory.rs @@ -298,6 +298,52 @@ mod tests { assert_eq!(actual_schema.as_ref(), &expected_schema); } + #[tokio::test] + async fn test_create_rejects_zero_locations() { + let factory = IcebergTableProviderFactory::new(); + + let state = SessionStateBuilder::new().build(); + let cmd = CreateExternalTable { + locations: vec![], + ..create_external_table_cmd() + }; + + let error = factory + .create(&state, &cmd) + .await + .expect_err("a command without a location should be rejected"); + + assert!( + error + .to_string() + .contains("exactly one metadata file location, got 0"), + "unexpected error: {error}" + ); + } + + #[tokio::test] + async fn test_create_rejects_multiple_locations() { + let factory = IcebergTableProviderFactory::new(); + + let state = SessionStateBuilder::new().build(); + let cmd = CreateExternalTable { + locations: vec![table_metadata_location(), table_metadata_location()], + ..create_external_table_cmd() + }; + + let error = factory + .create(&state, &cmd) + .await + .expect_err("a command with several locations should be rejected"); + + assert!( + error + .to_string() + .contains("exactly one metadata file location, got 2"), + "unexpected error: {error}" + ); + } + #[tokio::test] async fn test_schema_of_created_external_table_sql() { let mut state = SessionStateBuilder::new().with_default_features().build();