Why not output for "echo $sql;"?

________________________________
发件人: gm yu <husty...@gmail.com>
发送时间: 2016年7月15日 9:59:39
收件人: user@hive.apache.org
主题: Hive failed with "No files matching path"

Hello

I have a question about Hive(2.0.0) and HDFS(2.7.2). I met many Hive failure 
with "No files matching path". The script like:

hadoop fs -test -e $hdfspath
if [ $? -ne 0 ]; then
    echo "Directory not exists!"
    hadoop fs -mkdir $hdfspath
else
    echo "Directory exists!"
fi

hadoop distcp oss://${bucket}/${filename} ${hdfspath}
hdfsname = $hdfspath/$filename
hadoop fs -test -e $hdfsname
if [ $? -ne 0 ]; then
   echo "File not exists!"
else
    echo "File exists!"
fi

sql=" LOAD DATA INPATH '${hdfspath}' OVERWRITE INTO TABLE {output} PARTITION 
(pt='${time}');"

echo $sql;
hive -e "$sql"

if [ $? -ne 0 ]; then
    echo "Hive unsuccessful!"
else
    echo "Hive successful!"
fi

The log is:

Directory not exists!
File exists!
Hive unsuccessful!
FAILED: SemanticException Line 2:19 Invalid path 'xxxx': No files matching path 
'xxxx'

But rerun this script, everything is OK.

Any idea what is this about?

Thanks & Regards

Reply via email to