SELECT
    COUNT(*) as total_count,
    COUNT_IF({column_name} IS NULL) as null_count,
    ROUND(COUNT_IF({column_name} IS NULL) * 1.0 / COUNT(*), 6) as null_rate
FROM {table_name}
WHERE 1=1
    AND IFF(
        '{partition_start_date}' = '{partition_end_date}',
        p_date = '{partition_start_date}' AND p_hour >= {partition_start_hour} AND p_hour < {partition_end_hour},
        (
            (p_date = '{partition_start_date}' AND p_hour >= {partition_start_hour}) OR
            (p_date > '{partition_start_date}' AND p_date < '{partition_end_date}') OR
            (p_date = '{partition_end_date}' AND p_hour < {partition_end_hour})
        )
    )
