Skip to content

Commit

Permalink
Actually convert single key to a string in stringify_key() (#484)
Browse files Browse the repository at this point in the history
  • Loading branch information
gtopper authored Dec 28, 2023
1 parent 52adc10 commit 87052ab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions storey/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ def stringify_key(key_list):
return str(key_list[0]) + "." + hash_list(key_list[1:])
if len(key_list) == 2:
return str(key_list[0]) + "." + str(key_list[1])
return key_list[0]
return str(key_list[0])
else:
return key_list
return str(key_list)


def _create_filter_tuple(dtime, attr, sign, list_tuples):
Expand Down
20 changes: 10 additions & 10 deletions tests/test_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2826,8 +2826,8 @@ def test_write_to_parquet_with_inference_error_on_partition_index_collision(tmpd

def test_join_by_key():
table = Table("test", NoopDriver())
table._update_static_attrs(9, {"age": 1, "color": "blue9"})
table._update_static_attrs(7, {"age": 3, "color": "blue7"})
table._update_static_attrs("9", {"age": 1, "color": "blue9"})
table._update_static_attrs("7", {"age": 3, "color": "blue7"})

controller = build_flow(
[
Expand All @@ -2848,8 +2848,8 @@ def test_join_by_key():

def test_join_by_key_error():
table = Table("test", NoopDriver())
table._update_static_attrs(1, {"age": 1, "color": "blue"})
table._update_static_attrs(3, {"age": 3, "color": "red"})
table._update_static_attrs("1", {"age": 1, "color": "blue"})
table._update_static_attrs("3", {"age": 3, "color": "red"})

recovery_step = Reduce([], lambda acc, x: append_and_return(acc, x))
terminal_step = Reduce([], lambda acc, x: append_and_return(acc, x))
Expand Down Expand Up @@ -2877,8 +2877,8 @@ def test_join_by_key_error():

def test_join_by_key_full_event():
table = Table("test", NoopDriver())
table._update_static_attrs(9, {"age": 1, "color": "blue9"})
table._update_static_attrs(7, {"age": 3, "color": "blue7"})
table._update_static_attrs("9", {"age": 1, "color": "blue9"})
table._update_static_attrs("7", {"age": 3, "color": "blue7"})

controller = build_flow(
[
Expand All @@ -2899,8 +2899,8 @@ def test_join_by_key_full_event():

def test_join_by_string_key():
table = Table("test", NoopDriver())
table._update_static_attrs(9, {"age": 1, "color": "blue9"})
table._update_static_attrs(7, {"age": 3, "color": "blue7"})
table._update_static_attrs("9", {"age": 1, "color": "blue9"})
table._update_static_attrs("7", {"age": 3, "color": "blue7"})

controller = build_flow(
[
Expand All @@ -2921,8 +2921,8 @@ def test_join_by_string_key():

def test_join_with_join_function():
table = Table("test", NoopDriver())
table._update_static_attrs(2, {"age": 2, "color": "blue"})
table._update_static_attrs(3, {"age": 3, "color": "red"})
table._update_static_attrs("2", {"age": 2, "color": "blue"})
table._update_static_attrs("3", {"age": 3, "color": "red"})

def join_function(event, aug):
event.update(aug)
Expand Down

0 comments on commit 87052ab

Please sign in to comment.