-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Drain Mode as WindowedValue extension #34764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@kennknowles ptal. |
Assigning reviewers. If you would like to opt out of this review, comment R: @robertwb for label java. Available commands:
The PR bot will only process comments in the main thread (not review comments). |
@@ -360,7 +387,8 @@ public PaneInfo decode(final InputStream inStream) throws CoderException, IOExce | |||
byte keyAndTag = (byte) inStream.read(); | |||
PaneInfo base = Preconditions.checkNotNull(BYTE_TO_PANE_INFO.get((byte) (keyAndTag & 0x0F))); | |||
long index, onTimeIndex; | |||
switch (Encoding.fromTag(keyAndTag)) { | |||
boolean elementMetadata = (keyAndTag & 0x80) > 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boolean elementMetadata = (keyAndTag & 0x80) > 0; | |
boolean elementMetadata = keyAndTag < 0; |
boolean elementMetadata = (keyAndTag & 0x80) > 0; | ||
switch (Encoding.fromTag((byte) (keyAndTag & 0x7F))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to ignore my codegolfing...
boolean elementMetadata = (keyAndTag & 0x80) > 0; | |
switch (Encoding.fromTag((byte) (keyAndTag & 0x7F))) { | |
boolean elementMetadata = keyAndTag < (keyAndTag &= 0x7f); | |
switch (Encoding.fromTag(keyAndTag) { |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #34764 +/- ##
=========================================
Coverage 56.38% 56.38%
- Complexity 3285 3288 +3
=========================================
Files 1174 1174
Lines 179401 179407 +6
Branches 3398 3399 +1
=========================================
+ Hits 101158 101164 +6
- Misses 74983 74984 +1
+ Partials 3260 3259 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Largely looks good to me. I need to think about the protocol maybe slightly more. We can probably do it incrementally and get started with changes that are benign and not used yet.
One random cleanup issue (which I hit also since I'm doing similar things with WindowedValue but for different extensions) is I wonder if we can flatten all the silly inheritance in the layers of WindowedValue. For performance ultimately all that matters is whether or not we optimize the coder (such as for batch use case with no timestamps or windows we don't bother encoding min timestamp and global window). And for coding it is much better not to have such implementation inheritance that causes all this toil. Plus the anti-pattern of "superclass that just holds fields"
@kennknowles the default object layout on recent JVMs (64 bit, 8 bytes alignment, 12 bytes object header, compressed references and class pointers) leaves 4 bytes of padding in
And for
With default object layout settings the addition of an Compile time annotation processing to produce flat extensions (without a separate extensions container, |
Stating it here so that I remember - we should write a quite 1 pager separate from the DrainMode document about the extended metadata and have a top level thread on dev@. I think more people will be interested if it is something like "Extended per-element metadata proto". It is quite an alarming title that will bring out the performance experts :-) |
Changes:
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
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, commentfixes #<ISSUE NUMBER>
instead.CHANGES.md
with noteworthy changes.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)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.