jason810496 commented on code in PR #52015:
URL: https://github.com/apache/airflow/pull/52015#discussion_r2163213786
##########
providers/apache/kafka/src/airflow/providers/apache/kafka/operators/consume.py:
##########
@@ -82,7 +82,7 @@ def __init__(
apply_function_batch: Callable[..., Any] | str | None = None,
apply_function_args: Sequence[Any] | None = None,
apply_function_kwargs: dict[Any, Any] | None = None,
- commit_cadence: str | None = "end_of_operator",
+ commit_cadence: str = "end_of_operator",
Review Comment:
Before this fix, if `commit_cadence="never"`, the `self.commit_cadence`
attribute will be set to `None` at (
https://github.com/apache/airflow/blob/201e66312bc35dbc8c34ade155c6958a8781e733/providers/apache/kafka/src/airflow/providers/apache/kafka/operators/consume.py#L120-L121
) , then at the end of `execute` (
https://github.com/apache/airflow/blob/201e66312bc35dbc8c34ade155c6958a8781e733/providers/apache/kafka/src/airflow/providers/apache/kafka/operators/consume.py#L180-L182
) will check if `self.commit_cadence` is set or not to decide whether to
commit.
IMO, we should just check whether the `self.commit_cadence` is `"never"` or
not to decide whether to commit. Also I add a new
`test_commit_cadence_behavior` test to ensure the consistent behavior for this
small change.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]