@@ -1145,26 +1145,20 @@ def test_initial_default_all_columns(
11451145@pytest .mark .integration
11461146def test_add_required_column_initial_default (catalog : Catalog ) -> None :
11471147 schema_ = Schema (NestedField (field_id = 1 , name = "a" , field_type = BooleanType (), required = False ))
1148- table = _create_table_with_schema (catalog , schema_ )
1149- new_schema = (
1150- UpdateSchema (transaction = table .transaction ())
1151- .add_column (path = "data" , field_type = IntegerType (), required = True , default_value = 22 )
1152- ._apply ()
1153- )
1154- assert new_schema == Schema (
1155- NestedField (field_id = 1 , name = "a" , field_type = BooleanType (), required = True , initial_default = True ),
1148+ table = _create_table_with_schema (catalog , schema_ , properties = {TableProperties .FORMAT_VERSION : 3 })
1149+
1150+ table .update_schema ().add_column (path = "data" , field_type = IntegerType (), required = True , default_value = 22 ).commit ()
1151+
1152+ assert table .schema () == Schema (
1153+ NestedField (field_id = 1 , name = "a" , field_type = BooleanType (), required = False ),
11561154 NestedField (field_id = 2 , name = "data" , field_type = IntegerType (), required = True , initial_default = 22 , write_default = 22 ),
11571155 schema_id = 1 ,
11581156 )
11591157
11601158 # Update
1161- new_schema = (
1162- UpdateSchema (transaction = table .transaction ())
1163- .update_column (path = "data" , field_type = LongType ())
1164- .rename_column ("a" , "bool" )
1165- ._apply ()
1166- )
1167- assert new_schema == Schema (
1159+ table .update_schema ().update_column (path = "data" , field_type = LongType ()).rename_column ("a" , "bool" ).commit ()
1160+
1161+ assert table .schema () == Schema (
11681162 NestedField (field_id = 1 , name = "bool" , field_type = BooleanType (), required = False ),
11691163 NestedField (field_id = 2 , name = "data" , field_type = LongType (), required = True , initial_default = 22 , write_default = 22 ),
11701164 schema_id = 1 ,
0 commit comments