public static boolean typeContainsTimestamp(TypeInfo type) {
    Category category = type.getCategory();

    switch (category) {
      case PRIMITIVE:
        return type.getTypeName().equals(TIMESTAMP_TYPE_NAME);
      case LIST:
        ListTypeInfo listTypeInfo = (ListTypeInfo) type;
        return typeContainsTimestamp(listTypeInfo.getListElementTypeInfo());
      case MAP:
        MapTypeInfo mapTypeInfo = (MapTypeInfo) type;
        return typeContainsTimestamp(mapTypeInfo.getMapKeyTypeInfo())
            || typeContainsTimestamp(mapTypeInfo.getMapValueTypeInfo());
      case STRUCT:
        StructTypeInfo structTypeInfo = (StructTypeInfo) type;
        return structTypeInfo.getAllStructFieldTypeInfos().stream()
            .anyMatch(HoodieColumnProjectionUtils::typeContainsTimestamp);
      case UNION:
        UnionTypeInfo unionTypeInfo = (UnionTypeInfo) type;
        return unionTypeInfo.getAllUnionObjectTypeInfos().stream()
            .anyMatch(HoodieColumnProjectionUtils::typeContainsTimestamp);
      default:
        return false;
    }
  }
@Test
  void testTypeContainsTimestamp() {
    String col1 = "timestamp";
    TypeInfo typeInfo1 = TypeInfoUtils.getTypeInfosFromTypeString(col1).get(0);
    assertTrue(HoodieColumnProjectionUtils.typeContainsTimestamp(typeInfo1));

    String col2 = "string";
    TypeInfo typeInfo2 = TypeInfoUtils.getTypeInfosFromTypeString(col2).get(0);
    assertFalse(HoodieColumnProjectionUtils.typeContainsTimestamp(typeInfo2));

    String col3 = "array<timestamp>";
    TypeInfo typeInfo3 = TypeInfoUtils.getTypeInfosFromTypeString(col3).get(0);
    assertTrue(HoodieColumnProjectionUtils.typeContainsTimestamp(typeInfo3));

    String col4 = "array<string>";
    TypeInfo typeInfo4 = TypeInfoUtils.getTypeInfosFromTypeString(col4).get(0);
    assertFalse(HoodieColumnProjectionUtils.typeContainsTimestamp(typeInfo4));

    String col5 = "map<string,timestamp>";
    TypeInfo typeInfo5 = TypeInfoUtils.getTypeInfosFromTypeString(col5).get(0);
    assertTrue(HoodieColumnProjectionUtils.typeContainsTimestamp(typeInfo5));

    String col6 = "map<string,string>";
    TypeInfo typeInfo6 = TypeInfoUtils.getTypeInfosFromTypeString(col6).get(0);
    assertFalse(HoodieColumnProjectionUtils.typeContainsTimestamp(typeInfo6));

    String col7 = "struct<name1:string,name2:timestamp>";
    TypeInfo typeInfo7 = TypeInfoUtils.getTypeInfosFromTypeString(col7).get(0);
    assertTrue(HoodieColumnProjectionUtils.typeContainsTimestamp(typeInfo7));

    String col8 = "struct<name1:string,name2:string>";
    TypeInfo typeInfo8 = TypeInfoUtils.getTypeInfosFromTypeString(col8).get(0);
    assertFalse(HoodieColumnProjectionUtils.typeContainsTimestamp(typeInfo8));

    String col9 = "uniontype<string,timestamp>";
    TypeInfo typeInfo9 = TypeInfoUtils.getTypeInfosFromTypeString(col9).get(0);
    assertTrue(HoodieColumnProjectionUtils.typeContainsTimestamp(typeInfo9));

    String col10 = "uniontype<string,int>";
    TypeInfo typeInfo10 = TypeInfoUtils.getTypeInfosFromTypeString(col10).get(0);
    assertFalse(HoodieColumnProjectionUtils.typeContainsTimestamp(typeInfo10));

    String col11 = "uniontype<string,int,map<string,array<timestamp>>>";
    TypeInfo typeInfo11 = TypeInfoUtils.getTypeInfosFromTypeString(col11).get(0);
    assertTrue(HoodieColumnProjectionUtils.typeContainsTimestamp(typeInfo11));
  }