Skip to content

Commit

Permalink
fix: iceberg metadata comp codec (#143)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* Update iceberg.rs

Signed-off-by: Philippe Noël <[email protected]>

---------

Signed-off-by: Philippe Noël <[email protected]>
Co-authored-by: Philippe Noël <[email protected]>
  • Loading branch information
rakesh-tmdc and philippemnoel authored Oct 8, 2024
1 parent e373c70 commit 0a47f64
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions src/duckdb/iceberg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ use crate::fdw::base::OptionValidator;
#[strum(serialize_all = "snake_case")]
pub enum IcebergOption {
AllowMovedPaths,
MetadataCompressionCodec,
SkipSchemaInference,
Files,
PreserveCasing,
Select,
Expand All @@ -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,
Expand All @@ -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::<Vec<String>>()
.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::<Vec<String>>()
.join(", ");

let default_select = "*".to_string();
let select = table_options
Expand Down

0 comments on commit 0a47f64

Please sign in to comment.