HIVE-7527: fix incorrect result