Fokko commented on code in PR #2293:
URL: https://github.com/apache/iceberg-python/pull/2293#discussion_r2257956398
##########
tests/expressions/test_visitors.py:
##########
@@ -1730,6 +1730,33 @@ def
test_translate_column_names_missing_column_match_null() -> None:
assert translated_expr == AlwaysTrue()
+def test_translate_column_names_missing_column_match_explicit_null() -> None:
+ """Test translate_column_names when missing column matches null."""
+ # Original schema
+ original_schema = Schema(
+ NestedField(field_id=1, name="existing_col", field_type=StringType(),
required=False),
+ NestedField(field_id=2, name="missing_col", field_type=IntegerType(),
required=False),
+ schema_id=1,
+ )
+
+ # Create bound expression for the missing column
+ unbound_expr = IsNull("missing_col")
+ bound_expr = visit(unbound_expr,
visitor=BindVisitor(schema=original_schema, case_sensitive=True))
+
+ # File schema only has the existing column (field_id=1), missing field_id=2
+ file_schema = Schema(
+ NestedField(field_id=1, name="existing_col", field_type=StringType(),
required=False),
+ schema_id=1,
+ )
+
+ # Translate column names
+ translated_expr = translate_column_names(bound_expr, file_schema,
case_sensitive=True, projected_field_values={2: None})
Review Comment:
A partition can be null as well 👍
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]