public static Schema inferWiderSchema(List<Schema> schemas) {
        if (schemas.isEmpty()) {
            return null;
        } else if (schemas.size() == 1) {
            return schemas.get(0);
        } else {
            Schema outputSchema = null;
            for (Schema schema : schemas) {
                outputSchema = inferWiderSchema(outputSchema, schema);
            }
            return outputSchema;
        }
    }
@Test
    public void testInferWiderSchema() {
        // Test normal merges
        Assertions.assertThat(
                        SchemaUtils.inferWiderSchema(
                                Schema.newBuilder()
                                        .physicalColumn("Column1", DataTypes.INT())
                                        .physicalColumn("Column2", DataTypes.DOUBLE())
                                        .primaryKey("Column1")
                                        .partitionKey("Column2")
                                        .build(),
                                Schema.newBuilder()
                                        .physicalColumn("Column1", DataTypes.BIGINT())
                                        .physicalColumn("Column2", DataTypes.FLOAT())
                                        .primaryKey("Column1")
                                        .partitionKey("Column2")
                                        .build()))
                .isEqualTo(
                        Schema.newBuilder()
                                .physicalColumn("Column1", DataTypes.BIGINT())
                                .physicalColumn("Column2", DataTypes.DOUBLE())
                                .primaryKey("Column1")
                                .partitionKey("Column2")
                                .build());

        // Test merging with incompatible types
        Assertions.assertThatThrownBy(
                        () ->
                                SchemaUtils.inferWiderSchema(
                                        Schema.newBuilder()
                                                .physicalColumn("Column1", DataTypes.INT())
                                                .physicalColumn("Column2", DataTypes.DOUBLE())
                                                .primaryKey("Column1")
                                                .partitionKey("Column2")
                                                .build(),
                                        Schema.newBuilder()
                                                .physicalColumn("Column1", DataTypes.STRING())
                                                .physicalColumn("Column2", DataTypes.STRING())
                                                .primaryKey("Column1")
                                                .partitionKey("Column2")
                                                .build()))
                .isExactlyInstanceOf(IllegalStateException.class);

        // Test merging with incompatible column names
        Assertions.assertThatThrownBy(
                        () ->
                                SchemaUtils.inferWiderSchema(
                                        Schema.newBuilder()
                                                .physicalColumn("Column1", DataTypes.INT())
                                                .physicalColumn("Column2", DataTypes.DOUBLE())
                                                .primaryKey("Column1")
                                                .partitionKey("Column2")
                                                .build(),
                                        Schema.newBuilder()
                                                .physicalColumn("NotColumn1", DataTypes.INT())
                                                .physicalColumn("NotColumn2", DataTypes.DOUBLE())
                                                .primaryKey("NotColumn1")
                                                .partitionKey("NotColumn2")
                                                .build()))
                .isExactlyInstanceOf(IllegalStateException.class);

        // Test merging with different column counts
        Assertions.assertThatThrownBy(
                        () ->
                                SchemaUtils.inferWiderSchema(
                                        Schema.newBuilder()
                                                .physicalColumn("Column1", DataTypes.INT())
                                                .physicalColumn("Column2", DataTypes.DOUBLE())
                                                .physicalColumn("Column3", DataTypes.STRING())
                                                .primaryKey("Column1")
                                                .partitionKey("Column2")
                                                .build(),
                                        Schema.newBuilder()
                                                .physicalColumn("NotColumn1", DataTypes.INT())
                                                .physicalColumn("NotColumn2", DataTypes.DOUBLE())
                                                .primaryKey("NotColumn1")
                                                .partitionKey("NotColumn2")
                                                .build()))
                .isExactlyInstanceOf(IllegalStateException.class);

        // Test merging with incompatible schema metadata
        Assertions.assertThatThrownBy(
                        () ->
                                SchemaUtils.inferWiderSchema(
                                        Schema.newBuilder()
                                                .physicalColumn("Column1", DataTypes.INT())
                                                .physicalColumn("Column2", DataTypes.DOUBLE())
                                                .primaryKey("Column1")
                                                .partitionKey("Column2")
                                                .option("Key1", "Value1")
                                                .build(),
                                        Schema.newBuilder()
                                                .physicalColumn("Column1", DataTypes.INT())
                                                .physicalColumn("Column2", DataTypes.DOUBLE())
                                                .primaryKey("Column2")
                                                .partitionKey("Column1")
                                                .option("Key2", "Value2")
                                                .build()))
                .isExactlyInstanceOf(IllegalStateException.class);
    }