Skip to content
20 changes: 20 additions & 0 deletions crates/iceberg/public-api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2762,9 +2762,13 @@ pub iceberg::spec::TableProperties::max_ref_age_ms: i64
pub iceberg::spec::TableProperties::max_snapshot_age_ms: i64
pub iceberg::spec::TableProperties::metadata_compression_codec: iceberg::compression::CompressionCodec
pub iceberg::spec::TableProperties::min_snapshots_to_keep: usize
pub iceberg::spec::TableProperties::write_data_location: core::option::Option<alloc::string::String>
pub iceberg::spec::TableProperties::write_datafusion_fanout_enabled: bool
pub iceberg::spec::TableProperties::write_folder_storage_location: core::option::Option<alloc::string::String>
pub iceberg::spec::TableProperties::write_format_default: alloc::string::String
pub iceberg::spec::TableProperties::write_metadata_path: core::option::Option<alloc::string::String>
pub iceberg::spec::TableProperties::write_object_storage_location: core::option::Option<alloc::string::String>
pub iceberg::spec::TableProperties::write_object_storage_partitioned_paths: core::option::Option<alloc::string::String>
pub iceberg::spec::TableProperties::write_target_file_size_bytes: usize
impl iceberg::spec::TableProperties
pub const iceberg::spec::TableProperties::PROPERTY_COMMIT_MAX_RETRY_WAIT_MS: &str
Expand Down Expand Up @@ -2812,7 +2816,12 @@ pub const iceberg::spec::TableProperties::PROPERTY_PARQUET_CDC_NORM_LEVEL: &str
pub const iceberg::spec::TableProperties::PROPERTY_PARQUET_CDC_NORM_LEVEL_DEFAULT: i32
pub const iceberg::spec::TableProperties::PROPERTY_SNAPSHOT_COUNT: &str
pub const iceberg::spec::TableProperties::PROPERTY_UUID: &str
pub const iceberg::spec::TableProperties::PROPERTY_WRITE_DATA_LOCATION: &str
pub const iceberg::spec::TableProperties::PROPERTY_WRITE_FOLDER_STORAGE_LOCATION: &str
pub const iceberg::spec::TableProperties::PROPERTY_WRITE_METADATA_PATH: &str
pub const iceberg::spec::TableProperties::PROPERTY_WRITE_OBJECT_STORAGE_LOCATION: &str
pub const iceberg::spec::TableProperties::PROPERTY_WRITE_OBJECT_STORAGE_PARTITIONED_PATHS: &str
pub const iceberg::spec::TableProperties::PROPERTY_WRITE_OBJECT_STORAGE_PARTITIONED_PATHS_DEFAULT: bool
pub const iceberg::spec::TableProperties::PROPERTY_WRITE_PARTITION_SUMMARY_LIMIT: &str
pub const iceberg::spec::TableProperties::PROPERTY_WRITE_PARTITION_SUMMARY_LIMIT_DEFAULT: u64
pub const iceberg::spec::TableProperties::PROPERTY_WRITE_TARGET_FILE_SIZE_BYTES: &str
Expand Down Expand Up @@ -3245,6 +3254,15 @@ impl core::fmt::Debug for iceberg::writer::file_writer::location_generator::Defa
pub fn iceberg::writer::file_writer::location_generator::DefaultLocationGenerator::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
impl iceberg::writer::file_writer::location_generator::LocationGenerator for iceberg::writer::file_writer::location_generator::DefaultLocationGenerator
pub fn iceberg::writer::file_writer::location_generator::DefaultLocationGenerator::generate_location(&self, partition_key: core::option::Option<&iceberg::spec::PartitionKey>, file_name: &str) -> alloc::string::String
pub struct iceberg::writer::file_writer::location_generator::ObjectStorageLocationGenerator
impl iceberg::writer::file_writer::location_generator::ObjectStorageLocationGenerator
pub fn iceberg::writer::file_writer::location_generator::ObjectStorageLocationGenerator::new(table_metadata: &iceberg::spec::TableMetadata) -> iceberg::Result<Self>
impl core::clone::Clone for iceberg::writer::file_writer::location_generator::ObjectStorageLocationGenerator
pub fn iceberg::writer::file_writer::location_generator::ObjectStorageLocationGenerator::clone(&self) -> iceberg::writer::file_writer::location_generator::ObjectStorageLocationGenerator
impl core::fmt::Debug for iceberg::writer::file_writer::location_generator::ObjectStorageLocationGenerator
pub fn iceberg::writer::file_writer::location_generator::ObjectStorageLocationGenerator::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
impl iceberg::writer::file_writer::location_generator::LocationGenerator for iceberg::writer::file_writer::location_generator::ObjectStorageLocationGenerator
pub fn iceberg::writer::file_writer::location_generator::ObjectStorageLocationGenerator::generate_location(&self, partition_key: core::option::Option<&iceberg::spec::PartitionKey>, file_name: &str) -> alloc::string::String
pub trait iceberg::writer::file_writer::location_generator::FileNameGenerator: core::clone::Clone + core::marker::Send + core::marker::Sync + 'static
pub fn iceberg::writer::file_writer::location_generator::FileNameGenerator::generate_file_name(&self) -> alloc::string::String
impl iceberg::writer::file_writer::location_generator::FileNameGenerator for iceberg::writer::file_writer::location_generator::DefaultFileNameGenerator
Expand All @@ -3253,6 +3271,8 @@ pub trait iceberg::writer::file_writer::location_generator::LocationGenerator: c
pub fn iceberg::writer::file_writer::location_generator::LocationGenerator::generate_location(&self, partition_key: core::option::Option<&iceberg::spec::PartitionKey>, file_name: &str) -> alloc::string::String
impl iceberg::writer::file_writer::location_generator::LocationGenerator for iceberg::writer::file_writer::location_generator::DefaultLocationGenerator
pub fn iceberg::writer::file_writer::location_generator::DefaultLocationGenerator::generate_location(&self, partition_key: core::option::Option<&iceberg::spec::PartitionKey>, file_name: &str) -> alloc::string::String
impl iceberg::writer::file_writer::location_generator::LocationGenerator for iceberg::writer::file_writer::location_generator::ObjectStorageLocationGenerator
pub fn iceberg::writer::file_writer::location_generator::ObjectStorageLocationGenerator::generate_location(&self, partition_key: core::option::Option<&iceberg::spec::PartitionKey>, file_name: &str) -> alloc::string::String
pub mod iceberg::writer::file_writer::rolling_writer
pub struct iceberg::writer::file_writer::rolling_writer::RollingFileWriter<B: iceberg::writer::file_writer::FileWriterBuilder, L: iceberg::writer::file_writer::location_generator::LocationGenerator, F: iceberg::writer::file_writer::location_generator::FileNameGenerator>
impl<B, L, F> iceberg::writer::file_writer::rolling_writer::RollingFileWriter<B, L, F> where B: iceberg::writer::file_writer::FileWriterBuilder, L: iceberg::writer::file_writer::location_generator::LocationGenerator, F: iceberg::writer::file_writer::location_generator::FileNameGenerator
Expand Down
44 changes: 32 additions & 12 deletions crates/iceberg/src/spec/table_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use std::str::FromStr;

use crate::compression::CompressionCodec;
use crate::error::{Error, ErrorKind, Result};
use crate::util::location::strip_trailing_slash;

fn parse_property<T: FromStr>(
properties: &HashMap<String, String>,
Expand All @@ -40,18 +41,6 @@ where
})
}

/// Strips trailing slashes from a location, preserving a bare URI scheme root
fn strip_trailing_slash(path: &str) -> &str {
let mut path = path;
while !path.ends_with("://") {
let Some(stripped) = path.strip_suffix('/') else {
break;
};
path = stripped;
}
path
}

fn parse_location_property(
properties: &HashMap<String, String>,
key: &str,
Expand Down Expand Up @@ -173,6 +162,14 @@ pub struct TableProperties {
pub encryption_key_id: Option<String>,
/// The encryption data encryption key length in bytes.
pub encryption_data_key_length: usize,
/// Base directory for data files
pub write_data_location: Option<String>,
/// Deprecated and will be removed in Iceberg Java, use [write_data_location] instead.
pub write_folder_storage_location: Option<String>,
/// Deprecated object storage path property, kept as a fallback for compatibility,
pub write_object_storage_location: Option<String>,
/// Whether partition values are included in object storage paths.
pub write_object_storage_partitioned_paths: Option<String>,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be Option<bool>?

}

impl TableProperties {
Expand Down Expand Up @@ -325,6 +322,17 @@ impl TableProperties {
pub const PROPERTY_ENCRYPTION_DATA_KEY_LENGTH: &str = "encryption.data-key-length";
/// Default value for the encryption DEK length (16 bytes = AES-128).
pub const PROPERTY_ENCRYPTION_DATA_KEY_LENGTH_DEFAULT: usize = 16;
/// Property key for the base directory for data files
pub const PROPERTY_WRITE_DATA_LOCATION: &str = "write.data.path";
/// Property key for deprecated [write_folder_storage_location]
pub const PROPERTY_WRITE_FOLDER_STORAGE_LOCATION: &str = "write.folder-storage.path";
/// Property key for deprecated object storage path, kept as a fallback for compatibility.
pub const PROPERTY_WRITE_OBJECT_STORAGE_LOCATION: &str = "write.object-storage.path";
/// Property key for controlling whether partition values are included in object storage paths.
pub const PROPERTY_WRITE_OBJECT_STORAGE_PARTITIONED_PATHS: &str =
"write.object-storage.partitioned-paths";
/// Default value for [PROPERTY_WRITE_OBJECT_STORAGE_PARTITIONED_PATHS]
pub const PROPERTY_WRITE_OBJECT_STORAGE_PARTITIONED_PATHS_DEFAULT: bool = true;
}

impl TryFrom<&HashMap<String, String>> for TableProperties {
Expand Down Expand Up @@ -421,6 +429,18 @@ impl TryFrom<&HashMap<String, String>> for TableProperties {
TableProperties::PROPERTY_ENCRYPTION_DATA_KEY_LENGTH,
TableProperties::PROPERTY_ENCRYPTION_DATA_KEY_LENGTH_DEFAULT,
)?,
write_data_location: props
.get(TableProperties::PROPERTY_WRITE_DATA_LOCATION)
.cloned(),
write_folder_storage_location: props
.get(TableProperties::PROPERTY_WRITE_FOLDER_STORAGE_LOCATION)
.cloned(),
write_object_storage_location: props
.get(TableProperties::PROPERTY_WRITE_OBJECT_STORAGE_LOCATION)
.cloned(),
write_object_storage_partitioned_paths: props
.get(TableProperties::PROPERTY_WRITE_OBJECT_STORAGE_PARTITIONED_PATHS)
.cloned(),
})
}
}
Expand Down
28 changes: 28 additions & 0 deletions crates/iceberg/src/util/location.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

/// Strips trailing slashes from a location, preserving a bare URI scheme root
pub(crate) fn strip_trailing_slash(path: &str) -> &str {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a unit test in table_properties.rs for this function, could you move that here as well?

let mut path = path;
while !path.ends_with("://") {
let Some(stripped) = path.strip_suffix('/') else {
break;
};
path = stripped;
}
path
}
1 change: 1 addition & 0 deletions crates/iceberg/src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

use std::num::NonZeroUsize;

pub(crate) mod location;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be pub?

/// Utilities for working with snapshots.
pub mod snapshot;

Expand Down
Loading
Loading