Support for PARTITION BY in window

Plus a minor correction to window expression building.