From 0a47f6472d1724df88f13a1663e44a0b34983e61 Mon Sep 17 00:00:00 2001 From: rakesh-tmdc <105636602+rakesh-tmdc@users.noreply.github.com> Date: Tue, 8 Oct 2024 06:42:34 +0530 Subject: [PATCH] fix: iceberg metadata comp codec (#143) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * FIX: iceberg meta data compression coded supppor * FIX: iceberg meta data compression coded supppor * FIX: added skip_schema_inference for iceberg * Lint Signed-off-by: Philippe Noël <21990816+philippemnoel@users.noreply.github.com> * Update iceberg.rs Signed-off-by: Philippe Noël <21990816+philippemnoel@users.noreply.github.com> --------- Signed-off-by: Philippe Noël <21990816+philippemnoel@users.noreply.github.com> Co-authored-by: Philippe Noël <21990816+philippemnoel@users.noreply.github.com> --- src/duckdb/iceberg.rs | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/duckdb/iceberg.rs b/src/duckdb/iceberg.rs index 75d1d620..a803ae56 100644 --- a/src/duckdb/iceberg.rs +++ b/src/duckdb/iceberg.rs @@ -25,6 +25,8 @@ use crate::fdw::base::OptionValidator; #[strum(serialize_all = "snake_case")] pub enum IcebergOption { AllowMovedPaths, + MetadataCompressionCodec, + SkipSchemaInference, Files, PreserveCasing, Select, @@ -34,6 +36,8 @@ impl OptionValidator for IcebergOption { fn is_required(&self) -> bool { match self { Self::AllowMovedPaths => false, + Self::MetadataCompressionCodec => false, + Self::SkipSchemaInference => false, Self::Files => true, Self::PreserveCasing => false, Self::Select => false, @@ -57,11 +61,24 @@ pub fn create_view( .get(IcebergOption::AllowMovedPaths.as_ref()) .map(|option| format!("allow_moved_paths = {option}")); - let create_iceberg_str = [files, allow_moved_paths] - .into_iter() - .flatten() - .collect::>() - .join(", "); + let metadata_compression_codec = table_options + .get(IcebergOption::MetadataCompressionCodec.as_ref()) + .map(|option| format!("metadata_compression_codec = '{option}'")); + + let skip_schema_inference = table_options + .get(IcebergOption::SkipSchemaInference.as_ref()) + .map(|option| format!("skip_schema_inference = {option}")); + + let create_iceberg_str = [ + files, + allow_moved_paths, + metadata_compression_codec, + skip_schema_inference, + ] + .into_iter() + .flatten() + .collect::>() + .join(", "); let default_select = "*".to_string(); let select = table_options