At present, there is no convenient function that can be used directly, and only concat can be used to manually splicing.
Note that the null field value is converted to empty, use the nvl function
If the hql statement is written in the script.q file as follows:
select concat('{"data_dt":"',a.data_dt, '","user":"',NVL(a.`user`, ''), '","click":"',NVL(a.click, ''), '"}') as value from table a;
If you use the hive -e parameter directly, you need to escape the double quotes
select concat('{\"data_dt\":\"',a.data_dt, '\",\"user\":\"',NVL(a.`user`, ''), '\",\"click\":\"',NVL(a.click, ''), '\"}') as value from table a;