#!/bin/bash
db=xxx
hive=/opt/cloudera/parcels/CDH-5.16.2-1.cdh5.16.2.p0.8/bin/hive
if [ $1 ];
then
do_date1=$1
else
echo "指定计算日期"
exit
fi
flag=`$hive -e "
use $db;
set hive.cli.print.header=false;
set HIVE_SKIP_SPARK_ASSEMBLY=true;
select
ct
from (
select
date_format(ordercreatetime, 'yyyy-MM-dd') as ct
from
t
where
dt = '$1'
) t group by ct
;
"| grep -v "WARN"`
#flag=$do_date1
#echo "flag:"$flag
arr1=()
for i in $flag
do
if [[ $i == "20"* ]] && [[ ${#i} == 10 ]]
then
arr1+=($i)
fi
done
strA=$flag
strB="信息"
result=$(echo $strA | grep "${strB}")
if [[ "$result" != "" ]]
then
echo "$1"
else
#echo "$flag"
echo ${arr1[*]}
fi
变化的日期
于 2023-06-13 10:59:52 首次发布