add codes to implement the compatibility of with hive, and some test cases