Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -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" }
Expand Down
46 changes: 46 additions & 0 deletions crates/integrations/datafusion/src/table/table_provider_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading