added support for union and batched data