Fix query accross multiple partitions
Migration to HQL