public static String toHiveType(Type type) {
        TypeInfo typeInfo = toTypeInfo(type);
        return typeInfo.getTypeName();
    }
@Test
    public void testSRTypeToHiveType() {
        Assert.assertEquals("tinyint", toHiveType(Type.TINYINT));
        Assert.assertEquals("smallint", toHiveType(Type.SMALLINT));
        Assert.assertEquals("int", toHiveType(Type.INT));
        Assert.assertEquals("bigint", toHiveType(Type.BIGINT));
        Assert.assertEquals("float", toHiveType(Type.FLOAT));
        Assert.assertEquals("double", toHiveType(Type.DOUBLE));
        Assert.assertEquals("boolean", toHiveType(Type.BOOLEAN));
        Assert.assertEquals("binary", toHiveType(Type.VARBINARY));
        Assert.assertEquals("date", toHiveType(Type.DATE));
        Assert.assertEquals("timestamp", toHiveType(Type.DATETIME));

        Assert.assertEquals("char(10)", toHiveType(ScalarType.createCharType(10)));
        ExceptionChecker.expectThrowsWithMsg(StarRocksConnectorException.class,
                "Unsupported Hive type: CHAR(10000). Supported CHAR types: CHAR(<=255)",
                () -> toHiveType(ScalarType.createCharType(10000)));

        Assert.assertEquals("varchar(100)", toHiveType(ScalarType.createVarchar(100)));
        Assert.assertEquals("string", toHiveType(ScalarType.createVarcharType(200000)));

        Assert.assertEquals("string", toHiveType(ScalarType.createVarchar(getOlapMaxVarcharLength())));

        ScalarType itemType = ScalarType.createType(PrimitiveType.DATE);
        ArrayType arrayType = new ArrayType(new ArrayType(itemType));
        Assert.assertEquals("array<array<date>>", toHiveType(arrayType));

        ScalarType keyType = ScalarType.createType(PrimitiveType.TINYINT);
        ScalarType valueType = ScalarType.createType(PrimitiveType.SMALLINT);
        MapType mapType = new MapType(keyType, valueType);
        String typeStr = "map<tinyint,smallint>";
        Assert.assertEquals(typeStr, toHiveType(mapType));

        typeStr = "struct<a:struct<aa:date>,b:int>";
        StructField aa = new StructField("aa", ScalarType.createType(PrimitiveType.DATE));

        StructType innerStruct = new StructType(Lists.newArrayList(aa));
        StructField a = new StructField("a", innerStruct);
        StructField b = new StructField("b", ScalarType.createType(PrimitiveType.INT));
        StructType outerStruct = new StructType(Lists.newArrayList(a, b));
        Assert.assertEquals(typeStr, toHiveType(outerStruct));
    }