HIVE-8017: fix class cast exception