0 votes
1 view
in Big Data Hadoop & Spark by (11.5k points)
I have a Spark DataFrame query that is guaranteed to return single column with single Int value. What is the best way to extract this value as Int from the resulting DataFrame?

1 Answer

0 votes
by (31.4k points)

I will suggest you to use head()

df.head().getInt(0)

You can also use first()

df.first().getInt(0)

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...