HIVE-8852: initial refactor