Skip to content

Conversation

@stankiewicz
Copy link
Contributor

Moved CausedByDrain to sdk/core as top level enum.
Migrated type from boolean to CausedByDrain in WindowedValue interface and implementations.


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

changed boolean causedByDrain in WindowedValue interface to enum. 
spotless
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @stankiewicz, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the CausedByDrain enum, promoting it to a top-level class within the SDK's core values. This change standardizes the representation of drain-related information, enhancing type safety and simplifying its usage across various components and runners. The migration ensures a consistent approach to handling drain signals throughout the Apache Beam SDK.

Highlights

  • Type Migration: The CausedByDrain enum has been moved from an inner class within TimerInternals.TimerData to a top-level enum in org.apache.beam.sdk.values.
  • API Update: The causedByDrain() method in the WindowedValue interface and its implementations has been updated to return the new CausedByDrain enum type instead of a boolean.
  • Codebase Refactor: All references to the old TimerData.CausedByDrain.NORMAL and boolean causedByDrain values have been updated across the codebase to use the new top-level CausedByDrain.NORMAL or CausedByDrain.CAUSED_BY_DRAIN enum values, improving type safety and consistency.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • runners/core-java/src/main/java/org/apache/beam/runners/core/ReduceFnContextFactory.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.of calls to use the new CausedByDrain.NORMAL enum.
  • runners/core-java/src/main/java/org/apache/beam/runners/core/SplittableParDoViaKeyedWorkItems.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerInternals.TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/core-java/src/main/java/org/apache/beam/runners/core/TimerInternals.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Removed the inner CausedByDrain enum from TimerData.
    • Updated TimerData.of calls to use the new CausedByDrain.NORMAL enum.
  • runners/core-java/src/test/java/org/apache/beam/runners/core/InMemoryTimerInternalsTest.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL in test cases.
  • runners/core-java/src/test/java/org/apache/beam/runners/core/KeyedWorkItemCoderTest.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/core-java/src/test/java/org/apache/beam/runners/core/ReduceFnTester.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/core-java/src/test/java/org/apache/beam/runners/core/SimpleDoFnRunnerTest.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/core-java/src/test/java/org/apache/beam/runners/core/SimplePushbackSideInputDoFnRunnerTest.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/core-java/src/test/java/org/apache/beam/runners/core/TimerInternalsTest.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL in test cases.
  • runners/core-java/src/test/java/org/apache/beam/runners/core/triggers/TriggerStateMachineTester.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/direct-java/src/test/java/org/apache/beam/runners/direct/DirectTimerInternalsTest.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/direct-java/src/test/java/org/apache/beam/runners/direct/DoFnLifecycleManagerRemovingTransformEvaluatorTest.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/direct-java/src/test/java/org/apache/beam/runners/direct/EvaluationContextTest.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/direct-java/src/test/java/org/apache/beam/runners/direct/WatermarkManagerTest.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/BatchViewOverrides.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Changed the return type of causedByDrain() from boolean to CausedByDrain and updated its implementation.
  • runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/UngroupedWindmillReader.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated the type of drainingValueFromUpstream from boolean to CausedByDrain and adjusted its assignment logic.
  • runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/WindmillKeyedWorkItem.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated the type of drainingValueFromUpstream from boolean to CausedByDrain and adjusted its assignment logic.
  • runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/WindmillTimerInternals.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/util/ValueInEmptyWindows.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Changed the return type of causedByDrain() from boolean to CausedByDrain and updated its implementation.
  • runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/StreamingGroupAlsoByWindowFnsTest.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/StreamingKeyedWorkItemSideInputDoFnRunnerTest.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/StreamingModeExecutionContextTest.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/StreamingSideInputFetcherTest.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/UserParDoFnFactoryTest.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/WindmillKeyedWorkItemTest.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
    • Modified assertions for causedByDrain() to check against CausedByDrain.CAUSED_BY_DRAIN and CausedByDrain.NORMAL.
  • runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/windmill/state/WindmillTagEncodingV1Test.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/windmill/state/WindmillTagEncodingV2Test.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/samza/src/main/java/org/apache/beam/runners/samza/runtime/ClassicBundleManager.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerInternals.TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/samza/src/main/java/org/apache/beam/runners/samza/runtime/PortableBundleManager.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerInternals.TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/samza/src/test/java/org/apache/beam/runners/samza/runtime/KeyedTimerDataTest.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerInternals.TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/samza/src/test/java/org/apache/beam/runners/samza/runtime/SamzaTimerInternalsFactoryTest.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated TimerInternals.TimerData.CausedByDrain.NORMAL to CausedByDrain.NORMAL.
  • runners/spark/src/main/java/org/apache/beam/runners/spark/util/TimerUtils.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Changed the return type of causedByDrain() from boolean to CausedByDrain and updated its implementation.
  • sdks/java/core/src/main/java/org/apache/beam/sdk/values/CausedByDrain.java
    • Added a new top-level enum CausedByDrain with values CAUSED_BY_DRAIN and NORMAL.
  • sdks/java/core/src/main/java/org/apache/beam/sdk/values/OutputBuilder.java
    • Changed the parameter type of setCausedByDrain from boolean to CausedByDrain.
  • sdks/java/core/src/main/java/org/apache/beam/sdk/values/WindowedValue.java
    • Changed the return type of causedByDrain() from boolean to CausedByDrain.
  • sdks/java/core/src/main/java/org/apache/beam/sdk/values/WindowedValues.java
    • Updated the type of the causedByDrain field in Builder from boolean to CausedByDrain and initialized it to CausedByDrain.NORMAL.
    • Changed the parameter type of setCausedByDrain in Builder from boolean to CausedByDrain.
    • Updated the return type of causedByDrain() in Builder from boolean to CausedByDrain.
    • Modified of and valueInGlobalWindow factory methods to use CausedByDrain.NORMAL instead of false.
    • Updated the SimpleWindowedValue constructor and causedByDrain() method to use the new enum type.
    • Adjusted the encode and decode methods within WindowedValueCoder to correctly handle the new CausedByDrain enum type for metadata.
  • sdks/java/core/src/test/java/org/apache/beam/sdk/util/WindowedValueTest.java
    • Added import for org.apache.beam.sdk.values.CausedByDrain.
    • Updated test cases to use CausedByDrain.CAUSED_BY_DRAIN instead of true for causedByDrain values and assertions.
Activity
  • The pull request was opened by stankiewicz with the title "Move CausedByDrain to top level, move types".
  • The description details the core changes: moving CausedByDrain to sdk/core and migrating types in WindowedValue interface and its implementations.
  • The pull request includes standard contribution checklist items and CI status badges for various language tests (Python, Java, Go).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@stankiewicz
Copy link
Contributor Author

r: @kennknowles

@stankiewicz
Copy link
Contributor Author

it's green

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant