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

fix: set map entries/key to non-nullable #107

Merged
merged 5 commits into from
Feb 14, 2023

Conversation

lidavidm
Copy link
Member

Fixes #106.

@codecov-commenter
Copy link

codecov-commenter commented Feb 13, 2023

Codecov Report

Merging #107 (1bb8e2d) into main (5771e5e) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #107      +/-   ##
==========================================
+ Coverage   92.88%   92.91%   +0.03%     
==========================================
  Files           7        7              
  Lines        1644     1652       +8     
  Branches       52       52              
==========================================
+ Hits         1527     1535       +8     
  Misses         84       84              
  Partials       33       33              
Impacted Files Coverage Δ
src/nanoarrow/schema.c 93.70% <100.00%> (+0.05%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@lidavidm
Copy link
Member Author

Hmm, seems na_map in R does trip the new validation

@lidavidm
Copy link
Member Author

Not sure if this is the right way to fix the R issue - maybe we should copy the key type and set it to non-nullable in na_map?

Copy link
Member

@paleolimbot paleolimbot 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!

The R change is the best way to solve that right now...those "type" constructors are somewhere between a field and a type and the change you made seems the safest for now.

Comment on lines 142 to 147
ASSERT_STREQ("entries", schema.children[0]->name);
ASSERT_STREQ("key", schema.children[0]->children[0]->name);
ASSERT_STREQ("value", schema.children[0]->children[1]->name);

ASSERT_FALSE(schema.children[0]->flags & ARROW_FLAG_NULLABLE);
ASSERT_FALSE(schema.children[0]->children[0]->flags & ARROW_FLAG_NULLABLE);
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason why these are ASSERTs and not EXPECTs? The other expectations I've written also use XXX(actual, expected) (but I never looked up which was correct or if there is a correct way to do it...that's just how R's testing works).

Copy link
Member Author

Choose a reason for hiding this comment

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

ah, no particular reason other than habit.

IIRC, in Googletest:

  • Assert aborts the test if it fails, Expect lets it continue
  • Googletest goes expected, actual

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, though the actual docs don't list this - they just use val1, val2. I'll look at it tomorrow

Copy link
Member Author

Choose a reason for hiding this comment

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

Made them consistent with the surrounding code.

@paleolimbot paleolimbot merged commit ad56a6d into apache:main Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[C] SchemaSetType(MAP) should set entries/keys as non-nullable
3 participants