当前位置:网站首页>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
}
}
边栏推荐
- 测量楼的高度
- Precautions for cjson memory leakage
- 嵌入式系统真正安全了吗?[ OneSpin如何为开发团队全面解决IC完整性问题 ]
- ASP.NET学习& asp‘s one word
- Micro service remote debug, nocalhost + rainbow micro service development second bullet
- 一文读懂数仓中的pg_stat
- 大厂经典指针笔试题
- About cv2 dnn. Readnetfromonnx (path) reports error during processing node with 3 inputs and 1 outputs [exclusive release]
- 4G设备接入EasyGBS平台出现流量消耗异常,是什么原因?
- Measure the height of the building
猜你喜欢

Apifox 接口一体化管理新神器

ISO 26262 - 基于需求测试以外的考虑因素

Jenkins 用户权限管理

Data island is the first danger encountered by enterprises in their digital transformation

不落人后!简单好用的低代码开发,快速搭建智慧管理信息系统
![[MySQL - Basic] transactions](/img/a4/52c4b156b107c1e2f0220b4379eab2.png)
[MySQL - Basic] transactions

Opencv learning notes high dynamic range (HDR) imaging

网络原理(1)——基础原理概述

Chapter 9 Yunji datacanvas company won the highest honor of the "fifth digital finance innovation competition"!

最新版本的CodeSonar改进了功能安全性,支持MISRA,C ++解析和可视化
随机推荐
使用 BR 备份 TiDB 集群数据到 Azure Blob Storage
How to test CIS chip?
测量楼的高度
[solution] package 'XXXX' is not in goroot
rk3128投影仪lcd显示四周显示不完整解决
如何满足医疗设备对安全性和保密性的双重需求?
Force buckle 599 Minimum index sum of two lists
Data island is the first danger encountered by enterprises in their digital transformation
Implement secondary index with Gaussian redis
Yolov6:yolov6+win10--- train your own dataset
写了个 Markdown 命令行小工具,希望能提高园友们发文的效率!
备份 TiDB 集群到持久卷
【解决】package ‘xxxx‘ is not in GOROOT
Flask1.1.4 Werkzeug1.0.1 源码分析:路由
MIT science and technology review article: AgI hype around Gato and other models may make people ignore the really important issues
Oracle 存儲過程之遍曆
MRS离线数据分析:通过Flink作业处理OBS数据
Force buckle 1037 Effective boomerang
如何在软件研发阶段落地安全实践
使用 BR 恢复 Azure Blob Storage 上的备份数据