kevinjqliu commented on code in PR #1283:
URL: https://github.com/apache/iceberg-python/pull/1283#discussion_r1828012018


##########
tests/test_schema.py:
##########
@@ -1189,6 +1189,17 @@ def test_detect_invalid_top_level_maps() -> None:
         _ = UpdateSchema(transaction=None, 
schema=current_schema).union_by_name(new_schema)._apply()  # type: ignore
 
 
+def test_allow_double_to_float() -> None:

Review Comment:
   nit this is the same as `test_allow_union_double_to_float`, lets keep the 
other one



##########
tests/test_schema.py:
##########
@@ -1200,11 +1211,44 @@ def test_promote_float_to_double() -> None:
     assert isinstance(applied.fields[0].field_type, DoubleType)
 
 
-def test_detect_invalid_promotion_double_to_float() -> None:
+def test_allow_long_to_int() -> None:
+    current_schema = Schema(NestedField(field_id=1, name="aCol", 
field_type=LongType(), required=False))
+    new_schema = Schema(NestedField(field_id=1, name="aCol", 
field_type=IntegerType(), required=False))
+
+    applied = UpdateSchema(transaction=None, 
schema=current_schema).union_by_name(new_schema)._apply()  # type: ignore
+
+    assert applied.as_struct() == current_schema.as_struct()
+    assert len(applied.fields) == 1
+    assert isinstance(applied.fields[0].field_type, LongType)
+
+
+def test_promote_int_to_long() -> None:
+    current_schema = Schema(NestedField(field_id=1, name="aCol", 
field_type=IntegerType(), required=False))
+    new_schema = Schema(NestedField(field_id=1, name="aCol", 
field_type=LongType(), required=False))
+
+    applied = UpdateSchema(transaction=None, 
schema=current_schema).union_by_name(new_schema)._apply()  # type: ignore
+
+    assert applied.as_struct() == new_schema.as_struct()
+    assert len(applied.fields) == 1
+    assert isinstance(applied.fields[0].field_type, LongType)
+
+
+def test_allow_union_double_to_float() -> None:

Review Comment:
   ```suggestion
   def test_allow_double_to_float() -> None:
   ```
   same convention as the test above



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to