Github user ueshin commented on a diff in the pull request:
https://github.com/apache/spark/pull/21370#discussion_r192209239
--- Diff: python/pyspark/sql/dataframe.py ---
@@ -351,8 +352,62 @@ def show(self, n=20, truncate=True, vertical=False):
else:
print(self._jdf.showString(n, int(truncate), vertical))
+ def _get_repl_config(self):
+ """Return the configs for eager evaluation each time when __repr__
or
+ _repr_html_ called by user or notebook.
+ """
+ eager_eval = self.sql_ctx.getConf(
+ "spark.sql.repl.eagerEval.enabled", "false").lower() == "true"
+ console_row = int(self.sql_ctx.getConf(
+ "spark.sql.repl.eagerEval.maxNumRows", u"20"))
+ console_truncate = int(self.sql_ctx.getConf(
+ "spark.sql.repl.eagerEval.truncate", u"20"))
+ return (eager_eval, console_row, console_truncate)
+
def __repr__(self):
- return "DataFrame[%s]" % (", ".join("%s: %s" % c for c in
self.dtypes))
+ (eager_eval, console_row, console_truncate) =
self._get_repl_config()
+ if not self._support_repr_html and eager_eval:
--- End diff --
I see, thanks.
I thinks it's okay, but I'm just curious why you want to restrict it?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]