lundi 7 juin 2021

how to get the exactly the rest when using rand() in hive SQL

I wanna split my table into 2 set. one for 5% random selection and the rest is 95%.

create table cg_table 
from
(select *
from base_table
where partition = '20210615'
and rand() = 0.05
distribute by rand()
sort by rand()
)

this is the 5% of random selection and I wanna create a rule_table with 95% of the rest of base_table (base_table - cg_table) pls help me, bros!!!




Aucun commentaire:

Enregistrer un commentaire