HIVE-7773: refactor