前言
直接上代码:
max_date=$(hive -e "select max(date) from table")echo $max_date
本来就只是想去到日期的最大值1121,可谁知道输出的结果却是:
1121 WARN: The method class mons.logging.impl.SLF4JLogFactory#release() was invoked. WARN: Please see /codes.html#release for an explanation.
这样显然不能继续使用max_date变量了
这个Hive版本是1.1 CDH5.16.1默认的版本
如何解决
过滤掉WARN日志max_date=$(hive -e "select max(date) from table" | grep -v "WARN")echo $max_date
添加 export HIVE_SKIP_SPARK_ASSEMBLY=true; 到 /etc/profile这种方法简单粗暴,也是我推荐的方式,毕竟不是所有的Hive版本都有这样的问题,这种方式不需要修改环境变量
echo “export HIVE_SKIP_SPARK_ASSEMBLY=true;” >> /etc/profilesource /etc/profile
这种方式,我个人不推荐