当前位置:网站首页>Spark judges that DF is empty
Spark judges that DF is empty
2022-07-07 20:23:00 【The south wind knows what I mean】
List of articles
Performance test of different schemes
I have the same question , And tested 3 There are three main solutions :
df!= null df.count> 0
df.head(1).isEmpty()
df.rdd.isEmpty
About need 9366ms
About need 5607 millisecond
About need 1921ms
Of course. 3 Species effective , But in terms of performance , This is the same in my machine in terms of execution time DF Found when executing these methods on
Update another method
/** * Judge DataFrame Is it empty * @param df DataFrame * @return true Said is empty or false It means not empty */
def isEmpty(df: DataFrame): Boolean ={
try{
df.head()
false
}catch {
case e: NoSuchElementException =>
println(e.getMessage)
true
}
}
边栏推荐
- About cv2 dnn. Readnetfromonnx (path) reports error during processing node with 3 inputs and 1 outputs [exclusive release]
- Force buckle 459 Duplicate substring
- 开发一个小程序商城需要多少钱?
- 写了个 Markdown 命令行小工具,希望能提高园友们发文的效率!
- Implement secondary index with Gaussian redis
- Data island is the first danger encountered by enterprises in their digital transformation
- 【解决】package ‘xxxx‘ is not in GOROOT
- Creation of kubernetes mysql8
- Force buckle 1232 Dotted line
- JNI 初级接触
猜你喜欢
How to test CIS chip?
一. 基础概念
微服务远程Debug,Nocalhost + Rainbond微服务开发第二弹
H3C S7000/S7500E/10500系列堆叠后BFD检测配置方法
ISO 26262 - 基于需求测试以外的考虑因素
CIS芯片测试到底怎么测?
使用camunda做工作流设计,驳回操作
写了个 Markdown 命令行小工具,希望能提高园友们发文的效率!
The boundary of Bi: what is bi not suitable for? Master data, Martech? How to expand?
Implement secondary index with Gaussian redis
随机推荐
Traversée des procédures stockées Oracle
Splicing and splitting of integer ints
Network principle (1) - overview of basic principles
一文读懂数仓中的pg_stat
Mongodb learn from simple to deep
微服务远程Debug,Nocalhost + Rainbond微服务开发第二弹
最新版本的CodeSonar改进了功能安全性,支持MISRA,C ++解析和可视化
写了个 Markdown 命令行小工具,希望能提高园友们发文的效率!
Vulnhub tre1
微服务远程Debug,Nocalhost + Rainbond微服务开发第二弹
CUDA versions are inconsistent, and errors are reported when compiling apex
Force buckle 2315 Statistical asterisk
One click deployment of any version of redis
Force buckle 674 Longest continuous increasing sequence
Read PG in data warehouse in one article_ stat
使用高斯Redis实现二级索引
CJSON内存泄漏的注意事项
Solve the problem of incomplete display around LCD display of rk3128 projector
【解决】package ‘xxxx‘ is not in GOROOT
【解决】package ‘xxxx‘ is not in GOROOT