Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion faust/app/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ def __init__(
# for the web server.
self._monitor = monitor

# Any additional asyncio.Task's specified using @app.task decorator.
# Any additional asyncio.Tasks specified using @app.task decorator.
self._app_tasks = []

# Called as soon as the a worker is fully operational.
Expand Down Expand Up @@ -1138,6 +1138,7 @@ def Table(
window: Optional[WindowT] = None,
partitions: Optional[int] = None,
help: Optional[str] = None,
value_serializer: str = None,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I did only look into this quickly before but the typing is off here.

Why isn't it Optional[CodecArg] like in the Collections base class?

**kwargs: Any,
) -> TableT:
"""Define new table.
Expand Down Expand Up @@ -1169,6 +1170,7 @@ def Table(
beacon=self.tables.beacon,
partitions=partitions,
help=help,
value_serializer=value_serializer,
**kwargs,
),
)
Expand Down
3 changes: 2 additions & 1 deletion faust/tables/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def __init__(
on_window_close: Optional[WindowCloseCallback] = None,
is_global: bool = False,
synchronize_all_active_partitions: bool = False,
value_serializer: Optional[CodecArg] = None,
**kwargs: Any,
) -> None:
Service.__init__(self, loop=app.loop, **kwargs)
Expand Down Expand Up @@ -157,7 +158,7 @@ def __init__(
# Possible values json and raw
# Fallback to json
self.key_serializer = self._serializer_from_type(self.key_type)
self.value_serializer = self._serializer_from_type(self.value_type)
self.value_serializer = value_serializer

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not deep in to Tables yet as I have not used them extensively, but it looks like we do lose convenience behaviour here, as the _serializer_from_type functions translates us bytes to raw and sets the default json.

This seems to be a breaking change. can you elaborate the behaviour?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your review. I will make changes


# Table key expiration
self._partition_timestamp_keys = defaultdict(set)
Expand Down