当前位置:网站首页>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
}
}
边栏推荐
猜你喜欢

Micro service remote debug, nocalhost + rainbow micro service development second bullet

Network principle (1) - overview of basic principles

CIS芯片测试到底怎么测?

AADL Inspector 故障树安全分析模块

Machine learning notes - explore object detection datasets using streamlit

Opencv learning notes high dynamic range (HDR) imaging

复杂因子计算优化案例:深度不平衡、买卖压力指标、波动率计算

使用camunda做工作流设计,驳回操作

整型int的拼接和拆分

微服务远程Debug,Nocalhost + Rainbond微服务开发第二弹
随机推荐
Cuda版本不一致,编译apex报错
VMWare中虚拟机网络配置
Apifox 接口一体化管理新神器
Vulnhub's funfox2
POJ 1742 Coins ( 单调队列解法 )「建议收藏」
大厂经典指针笔试题
一键部署Redis任意版本
Graduation season | regretful and lucky graduation season
Implement secondary index with Gaussian redis
使用高斯Redis实现二级索引
Try the tuiroom of Tencent cloud (there is an appointment in the evening, which will be continued...)
Mongodb由浅入深学习
Traversal of Oracle stored procedures
使用 BR 备份 TiDB 集群数据到 Azure Blob Storage
想杀死某个端口进程,但在服务列表中却找不到,可以之间通过命令行找到这个进程并杀死该进程,减少重启电脑和找到问题根源。
《数字图像处理原理与实践(MATLAB版)》一书之代码Part2[通俗易懂]
有用的win11小技巧
[award publicity] issue 22 publicity of the award list in June 2022: Community star selection | Newcomer Award | blog synchronization | recommendation Award
Jenkins 用户权限管理
华为CE交换机下载文件FTP步骤