HIVE-9019: refactor