MAX function not working on 3.3.2


The MAX function does not work on latest version. I got this error:

Union type not supported in aggregate functions

The request is as simple as that :

SELECT MAX(recordDate) FROM event GROUP BY home


Given that the error says union type, this means that recordDate is a union type (Dremio detected several different types of data in the column). You can read more on how to deal with mixed types here.

recordDate is a Date in MongoDB.
You’re right it’s not recognized as simple type. When I convert to Date I got the following error:

java.time.LocalDateTime cannot be cast to org.joda.time.LocalDateTime

It worked in dremio 3.2.1

A workaround is this expression :
CAST(CAST(recordDate AS VARCHAR) AS DATE) AS recordDate

Can you provide a full stack trace or a job profile for the error, that is a bug and more info is appreciated.

Please find it (1,7 Ko)