Making YAQL function length() work for generators

Change-Id: I35663e01004d1eb72dfc0b442eba5d3c010eb6d7