Reputation: 1437
When I import data to hive using sqoop bydefault it creates file name as part-m-0000, part-m-0001 etc on HDFS.
Is it possible to rename these files?
If i wish to give some meaningfull name like suffxing file name with date to indicate load how can I do it?
Please suggest
Upvotes: 2
Views: 3459
Reputation: 3973
Yes we can ! see here
sqoop import -D mapreduce.output.basename=`date +%Y-%m-%d`
Upvotes: 1
Reputation: 1638
You can't do it with sqoop directly, but you can rename them in HDFS after sqoop is done importing:
today=`date +%Y-%m-%d`
files=$(hadoop fs -ls /path-to-files | awk '{print $8}')
for f in $files; do hadoop fs -mv $f $f$today; done
The first command gets today's date. The second command gets all the filenames within your directory. The third command renames those files, appending the date.
Upvotes: 1