Skip to content

Commit

Permalink
added check of metadata
Browse files Browse the repository at this point in the history
Signed-off-by: JustinRush80 <[email protected]>
  • Loading branch information
JustinRush80 committed Jan 27, 2025
1 parent 7dab953 commit 8bf69c5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/core/src/operations/merge/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ use datafusion_expr::{
UNNAMED_TABLE,
};

use delta_kernel::schema::StructType;
use delta_kernel::schema::{ColumnMetadataKey, StructType};
use filter::try_construct_early_filter;
use futures::future::BoxFuture;
use parquet::file::properties::WriterProperties;
Expand Down Expand Up @@ -1522,6 +1522,13 @@ fn modify_schema(
{
// This assume that all the columns in the MERGE operations of UPDATE and INSERT at least exists in the source table
let source_field = source_schema.field_with_unqualified_name(columns.name())?;
if source_field
.metadata()
.contains_key(ColumnMetadataKey::GenerationExpression.as_ref())
{
let error = arrow::error::ArrowError::SchemaError("Schema evolved fields cannot have generated expressions. Recreate the table to achieve this.".to_string());
return Err(DeltaTableError::Arrow { source: error });
}

if let Some(target_field) = target_schema.field_from_column(columns).ok() {
// for nested data types we need to first merge then see if there a change then replace the pre-existing field
Expand Down

0 comments on commit 8bf69c5

Please sign in to comment.