public static Schema convertAndPrune(MessageType parquetSchema) {
    return convertInternal(parquetSchema, name -> null);
  }
@Test
  public void testSchemaConversionWithoutAssigningIds() {
    MessageType messageType =
        new MessageType(
            "test",
            primitive(1, "int_col", PrimitiveTypeName.INT32, Repetition.REQUIRED),
            primitive(2, "double_col", PrimitiveTypeName.DOUBLE, Repetition.OPTIONAL),
            primitive(null, "long_col", PrimitiveTypeName.INT64, Repetition.OPTIONAL),
            struct(
                3,
                "struct_col_1",
                Repetition.REQUIRED,
                primitive(4, "n1", PrimitiveTypeName.INT32, Repetition.REQUIRED),
                primitive(null, "n2", PrimitiveTypeName.INT64, Repetition.OPTIONAL),
                primitive(5, "n3", PrimitiveTypeName.INT64, Repetition.OPTIONAL)),
            struct(
                6,
                "struct_col_2",
                Repetition.OPTIONAL,
                primitive(null, "n1", PrimitiveTypeName.INT32, Repetition.REQUIRED),
                primitive(null, "n2", PrimitiveTypeName.INT64, Repetition.OPTIONAL),
                primitive(null, "n3", PrimitiveTypeName.INT64, Repetition.OPTIONAL)),
            list(
                null,
                "list_col_1",
                Repetition.REQUIRED,
                primitive(7, "i", PrimitiveTypeName.INT32, Repetition.OPTIONAL)),
            list(
                8,
                "list_col_2",
                Repetition.REQUIRED,
                primitive(null, "i", PrimitiveTypeName.INT32, Repetition.OPTIONAL)),
            list(
                9,
                "list_col_3",
                Repetition.OPTIONAL,
                struct(
                    null,
                    "s",
                    Repetition.REQUIRED,
                    primitive(10, "n1", PrimitiveTypeName.INT32, Repetition.REQUIRED),
                    primitive(11, "n2", PrimitiveTypeName.INT64, Repetition.OPTIONAL))),
            list(
                12,
                "list_col_4",
                Repetition.REQUIRED,
                struct(
                    13,
                    "s",
                    Repetition.REQUIRED,
                    primitive(null, "n1", PrimitiveTypeName.INT32, Repetition.REQUIRED),
                    primitive(null, "n2", PrimitiveTypeName.INT64, Repetition.OPTIONAL))),
            list(
                14,
                "list_col_5",
                Repetition.OPTIONAL,
                struct(
                    15,
                    "s",
                    Repetition.REQUIRED,
                    primitive(16, "n1", PrimitiveTypeName.INT32, Repetition.REQUIRED),
                    primitive(17, "n2", PrimitiveTypeName.INT64, Repetition.OPTIONAL))),
            map(
                null,
                "map_col_1",
                Repetition.REQUIRED,
                primitive(18, "k", PrimitiveTypeName.INT32, Repetition.REQUIRED),
                primitive(19, "v", PrimitiveTypeName.INT32, Repetition.REQUIRED)),
            map(
                20,
                "map_col_2",
                Repetition.OPTIONAL,
                primitive(null, "k", PrimitiveTypeName.INT32, Repetition.REQUIRED),
                primitive(21, "v", PrimitiveTypeName.INT32, Repetition.REQUIRED)),
            map(
                22,
                "map_col_3",
                Repetition.REQUIRED,
                primitive(null, "k", PrimitiveTypeName.INT32, Repetition.REQUIRED),
                primitive(null, "v", PrimitiveTypeName.INT32, Repetition.REQUIRED)),
            map(
                23,
                "map_col_4",
                Repetition.OPTIONAL,
                primitive(24, "k", PrimitiveTypeName.INT32, Repetition.REQUIRED),
                struct(
                    25,
                    "s",
                    Repetition.REQUIRED,
                    primitive(null, "n1", PrimitiveTypeName.INT32, Repetition.REQUIRED),
                    primitive(26, "n2", PrimitiveTypeName.INT64, Repetition.OPTIONAL),
                    primitive(null, "n3", PrimitiveTypeName.INT64, Repetition.OPTIONAL))),
            map(
                27,
                "map_col_5",
                Repetition.REQUIRED,
                primitive(28, "k", PrimitiveTypeName.INT32, Repetition.REQUIRED),
                primitive(29, "v", PrimitiveTypeName.INT32, Repetition.REQUIRED)));

    Schema expectedSchema =
        new Schema(
            required(1, "int_col", Types.IntegerType.get()),
            optional(2, "double_col", Types.DoubleType.get()),
            required(
                3,
                "struct_col_1",
                Types.StructType.of(
                    required(4, "n1", Types.IntegerType.get()),
                    optional(5, "n3", Types.LongType.get()))),
            optional(
                14,
                "list_col_5",
                Types.ListType.ofRequired(
                    15,
                    Types.StructType.of(
                        required(16, "n1", Types.IntegerType.get()),
                        optional(17, "n2", Types.LongType.get())))),
            optional(
                23,
                "map_col_4",
                Types.MapType.ofRequired(
                    24,
                    25,
                    Types.IntegerType.get(),
                    Types.StructType.of(optional(26, "n2", Types.LongType.get())))),
            required(
                27,
                "map_col_5",
                Types.MapType.ofRequired(
                    28, 29, Types.IntegerType.get(), Types.IntegerType.get())));

    Schema actualSchema = ParquetSchemaUtil.convertAndPrune(messageType);
    assertThat(actualSchema.asStruct())
        .as("Schema must match")
        .isEqualTo(expectedSchema.asStruct());
  }