当前位置:网站首页>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
}
}
边栏推荐
猜你喜欢
Mongodb learn from simple to deep
Nebula Importer 数据导入实践
How to test CIS chip?
About cv2 dnn. Readnetfromonnx (path) reports error during processing node with 3 inputs and 1 outputs [exclusive release]
如何满足医疗设备对安全性和保密性的双重需求?
如何满足医疗设备对安全性和保密性的双重需求?
Nebula importer data import practice
H3C S7000/S7500E/10500系列堆叠后BFD检测配置方法
Force buckle 599 Minimum index sum of two lists
【论文阅读】MAPS: Multi-agent Reinforcement Learning-based Portfolio Management System
随机推荐
Traversal of Oracle stored procedures
目前股票开户安全吗?可以直接网上开户吗。
【奖励公示】第22期 2022年6月奖励名单公示:社区明星评选 | 新人奖 | 博客同步 | 推荐奖
测量楼的高度
Graduation season | regretful and lucky graduation season
理财产品要怎么选?新手还什么都不懂
【mysql篇-基础篇】事务
AIRIOT助力城市管廊工程,智慧物联守护城市生命线
搞定带WebKitFormBoundary post登录
Don't fall behind! Simple and easy-to-use low code development to quickly build an intelligent management information system
[award publicity] issue 22 publicity of the award list in June 2022: Community star selection | Newcomer Award | blog synchronization | recommendation Award
I wrote a markdown command line gadget, hoping to improve the efficiency of sending documents by garden friends!
Network principle (1) - overview of basic principles
Force buckle 2319 Judge whether the matrix is an X matrix
微服务远程Debug,Nocalhost + Rainbond微服务开发第二弹
静态测试工具
[auto.js] automatic script
Cuda版本不一致,编译apex报错
不落人后!简单好用的低代码开发,快速搭建智慧管理信息系统
kubernetes之创建mysql8