Skip to content

[hail] Showing a negative number prints the whole table.#6226

Merged
danking merged 3 commits intohail-is:masterfrom
tpoterba:show-negative
Jun 7, 2019
Merged

[hail] Showing a negative number prints the whole table.#6226
danking merged 3 commits intohail-is:masterfrom
tpoterba:show-negative

Conversation

@tpoterba
Copy link
Contributor

We had these semantics in our interface in the past, which was
lost in the Python reimplementation.

Fixes #6122

We had these semantics in our interface in the past, which was
lost in the Python reimplementation.

Fixes hail-is#6122
else:
rows = formatted_t.take(n + 1)
has_more = len(rows) > n
rows = rows[:n]
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you put these in a helper that returns (rows, has_more)?

@tpoterba
Copy link
Contributor Author

tpoterba commented Jun 5, 2019

reassigned to @jigold since Daniel is out

jigold
jigold previously requested changes Jun 5, 2019

def _take_n(self, n):
if n < 0:
rows = self.collect()
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 of a negative number as the equivalent of tail. Since you're collecting all of the data anyways, i think you can implement this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we had these semantics before show() was rewritten in Python -- I'm reticent to change them now. I also don't want to implement showing the tail as collecting all the data -- people would try to use it and immediately run OOM.

I'm OK supporting a tail=True parameter on show() in the future, but we need to write an implementation that doesn't require localizing all the data.

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case, can we add something to the docs that states what a negative argument does?

@danking danking merged commit a304358 into hail-is:master Jun 7, 2019
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.

Table.show(-1) throws an error instead of showing everything

4 participants