当前位置:网站首页>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
}
}
边栏推荐
- 微服务远程Debug,Nocalhost + Rainbond微服务开发第二弹
- 华为CE交换机下载文件FTP步骤
- Splicing and splitting of integer ints
- 机械臂速成小指南(十一):坐标系的标准命名
- Mongodb learn from simple to deep
- With st7008, the Bluetooth test is completely grasped
- Is it safe to open a stock account at present? Can I open an account online directly.
- 凌云出海记 | 赛盒&华为云:共助跨境电商行业可持续发展
- 深度学习模型压缩与加速技术(七):混合方式
- Helix QAC 2020.2新版静态测试工具,最大限度扩展了标准合规性的覆盖范围
猜你喜欢
最新版本的CodeSonar改进了功能安全性,支持MISRA,C ++解析和可视化
The boundary of Bi: what is bi not suitable for? Master data, Martech? How to expand?
Nebula Importer 数据导入实践
Opencv学习笔记 高动态范围 (HDR) 成像
php 获取图片信息的方法
使用高斯Redis实现二级索引
上海交大最新《标签高效深度分割》研究进展综述,全面阐述无监督、粗监督、不完全监督和噪声监督的深度分割方法
Micro service remote debug, nocalhost + rainbow micro service development second bullet
Data island is the first danger encountered by enterprises in their digital transformation
微服务远程Debug,Nocalhost + Rainbond微服务开发第二弹
随机推荐
Traversal of Oracle stored procedures
Solve the problem of incomplete display around LCD display of rk3128 projector
Force buckle 599 Minimum index sum of two lists
《数字图像处理原理与实践(MATLAB版)》一书之代码Part2[通俗易懂]
解决/bin/sh进去的容器运行可执行文件报not found的问题
目前股票开户安全吗?可以直接网上开户吗。
Chapter 20 using work queue manager (3)
Cuda版本不一致,编译apex报错
【解决】package ‘xxxx‘ is not in GOROOT
Measure the height of the building
How C language determines whether it is a 32-bit system or a 64 bit system
静态测试工具
有用的win11小技巧
Vulnhub tre1
ASP. Net learning & ASP's one word
VMWare中虚拟机网络配置
Read PG in data warehouse in one article_ stat
恢复持久卷上的备份数据
One click deployment of any version of redis
MRS离线数据分析:通过Flink作业处理OBS数据