当前位置:网站首页>Spark judges that DF is empty
Spark judges that DF is empty
2022-07-25 15:15: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
}
}
边栏推荐
- 【微信小程序】小程序宿主环境详解
- 从 join on 和 where 执行顺序认识T-sql查询执行顺序
- Vs2010添加wap移动窗体模板
- How much memory can a program use at most?
- Leo-sam: tightly coupled laser inertial odometer with smoothing and mapping
- Install entityframework method
- Es5 thinking of writing inheritance
- Bridge NF call ip6tables is an unknown key exception handling
- Image cropper example
- Scala110-combineByKey
猜你喜欢

Outline and box shadow to achieve the highlight effect of contour fillet

密码强度验证示例

Recommend 10 learning websites that can be called artifact

Spark 内存管理机制 新版

bridge-nf-call-ip6tables is an unknown key异常处理

oracle_12505错误解决方法

Docker上运行redis以配置文件方式启动,连接客户端报错Error: Server closed the connection

ESXI6.7.0 升级到7.0U3f(2022年7月12 更新)

Yarn: the file yarn.ps1 cannot be loaded because running scripts is prohibited on this system.

图片裁剪cropper 示例
随机推荐
Automatically set the template for VS2010 and add header comments
Idea远程提交spark任务到yarn集群
我的创作纪念日
Spark 判断DF为空
Raft of distributed consistency protocol
Object.prototype. Hasownproperty() and in
Spark SQL common time functions
Client error: invalid param endpoint is blank
System.AccessViolationException: 尝试读取或写入受保护的内存。这通常指示其他内存已损坏
sql to linq 之存储过程偏
Solve the error caused by too large file when uploading file by asp.net
Outline and box shadow to achieve the highlight effect of contour fillet
Deployment and simple use of PostgreSQL learning
pl/sql 创建并执行oralce存储过程,并返回结果集
MySql的安装配置超详细教程与简单的建库建表方法
瀑布流布局
Maxcompute SQL 的查询结果条数受限1W
Leetcode combination sum + pruning
记一次redis超时
System. Accessviolationexception: an attempt was made to read or write to protected memory. This usually indicates that other memory is corrupted