Skip to content

Commit

Permalink
Add test case for partitioned paths disabled but with no partition sp…
Browse files Browse the repository at this point in the history
…ecial case
  • Loading branch information
Sreesh Maheshwar committed Jan 10, 2025
1 parent 490d08c commit 3555932
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/table/test_locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ def test_partition_value_in_path(object_storage: bool) -> None:
assert partition_segment == "string_field=example_string"


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

location = provider.new_data_location("test.parquet", PARTITION_KEY)
location = provider.new_data_location("test.parquet", partition_key)

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

0 comments on commit 3555932

Please sign in to comment.