Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arrow to iceberg schema conversion does not preserve names #1039

Open
1 task done
feniljain opened this issue Mar 3, 2025 · 0 comments
Open
1 task done

Arrow to iceberg schema conversion does not preserve names #1039

feniljain opened this issue Mar 3, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@feniljain
Copy link
Contributor

feniljain commented Mar 3, 2025

Apache Iceberg Rust version

0.4.0 (latest version)

Describe the bug

I was trying to debug a failing test I wrote for nan value count PR, and realized name of primitive column inside list arrow type is changed and test was failing due to this reason. On further debugging, realized we use "element" constant name here.

Same seems to be the case for map type too:

One doubt I have is it worth fixing? Is it okay to write tests with hardcoded names? Can it break anything for external consumers?

To Reproduce

Test to reproduce:

file: arrow/schema.rs

test:

    #[test]
    fn test_arrow_schema_to_schema_list() {
        let schema_list_float_field = Field::new("col1", DataType::Float32, true).with_metadata(
            HashMap::from([(PARQUET_FIELD_ID_META_KEY.to_string(), "1".to_string())]),
        );

        let arrow_schema = {
            let fields = vec![Field::new_list(
                "col0",
                schema_list_float_field.clone(),
                true,
            )
            .with_metadata(HashMap::from([(
                PARQUET_FIELD_ID_META_KEY.to_string(),
                "0".to_string(),
            )]))];
            Arc::new(arrow_schema::Schema::new(fields))
        };

        let converted_schema = arrow_schema_to_schema(&arrow_schema).expect("Could not convert to iceberg schema");

        assert_eq!(converted_schema.field_by_id(1).unwrap().name, String::from("col1"));
    }

Expected behavior

Above test should pass :)

Willingness to contribute

  • I can contribute a fix for this bug independently
@feniljain feniljain added the bug Something isn't working label Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant