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 insert enumerable #379

Merged
merged 2 commits into from
Aug 6, 2017
Merged

Conversation

baarkerlounger
Copy link
Contributor

@baarkerlounger baarkerlounger commented Aug 6, 2017

What if value assigned is Enumerable, but is not Array or Range? (Say, it is ActiveRecord::Relation.) What user expects is it would be converted to_a, and then inserted as a vector. What actually will happen, is pretty obscure error:

when Array, Range would be skipped;
in prepare_value_for_insert, there would be called Array(relation), which will do to_a (producing array of objects)... and then multiplied by DF size, producing vector much larger than expected.

Copy link
Collaborator

@zverok zverok left a comment

Choose a reason for hiding this comment

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

Let's add a small test for the new behavior? With, say, standard library's Set class.

Copy link
Collaborator

@zverok zverok left a comment

Choose a reason for hiding this comment

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

Thanks! 👍

@zverok zverok merged commit 7bc126b into SciRuby:master Aug 6, 2017
@baarkerlounger baarkerlounger deleted the fix_enumerable_insert branch August 6, 2017 18:25
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.

2 participants