Although the hive in the tables without primary keys a say, but the actual data development often need the hive in the calculated export tables to mysql database for business use or development calls and mysql table needs a primary key in a hive, we can use row_number () over () function to generate a field window increment sequence, you can specify the fields to export tables mysql library when a primary key is very convenient to use.
SELECT - increment sequence field ROW_NUMBER () over () AS ROW_NUMBER - the other fields , C1 , C2 from edw_tmp.tmp_table_name WHERE dt = '$ {} dt'