On Tue, Mar 7, 2017 at 2:37 PM, Nick Pentreath
wrote:
> df.take(1).isEmpty should work
My bad.
It will return empty array:
emptydf.take(1)
res0: Array[org.apache.spark.sql.Row] = Array()
and applying isEmpty would return boolean
emptydf.take(1).isEmpty
res2: Boolean = true
--
Thanks
Dee
I believe take on an empty dataset will return an empty Array rather than
throw an exception.
df.take(1).isEmpty should work
On Tue, 7 Mar 2017 at 07:42, Deepak Sharma wrote:
> If the df is empty , the .take would return
> java.util.NoSuchElementException.
> This can be done as below:
> df.rdd.
If the df is empty , the .take would return
java.util.NoSuchElementException.
This can be done as below:
df.rdd.isEmpty
On Tue, Mar 7, 2017 at 9:33 AM, wrote:
> Dataframe.take(1) is faster.
>
>
>
> *From:* ashaita...@nz.imshealth.com [mailto:ashaita...@nz.imshealth.com]
> *Sent:* Tuesday, March
...@accenture.com [mailto:jasbir.s...@accenture.com]
Sent: Tuesday, 7 March 2017 5:04 p.m.
To: Artem Shaitarov ; user@spark.apache.org
Subject: RE: Check if dataframe is empty
Dataframe.take(1) is faster.
From: ashaita...@nz.imshealth.com<mailto:ashaita...@nz.imshealth.com>
[mailto:a
Dataframe.take(1) is faster.
From: ashaita...@nz.imshealth.com [mailto:ashaita...@nz.imshealth.com]
Sent: Tuesday, March 07, 2017 9:22 AM
To: user@spark.apache.org
Subject: Check if dataframe is empty
Hello!
I am pretty sure that I am asking something which has been already asked lots
of times.