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

Please make the MapBuilder values_field nullable a configurable value #2119

Closed
alanhe opened this issue Jul 21, 2022 · 1 comment · Fixed by #5483
Closed

Please make the MapBuilder values_field nullable a configurable value #2119

alanhe opened this issue Jul 21, 2022 · 1 comment · Fixed by #5483
Labels
enhancement Any new improvement worthy of a entry in the changelog good first issue Good for newcomers help wanted

Comments

@alanhe
Copy link

alanhe commented Jul 21, 2022

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
With MapBuilder, it's not possible to build the sample schema described in the spec: https://github.com/apache/parquet-format/blob/master/LogicalTypes.md#backward-compatibility-rules-1

optional group my_map (MAP) {
  repeated group map {
    required binary str (UTF8);
    required int32 num;
  }
}

because in Line 141, nullable is hard-coded to true.

let values_field = Field::new(
self.field_names.value.as_str(),
values_arr.data_type().clone(),
true,
);

So, it will also be optional int32 num.

Describe the solution you'd like
Can we make it configurable?

@alanhe alanhe added the enhancement Any new improvement worthy of a entry in the changelog label Jul 21, 2022
@Weijun-H
Copy link
Member

Weijun-H commented Feb 26, 2023

After reviewing the code, it appears that the bug has been resolved.

// // Map<String, Integer> (nullable map, non-null values)
// optional group my_map (MAP) {
// repeated group map {
// required binary str (UTF8);
// required int32 num;
// }
// }
{
arrow_fields.push(Field::new(
"my_map2",
DataType::Map(
Box::new(Field::new(
"map",
DataType::Struct(vec![
Field::new("str", DataType::Utf8, false),
Field::new("num", DataType::Int32, false),
]),
false, // (#1697)
)),
false,
),
true,
));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Any new improvement worthy of a entry in the changelog good first issue Good for newcomers help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants