hive遇到的各种问题

找半天找不到对应解决办法,我也是心累

前提:

将两个分区字段的表数据转移到一个分区字段的表中

 遇到很奇怪的一个问题。新表有四个分区被我删掉了,我将旧表有俩分区字段的多个分区的表数据放到新表,结果只出现我之前删掉的4个分区,按理应该是大于4个分区的。

使用

https://blog.csdn.net/qq_39532946/article/details/77921039

https://www.cnblogs.com/zlzhoulei/p/5552366.html

hive能支持多大的分区数呢,可以使用命令set hive.exec.max.dynamic.partitions获取

https://www.cnblogs.com/kimbo/p/7102571.html

复制表结构: create table new_table as select * from exists_table where 1=0;

复制表结构和数据: create table new_table as select * from exists_table;

https://blog.csdn.net/lz6363/article/details/86709038

https://blog.csdn.net/juanjuan1314/article/details/78203011

的方法直接在插入的时候动态制定分区应该是有问题。

alter table tb_partition drop partition (etl_dt>='20181102',etl_dt<='20181104')

 执行插入前,要先开启动态分区支持

set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nostrict;
set hive.exec.max.dynamic.partitions.pernode=1000;

hive改表结构的两个坑

https://blog.csdn.net/windyqcf/article/details/51488139

 修改已经存在的表:

https://my.oschina.net/crxy/blog/413902

hive中关于修改字段change replace区别

https://www.cnblogs.com/linn/p/6233776.html

修改指定列
ALTER TABLE name CHANGE column_name new_name new_type

例子:hive> ALTER TABLE employee CHANGE name ename String;

hive> ALTER TABLE employee CHANGE salary salary Double;

替换指定列
ALTER TABLE name REPLACE COLUMNS (col_spec[, col_spec ...])

例子:hive> ALTER TABLE employee REPLACE COLUMNS (eid INT empid Int,ename STRING name String);

CentOS6 Shell脚本/bin/bash^M: bad interpreter错误解决方法

在windows下保存了一个脚本文件,用ssh上传到centos,添加权限执行Linux提示没有那个文件或目录。
shell脚本放到/etc/init.d/目录下,再执行/etc/init.d/nginx,提示多了这句/bin/bash^M: bad interpreter。
网上找了资料才知道
如果这个脚本在Windows下编辑过,就有可能被转换成Windows下的dos文本格式了,这样的格式每一行的末尾都是以 来标识,它的ASCII码分别是0x0D,0x0A。如果你将这个脚本文件直接放到Linux上执行就会报/bin/bash^M: bad interpreter错误提示。
解决方法很简单,首先你先要检查一下看看你的脚本文件是不是这个问题导致的,用vi命令打开要检查的脚本文件,然后用
:set ff?
命令检查一下,看看是不是dos字样,如果是dos格式的,继续执行
:set ff=unix
然后执行
:qw
保存退出即可。

转载自:https://my.oschina.net/chunto/blog/227003

Vscode DOS和UNIX脚本文件之间相互转换的多种方法

https://blog.csdn.net/CodyGuo/article/details/72811173

原文地址:https://www.cnblogs.com/psyche61/p/10979410.html