'How to convert string to date and use MIN and MAX in Impala?

I'm trying to get the highest date and lowest date in the column, from there get the data that is in the filesize column of the rows that have these respective dates and add it to another column. I made the following code but it doesn't work.

CASE WHEN MIN(to_timestamp(extract_dt, 'yyyy-MM-dd')) THEN filesize ELSE 0 END filesize_extracao_passada,


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source