@@ -1699,12 +1699,12 @@ def test_translate_column_names_missing_column() -> None:
16991699 # Translate column names
17001700 translated_expr = translate_column_names (bound_expr , file_schema , case_sensitive = True )
17011701
1702- # missing_col's initial_default (None) does not match the expression literal (42)
1702+ # missing_col's default initial_default (None) does not match the expression literal (42)
17031703 assert translated_expr == AlwaysFalse ()
17041704
17051705
1706- def test_translate_column_names_missing_column_is_null () -> None :
1707- """Test translate_column_names when missing column is checked for null."""
1706+ def test_translate_column_names_missing_column_match_null () -> None :
1707+ """Test translate_column_names when missing column matches null."""
17081708 # Original schema
17091709 original_schema = Schema (
17101710 NestedField (field_id = 1 , name = "existing_col" , field_type = StringType (), required = False ),
@@ -1726,12 +1726,12 @@ def test_translate_column_names_missing_column_is_null() -> None:
17261726 translated_expr = translate_column_names (bound_expr , file_schema , case_sensitive = True )
17271727
17281728 # Should evaluate to AlwaysTrue because the missing column is treated as null
1729- # missing_col's initial_default (None) satisfies the IsNull predicate
1729+ # missing_col's default initial_default (None) satisfies the IsNull predicate
17301730 assert translated_expr == AlwaysTrue ()
17311731
17321732
17331733def test_translate_column_names_missing_column_with_initial_default () -> None :
1734- """Test translate_column_names when missing column has initial_default that matches expression."""
1734+ """Test translate_column_names when missing column's initial_default matches expression."""
17351735 # Original schema
17361736 original_schema = Schema (
17371737 NestedField (field_id = 1 , name = "existing_col" , field_type = StringType (), required = False ),
@@ -1756,7 +1756,7 @@ def test_translate_column_names_missing_column_with_initial_default() -> None:
17561756 assert translated_expr == AlwaysTrue ()
17571757
17581758
1759- def test_translate_column_names_missing_column_initial_default_mismatch () -> None :
1759+ def test_translate_column_names_missing_column_with_initial_default_mismatch () -> None :
17601760 """Test translate_column_names when missing column's initial_default doesn't match expression."""
17611761 # Original schema
17621762 original_schema = Schema (
@@ -1781,7 +1781,7 @@ def test_translate_column_names_missing_column_initial_default_mismatch() -> Non
17811781 assert translated_expr == AlwaysFalse ()
17821782
17831783
1784- def test_translate_column_names_projected_field_matches () -> None :
1784+ def test_translate_column_names_missing_column_with_projected_field_matches () -> None :
17851785 """Test translate_column_names with projected field value that matches expression."""
17861786 # Original schema with a field that has no initial_default (defaults to None)
17871787 original_schema = Schema (
@@ -1813,7 +1813,7 @@ def test_translate_column_names_projected_field_matches() -> None:
18131813 assert translated_expr == AlwaysTrue ()
18141814
18151815
1816- def test_translate_column_names_projected_field_mismatch () -> None :
1816+ def test_translate_column_names_missing_column_with_projected_field_mismatch () -> None :
18171817 """Test translate_column_names with projected field value that doesn't match expression."""
18181818 # Original schema with a field that has no initial_default (defaults to None)
18191819 original_schema = Schema (
@@ -1842,35 +1842,3 @@ def test_translate_column_names_projected_field_mismatch() -> None:
18421842
18431843 # Should evaluate to AlwaysFalse since projected field value does not match the expression literal
18441844 assert translated_expr == AlwaysFalse ()
1845-
1846-
1847- def test_translate_column_names_projected_field_and_initial_default () -> None :
1848- """Test translate_column_names with both projected field values and initial_default values."""
1849- # Original schema with mixed field configurations
1850- original_schema = Schema (
1851- NestedField (field_id = 1 , name = "existing_col" , field_type = StringType (), required = False ),
1852- NestedField (field_id = 2 , name = "missing_col_1" , field_type = IntegerType (), required = False ),
1853- NestedField (field_id = 3 , name = "missing_col_2" , field_type = StringType (), required = False , initial_default = "test" ),
1854- schema_id = 1 ,
1855- )
1856-
1857- # Create bound expression for both missing columns
1858- unbound_expr = And (EqualTo ("missing_col_1" , 42 ), EqualTo ("missing_col_2" , "test" ))
1859- bound_expr = visit (unbound_expr , visitor = BindVisitor (schema = original_schema , case_sensitive = True ))
1860-
1861- # File schema only has the existing column (field_id=1), missing field_id=2 and field_id=3
1862- file_schema = Schema (
1863- NestedField (field_id = 1 , name = "existing_col" , field_type = StringType (), required = False ),
1864- schema_id = 1 ,
1865- )
1866-
1867- # Projected value for one missing column
1868- projected_field_values = {"missing_col_1" : 42 }
1869-
1870- # Translate column names
1871- translated_expr = translate_column_names (
1872- bound_expr , file_schema , case_sensitive = True , projected_field_values = projected_field_values
1873- )
1874-
1875- # Should evaluate to AlwaysTrue since both missing_col_1's projected value and missing_col_2's initial_default match their respective expression literals
1876- assert translated_expr == AlwaysTrue ()
0 commit comments