
hive
文章平均质量分 55
Joseph25
这个作者很懒,什么都没留下…
展开
-
hive执行sql报错:The value of property yarn.resourcemanager.zk-address must not be null
在yarn-site.xml中添加下面配置。原创 2025-01-17 11:35:44 · 90 阅读 · 0 评论 -
org.apache.hadoop.mapreduce.v2.app.client.MRClientService: Webapps failed to start. Ignoring for now
HA机制下yarn-site.xml需要加入以下配置。转载 2025-01-17 11:23:21 · 33 阅读 · 0 评论 -
Hive:Java Class类注册成udf函数
Java Class类注册成udf函数原创 2023-01-18 17:33:17 · 675 阅读 · 0 评论 -
Hive:Hive的安装
Hive安装原创 2022-09-04 16:05:57 · 315 阅读 · 0 评论 -
Hive: Task failed task_ Job failed as tasks failed. failedMaps:1 failedReob failed as tasks failed
beeline在插入大批量的数据时报错,但是hive能插入改为插入之前先查询一下,报出错误:GC overhead limit exceeded这就好多了,不就是jvm内存溢出了嘛,因为hive能插入,所以不用改hive-site.xml配置文件,只改hive-env.sh就行,打开HADOOP_HEAPSIZE并调大,if语句中也跟着改if [ "$SERVICE" = "cli" ]; then if [ -z "$DEBUG" ]; then export HADOOP_原创 2022-05-16 15:06:29 · 1559 阅读 · 0 评论 -
Hive:Schema version 1.2.0 does not match metastore‘s schema version 2.1.0 问题
在hive-site.xml里关闭元数据验证机制<property> <name>hive.metastore.schema.verification</name> <value>false</value></property>原创 2022-04-25 13:41:47 · 1940 阅读 · 0 评论 -
Hive:Schema initialization FAILED Metastore state would be inconsistent
[root@node3 hive-2.3.4]# schematool -dbType mysql -initSchemaSLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found binding in [jar:file:/opt/hive-2.3.4/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: Found bindin原创 2022-04-02 14:00:18 · 4701 阅读 · 1 评论 -
Hive:beeline启动Found class jline.Terminal, but interface was expected...
Found class jline.Terminal, but interface was expected...转载 2022-04-02 13:53:40 · 199 阅读 · 0 评论 -
Hive:常用系统函数-时间函数
函数 参数格式 解释 from_unixtime from_unixtime(bigint unixtime[, string format]) 将unix时间戳转换为当前所在时区的字符串时间,格式为"yyyy-MM-dd HH:mm:ss" unix_timestamp unix_timestamp() 以秒为单位获取当前的Unix时间戳。 unix_timestamp unix_timestamp(string date) 将格式为"yyyy-转载 2021-02-24 13:44:51 · 405 阅读 · 0 评论 -
Hive:常用系统函数-条件函数
函数 参数格式 解释 if if(boolean testCondition, T valueTrue, T valueFalseOrNull) 如果testCondition为True则返回valueTrue,否则返回valueFalse,没有指定valueFals则返回null isnull isnull( a ) 如果字段a值的值为null则返回True,否则返回False isnotnull isnotnull( a ) 如果字段a值的值不转载 2021-02-24 13:43:57 · 420 阅读 · 0 评论 -
Hive:常用系统函数-字符串函数
函数 参数格式 解释 ascii ascii(string str) 返回传入字符串的第一个字符的ASCII编码 base64 base64(binary bin) 将传入的二进制参数转换为base 64 字符串 character_length character_length(string str) 返回字符串长度(字符串需为UTF8编码) chr chr(bigint|double A) 将传入数字当做ASCII编码,并转换为转载 2021-02-24 13:43:02 · 1547 阅读 · 0 评论 -
Hive:常用系统函数-数学函数
关于Hive常用的字符串处理函数:函数 参数格式 解释 round round(DOUBLE a, INT d) 将 a精确到d位小数,d为可选参数,d空缺时精确到整数位(精确方式为四舍五入) bround bround(DOUBLE a, INT d) 将 a使用HALF_EVEN方式精确到d位小数,d为可选参数(HALF_EVEN的方式使末尾数字为偶数)。例如:bround(8.25, 1) = 8.2, bround(8.35, 1) = 8.4 f转载 2021-02-24 13:42:05 · 207 阅读 · 0 评论 -
Hive:常用系统函数-聚合函数
函数 参数格式 解释 count count(*), count(expr),count(distinct expr) 返回查找的总行数,count(*)返回的行数包括null值;count(expr)和count(distinct expr) 不包括null值 sum sum(col), sum(DISTINCT col) sum(col)返回组内查询列元素的总和,sum(DISTINCT col)返回组内查询列列的不同值的总和 avg avg(col转载 2021-02-24 13:41:00 · 1076 阅读 · 0 评论 -
Hive:当insertinto表的时候报Could not read schema from the hive metastore because it is corrupted
//报错信息Exception in thread "main" org.apache.spark.sql.AnalysisException: The format of the existing table db_src.parquet_test is `HiveFileFormat`. It doesn't match the specified format `ParquetFileFormat`.;//解决办法ALTER TABLE parquet_test SET TBLPROPERTI.转载 2020-09-16 09:34:47 · 1357 阅读 · 0 评论 -
Hive:删除表卡死
在hive删除表的时候卡死删除不了drop table XXX有可能是锁机制造成的,查看是否有锁show locks发现有的表有锁有的表无锁,但还是删除不了这里简单说一下:hive存在两种锁,共享锁Shared (S)和互斥锁Exclusive (X)触发共享锁的操作是可以并发执行的但是触发互斥锁,那么该表和该分区就不能并发的执行作业了。如果有锁的先解锁unlock table XXX无锁的先把锁机制关闭,因为其他表有锁证明锁机制是开启的set hive.suppor转载 2020-09-16 09:19:01 · 2005 阅读 · 0 评论 -
hive的随笔记录
1,当hive的sql语句select有数据,但count显示为0答:这个主要是元数据里没有统计,所以取不出来统计后的条数,解决方法有两种: ①set hive.compute.query.using.stats=false; 这个配置一般在hive-site.xml有配置,不从元数据里取值,重新计算,效率低 ②analyze table 表名 compu...原创 2020-04-26 16:55:19 · 259 阅读 · 0 评论 -
Oracle到Hive的数据类型转换
转载 2020-03-31 17:14:24 · 2349 阅读 · 0 评论 -
Hive多用户权限
HIVE多用户权限当多个用户共同使用hive时,需要对不同角色做不同的权限控制。权限控制主要指底层的hdfs文件操作控制和hive自身对表的授权管理。hive是通过mysql的元数据来控制hive里的权限。 Hive授权的核心是:user,group,role。 User:是基于linux用户的user,哪个linux用户使用hive客户端,那个linux用户就是该hiv...原创 2020-03-12 12:13:12 · 1430 阅读 · 0 评论 -
hdfs及hive文件压缩
1 gzip压缩优点:压缩率比较高,而且压缩/解压速度也比较快;hadoop本身支持,在应用中处理gzip格式的文件就和直接处理文本一样;有hadoop native库;大部分linux系统都自带gzip命令,使用方便。缺点:不支持split。应用场景:当每个文件压缩之后在130M以内的(1个块大小内),都可以考虑用gzip压缩格式。譬如说一天或者一个小时的日志压缩成一个gzip 文件...转载 2020-02-16 17:43:12 · 619 阅读 · 0 评论 -
hive读取ORC表,显示为NULL
我是用kettle导的数据,导入到hive里,但是在查询的时候显示为null,这是因为hive在读取ORC文件时,ORC的schema是区分大小写的,因此无法读到才显示的NULL,可以在到数据的时候把每个字段都加个别名,例如:selecID as id,NAME as namefrom 表名...原创 2020-02-15 18:30:49 · 1572 阅读 · 0 评论 -
关于hql的distinct的优化group by关系
在数据量比较大的情况下,几乎没人用distinct,因为用distinct去重,它会不使用map端的combiner,所以在后续的reduce阶段,不管你设置多少个set reduce task都不管用,都只用1个reduce ,这样肯定会造成倾斜,大部分公司在做hql去重的时候都是用的group by去重,下面举个例子,看一下distinct跟group by的关系。比如我有一张表a...原创 2018-12-07 16:26:23 · 1003 阅读 · 0 评论 -
SemanticException Cartesian products are disabled for safety reasons. If you know what you are doin
SemanticException Cartesian products are disabled for safety reasons. If you know what you are doing, please sethive.strict.checks.cartesian.product to false and that hive.mapred.mode is not set to '...原创 2019-12-12 14:23:27 · 6967 阅读 · 0 评论 -
Hive静/动态分区
Hive分区表分为静态分区跟动态分区1,静态分区 顾名思义,静态分区就是将分区写死,以指定的内容值分区create external table tb_test(id int,name string,age,int)partitioned by (year string ,month string)row format delimitedfields termi...原创 2019-07-31 14:46:47 · 532 阅读 · 0 评论 -
Hive建表时多字符分割
一般hive建表的时候都会根据数据的分隔符进行建表,表的分隔符分三种1,默认分隔符\n 行分隔符 ^A 字段分隔符,八进制表示为\001, ^B array或struct中为元素分隔符,map中为key-value分隔符\002 ^C map中为key和value间的分隔符\003 默认分割符一般是在建表是指定的,^A为\001,^B为\002,^...原创 2019-07-31 13:59:10 · 3528 阅读 · 0 评论 -
hive加载json数据
json数据压缩成.gz文件上传到hdfs,通过hive映射,并进行后续的spark跑算法1,在hdfs上的数据格式化后的形式,根据需求我们只要_source里的数据{ "_index": "operatelog", "_type": "operatelog", "_id": "5938ca71-6057-40b5-a739-5687ae360640", "_source": {...原创 2018-10-25 16:17:17 · 1052 阅读 · 0 评论 -
root用户启动beeline时报错User: root is not allowed to impersonate root (state=,code=0)
在hadoop/etc/hadoop/core-site.xml里加上下面的配置文件,重启hdfs,其中“xxx”是连接beeline的用户,将“xxx”替换成自己的用户名root即可<property> <name>hadoop.proxyuser.xxx.hosts</name> <value>*</va...转载 2018-10-11 17:25:32 · 2300 阅读 · 1 评论 -
Hive数据仓库ORC格式数据
Failed with exception java.io.IOException:java.io.IOException: Malformed ORC file且Caused by: java.io.IOException: Malformed ORC file hdfs://master.hadoop:8020/user/hive/warehouse/shopcn_prod Inval...原创 2018-08-13 16:13:44 · 1189 阅读 · 0 评论 -
Hive启动异常解决(一)
平时用的Hive的时候,总是坚挺的活着,今天竟然莫名其妙的就死给我看shell>hiveException in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadat...原创 2018-05-11 14:29:03 · 2638 阅读 · 0 评论