Skip to content

Commit 3555932

Browse files
author
Sreesh Maheshwar
committed
Add test case for partitioned paths disabled but with no partition special case
1 parent 490d08c commit 3555932

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/table/test_locations.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ def test_partition_value_in_path(object_storage: bool) -> None:
9797
assert partition_segment == "string_field=example_string"
9898

9999

100-
def test_object_storage_exclude_partition_in_path() -> None:
100+
# NB: We test here with None partition key too because disabling partitioned paths still replaces final / with - even in
101+
# paths of un-partitioned files. This matches the behaviour of the Java implementation.
102+
@pytest.mark.parametrize("partition_key", [PARTITION_KEY, None])
103+
def test_object_storage_partitioned_paths_disabled(partition_key: Optional[PartitionKey]) -> None:
101104
provider = load_location_provider(
102105
table_location="table_location",
103106
table_properties={
@@ -106,7 +109,7 @@ def test_object_storage_exclude_partition_in_path() -> None:
106109
},
107110
)
108111

109-
location = provider.new_data_location("test.parquet", PARTITION_KEY)
112+
location = provider.new_data_location("test.parquet", partition_key)
110113

111114
# No partition values included in the path and last part of entropy is separated with "-"
112115
assert location == "table_location/data/0110/1010/0011/11101000-test.parquet"

0 commit comments

Comments
 (0)