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

Add map to ScalarValue::try_from as a list #8488

Closed
wants to merge 1 commit into from

Conversation

razeghi71
Copy link
Contributor

Which issue does this PR close?

Closes #8262

Rationale for this change

To fix the problem mentioned in the issue linked.

What changes are included in this PR?

ScalarValue::try_from didn't have an implementation for map. So I added it. As described in the description of DataType::Map:

/// A Map is a logical nested type that is represented as
///
/// `List<entries: Struct<key: K, value: V>>`

So I've returned a list of empty list with the same map schema.

Are these changes tested?

I wrote a test for it. But not sure if is enough

Are there any user-facing changes?

No

@alamb
Copy link
Contributor

alamb commented Dec 12, 2023

Thanks @razeghi71 -- I will review this shortly

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you for this PR @razeghi71 -- I think there may be a better way as I explained on some of the comments

@@ -2872,6 +2872,14 @@ impl TryFrom<&DataType> for ScalarValue {
))),
1,
)),
DataType::Map(field, _) => ScalarValue::List(new_null_array(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the data type needs to match the ScalarValue enum (e.g. we need to add DataType::Map to make this work properly). I'll keep the discussion going at #8262 (comment)

Copy link

Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale PR has not had any activity for some time label Apr 16, 2024
@razeghi71 razeghi71 closed this Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale PR has not had any activity for some time
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filter crashes when the input schema contains a map
2 participants