add basesql groupby; fix last_known_warehouse_mtime