一、准备工作
1.1 下载地址
https://github.com/apache/hive
https://dlcdn.apache.org/hive/
版本:2.3.9
1.2 环境依赖
hadoop2.x
mysql
maven
java8
1.3 Idea插件
需要在idea中搜索安装ANTLR插件
二、本地编译运行
2.1 编译
mvn clean package -DskipTests -Pdist
2.2 配置hive,前提是其他环境已经配置好
参考安装hive博客
2.3 hive配置客户端debug模式
bin/hive --debug -hiveconf hive.root.logger=DEBUG,console
当开启debug模式时,JVM会监听8000端口,等待客户端调试连接,我们需要在IDE配置debug的远程端口连接上去。
2.4 开启调试
IntelliJ -> Open -> pom.xml of hive source -> Run -> Debug… -> Edit Configurations… -> + -> Remote
当我们配置好Name、Host、Port后,点击debug,则此时会连接localhost的8000端口,真正开启 hive cli,对应的源码入口是 org.apache.hadoop.hive.cli.CliDriver#main,待hive cli启动成功后,可以输入hql进行代码调试了。
其它:
参考文献
hive本地环境搭建:https://qingzhongli.com/hive-source-read-local-env-setup/
Idea安装antlr插件: https://cloud.tencent.com/developer/article/1556983
转载: