MCPcopy Create free account
hub / github.com/apache/paimon-rust / validate_blob_fields

Method validate_blob_fields

crates/paimon/src/spec/schema.rs:472–507  ·  view source on GitHub ↗
(
        fields: &[DataField],
        partition_keys: &[String],
        options: &HashMap<String, String>,
    )

Source from the content-addressed store, hash-verified

470 }
471
472 fn validate_blob_fields(
473 fields: &[DataField],
474 partition_keys: &[String],
475 options: &HashMap<String, String>,
476 ) -> crate::Result<()> {
477 let blob_field_names = Self::top_level_blob_field_names(fields);
478 if blob_field_names.is_empty() {
479 return Ok(());
480 }
481
482 let core_options = CoreOptions::new(options);
483 if !core_options.data_evolution_enabled() {
484 return Err(crate::Error::ConfigInvalid {
485 message: "Data evolution config must enabled for table with BLOB type column."
486 .to_string(),
487 });
488 }
489
490 if fields.len() == blob_field_names.len() {
491 return Err(crate::Error::ConfigInvalid {
492 message: "Table with BLOB type column must have other normal columns.".to_string(),
493 });
494 }
495
496 let partition_key_set: HashSet<&str> = partition_keys.iter().map(String::as_str).collect();
497 if blob_field_names
498 .iter()
499 .any(|name| partition_key_set.contains(name))
500 {
501 return Err(crate::Error::ConfigInvalid {
502 message: "The BLOB type column can not be part of partition keys.".to_string(),
503 });
504 }
505
506 Ok(())
507 }
508
509 /// Returns top-level Blob field names for create-time Blob contract checks.
510 fn top_level_blob_field_names(fields: &[DataField]) -> Vec<&str> {

Callers

nothing calls this directly

Calls 5

containsMethod · 0.80
is_emptyMethod · 0.45
lenMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected