Function partition_field

Source
pub fn partition_field(partition_fields: Vec<NestedFieldRef>) -> NestedFieldRef
Expand description

Creates the Iceberg field definition for the _partition metadata column.

The _partition field is a struct whose fields depend on the partition spec. This function creates the field dynamically with the provided partition fields.

§Arguments

  • partition_fields - The fields that make up the partition struct

§Returns

A new _partition field definition as an Iceberg NestedField

§Example

use std::sync::Arc;

use iceberg::metadata_columns::partition_field;
use iceberg::spec::{NestedField, PrimitiveType, Type};

let fields = vec![
    Arc::new(NestedField::required(
        1,
        "year",
        Type::Primitive(PrimitiveType::Int),
    )),
    Arc::new(NestedField::required(
        2,
        "month",
        Type::Primitive(PrimitiveType::Int),
    )),
];
let partition_field = partition_field(fields);