Refactor hiveserver2