Skip to content

Retain enumeration properties when using to_rows on columnar data#14

Merged
jonatanklosko merged 3 commits intomainfrom
jk-zipper
Jun 28, 2022
Merged

Retain enumeration properties when using to_rows on columnar data#14
jonatanklosko merged 3 commits intomainfrom
jk-zipper

Conversation

@jonatanklosko
Copy link
Copy Markdown
Contributor

Closes #10.

Comment thread lib/table/zipper.ex

def count(zipper) do
zipper.enumerables
|> Enum.reduce_while(:infinity, fn enumerable, min_count ->
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it is actually fair of us to assume that all columns have the same size and therefore call {:ok, Enum.count(...)} on a single column.

Copy link
Copy Markdown
Contributor Author

@jonatanklosko jonatanklosko Jun 28, 2022

Choose a reason for hiding this comment

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

We actually don't check enumerables length in something like data = %{x: [1, 2, 3, 4], y: [1, 2, 3]}, so I'd rather check all counts. Generally we can expect series to be of the same type, so if we can get count for one, we should be able to get for the others as well. I also like that this is in line with Enum/Stream zip behaviour :)

@jonatanklosko jonatanklosko merged commit f862163 into main Jun 28, 2022
@jonatanklosko jonatanklosko deleted the jk-zipper branch June 28, 2022 18:29
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.

Retain enumeration properties when using to_rows on columnar data

2 participants