最近单位因为业务的需求需要直接在hive中读取数据 因此做了一些访问hive基本工程搭建,在搭建的过程中遇到了一些问题 通过一些资料查询还有源码的分析 将问题解决了。做个一个简单的笔记方便以后的回顾.
问题复现以及解决方案导入Hive的数据 执行select count(*) 的时候发现统计值给实际导入的数据量不一致
需要执行一下命令
analyze table dw_b_report_summary compute statistics
SpringBoot 整合hive-jdbc 出现如下错误:
解决方案如下:
排除hivejdbc中jetty的jar
org.apache.hive hive-jdbc3.1.0 org.eclipse.jetty jetty-runner
在使用jdbc连接hive进行访问的时候要在后面加上这个 hive.cli.print.header=true;hive.resultset.use.unique.column.names=false 否则会在查询的结果中带有表名称
例如 tablename.xxxx这样的字段
server.port=8081 spring.datasource.url=jdbc:hive2://node1:10000/default?hive.cli.print.header=true;hive.resultset.use.unique.column.names=false spring.datasource.driver-class-name=org.apache.hive.jdbc.HiveDriver spring.datasource.username= spring.datasource.password=
此外最近在研究hive3的相关内容 从基本操作到优化 整理了部分资料 有需要的小伙伴可以联系我 我会定亲更新相关文章 部分截图如下:



