I have a table with many duplicated rows - but I only want to deduplicate rows one partition at a time.
How can I do this?
As an example, you can start with a table partitioned by date and filled with random integers from 1 to 5:
CREATE OR REPLACE TABLE `temp.many_random`
PARTITION BY d
AS
SELECT DATE('2018-10-01') d, fhoffa.x.random_int(0,5) random_int
FROM UNNEST(GENERATE_ARRAY(1, 100))
UNION ALL
SELECT CURRENT_DATE() d, fhoffa.x.random_int(0,5) random_int
FROM UNNEST(GENERATE_ARRAY(1, 100))
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…