Hsql use recursively "resolveColumnReferencesAndAllocate" function to assign the "isAggregation" flag for each expression. So Hsql's " isAggregate" really means "containAggregate".

For the "alias" flag, I am not so sure about it. The original checking for display columns makes sure the "alias" is not null. I assume the HAVING expression will use the opposite checking. But I think we should not need to bother the "alias" flag for HAVING expression, just to make sure it is an Logical Expression and contains aggregation. 

Sound good to you?