My csv file has multiple rows of data and I want to split it into multiple files based on one attribute.
beeline -u jdbc:hive2:<MYHOST> -n <USER> -p <PASSWORD> --silent=true --outputformat=csv2 -f <SQL FILE> > result_+%Y%m%d_%H%M%S.csv
SQL code with ORDER BY ID is triggered from beeline which creates single CSV.
cat sql.csv "attr;attr;ID;attr" "data;data;XXXX;date" "data;data;XXXX;date" "data;data;YYYYY;date" "data;data;YYYYY;date" "data;data;BBBBB;date" "data;data;BBBBB;date"
Desired result is to split once new ID is recognised and use that ID in filename.
file_1_ID_XXXX_+%Y%m%d_%H%M%S:
attr attr ID attr data data XXXX date data data XXXX date
file_2_ID_YYYYY_+%Y%m%d_%H%M%S:
attr attr ID attr data data YYYYY date data data YYYYY date