-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-6007][SQL] Add numRows param in DataFrame.show() #4767
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -272,9 +272,9 @@ def isLocal(self): | |
| """ | ||
| return self._jdf.isLocal() | ||
|
|
||
| def show(self): | ||
| def show(self, n=20): | ||
| """ | ||
| Print the first 20 rows. | ||
| Print the first n rows. | ||
|
|
||
| >>> df | ||
| DataFrame[age: int, name: string] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. one more thing. can you add one more docstring test to test n = 1? |
||
|
|
@@ -283,7 +283,7 @@ def show(self): | |
| 2 Alice | ||
| 5 Bob | ||
| """ | ||
| print self._jdf.showString().encode('utf8', 'ignore') | ||
| print self._jdf.showString(n).encode('utf8', 'ignore') | ||
|
|
||
| def __repr__(self): | ||
| return "DataFrame[%s]" % (", ".join("%s: %s" % c for c in self.dtypes)) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -441,4 +441,9 @@ class DataFrameSuite extends QueryTest { | |
| checkAnswer(df.select(df("key")), testData.select('key).collect().toSeq) | ||
| } | ||
|
|
||
| ignore("show") { | ||
| // This test case is intended ignored, but to make sure it compiles correctly | ||
| testData.select($"*").show() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually this is a bad idea. it prints a lot of garbage to console. maybe we can ignore the test and add a comment saying this is ignored but we want to make sure it compiles correctly. do the same for java
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I realized it is not good, it's not checking any answer. I will modify it later |
||
| testData.select($"*").show(1000) | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there isn't n here. maybe rename numRows -> n