spark bug记录

一篇好博客https://blog.csdn.net/xwc35047/article/details/53933265

找不到hive表:
报错:org.apache.spark.sql.AnalysisException: Table or view not found
解决方法:在spark配置中加入hive-site.xml的路径
–files ${HIVE_SITE_PATH}
spark要查找hive中的数据,需要这个配置文件,里面是hive的一些信息。

spark作业jar包冲突:
可以在submit-spark时使用如下配置:
–conf spark.yarn.user.classpath.first=“true”

–jars xxxxxxx,xxxxxxx

这个设置是优先使用用户提交的jar,在遇到冲突时默认先使用用户提交的jar包,这样就可以屏蔽公共jar包了。(尤其适合公司使用)

spark dataframe存储数据:

spark.sql(sql4).coalesce(coalesce.toInt)
.write
.mode(SaveMode.Overwrite)
.option(“orc.compress”, “zlib”)
.orc(output)

存储数据时文件夹已存在:
报错:User class threw exception: org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory s3://xxxx/xxxx/test_mydata1 already exists

解决方法:
import java.net.URI
import org.apache.hadoop.fs.{FileSystem, Path}

FileSystem.get(new URI(s"s3://mob-emr-test"), spark.sparkContext.hadoopConfiguration).delete(new Path(output), true)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值