Github user maropu commented on a diff in the pull request:
https://github.com/apache/spark/pull/20800#discussion_r175039379
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala ---
@@ -511,6 +511,14 @@ class Dataset[T] private[sql](
*/
def isLocal: Boolean = logicalPlan.isInstanceOf[LocalRelation]
+ /**
+ * Returns true if the `Dataset` is empty.
+ *
+ * @group basic
+ * @since 2.4.0
+ */
+ def isEmpty: Boolean = rdd.isEmpty()
--- End diff --
How about this?
```
def isEmpty: Boolean = withAction("isEmpty",
groupBy().count().queryExecution) { plan =>
plan.executeCollect().head.getLong(0) == 0
}
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]