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

Map access for expressions #352

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

Conversation

hntd187
Copy link
Collaborator

@hntd187 hntd187 commented Sep 23, 2024

These support general map access, access of specific keys and binary expression against maps. These expressions have some null semantics which need to be discussed and agreed upon.

I removed the HashMap<_, Option<String>> on partition values since Nick had already done something for it. This is a draft for now I'll add more context for discussion.

Copy link

codecov bot commented Sep 23, 2024

Codecov Report

Attention: Patch coverage is 71.91011% with 50 lines in your changes missing coverage. Please review.

Project coverage is 74.68%. Comparing base (da206ed) to head (fcad16f).

Files with missing lines Patch % Lines
kernel/src/engine/arrow_expression.rs 75.31% 14 Missing and 25 partials ⚠️
kernel/src/expressions/mod.rs 37.50% 10 Missing ⚠️
kernel/src/engine/arrow_data.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #352      +/-   ##
==========================================
- Coverage   74.71%   74.68%   -0.03%     
==========================================
  Files          43       43              
  Lines        8361     8525     +164     
  Branches     8361     8525     +164     
==========================================
+ Hits         6247     6367     +120     
- Misses       1727     1746      +19     
- Partials      387      412      +25     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

}

fn nullable() -> bool {
V::nullable()
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't look right? The nullability of a list (or map) should be independent of whether the list elements (mapped values) are nullable? ie Option<Vec<T>> and Vec<Option<T>> (or Option<HashMap> and HashMap<K, Option<V>>) should be orthogonal?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I ended up removing this based on Nick's feedback

kernel/src/engine/arrow_expression.rs Outdated Show resolved Hide resolved
let values = map_struct.column(1).as_string::<i32>();
for (key, value) in keys.iter().zip(values.iter()) {
if let (Some(key), value) = (key, value) {
ret.insert(key.into(), value.map(Into::into));
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like this is the only line that differs between the two methods; is there a way to factor it out with a lambda arg to capture the value transformation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was also removed because it wasn't necessary and partitionValues when back to being HashMap<String, String>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants