ClassCastException for Data Type Time

I am getting the below error.

ClassCastException: class org.apache.parquet.column.statistics.LongStatistics cannot be cast to class org.apache.parquet.column.statistics.IntStatistics (org.apache.parquet.column.statistics.LongStatistics and org.apache.parquet.column.statistics.IntStatistics are in unnamed module of loader 'app')

The query I run is the below

with bad_weather_due_to_tropical_cyclone_warning_signals as (


SELECT *
FROM "l1"."hko"."hko_tropical_cyclone_warning_signals_history"
where signal = 10

), bad_weather_due_to_rainstorm as (

SELECT *
FROM "l1"."hko"."hko_rainstorm_warning_history"
where colour = 'B'

), all_days_with_bad_weather as (


select as_of_date_tz08, start_time, end_time from bad_weather_due_to_tropical_cyclone_warning_signals

UNION ALL

select as_of_date_tz08, start_time, end_time from bad_weather_due_to_rainstorm


), cte as (


SELECT as_of_date_tz08, start_time, end_time

from all_days_with_bad_weather
)

select * from cte where start_time > current_time()

I confirm that when I leave out the last WHERE clause, the query works fine.

SO I am pretty sure it is because the ** start_time > current_time() ** which caused the problem.

Atthaced is the query profile.

455ea182-fea7-4792-bbf3-bbe971688f0c.zip (24.3 KB)

Hi there, @Ken
I can see that you’re encountering a ClassCastException related to the data type of start_time in your query. This error is likely due to a type mismatch when comparing start_time with current_time(). Here are a few steps you can take to resolve the issue:

  • Verify Data Types: Ensure that the start_time column in your tables (hko_tropical_cyclone_warning_signals_history and hko_rainstorm_warning_history) is of a compatible type with current_time().
  • Explicit Casting: Try casting start_time to a compatible time type in your query. This can help ensure that the comparison works correctly.
  • Inspect Query Profile: Review the query profile you attached to see where the type mismatch is occurring. This can give you more insight into the specific issue.
  • Check for Null Values: Ensure that start_time does not contain NULL values that might be causing the issue.