Skip to content
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

[FLINK-13073][table-blink-runtime]BinaryRow in Blink runtime has wrong FIRST_BYTE_ZERO mask #8961

Closed
wants to merge 5 commits into from

Conversation

AjaxXu
Copy link
Contributor

@AjaxXu AjaxXu commented Jul 3, 2019

What is the purpose of the change

Fix FIRST_BYTE_ZERO in BinaryRow which in table-runtime-blink module

Brief change log

  • Fix FIRST_BYTE_ZERO in BinaryRow which in table-runtime-blink module

Verifying this change

  • Added test that validates that FIRST_BYTE_ZERO is worked with 24-55 bit

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (no)
  • The serializers: ( no )
  • The runtime per-record code paths (performance sensitive): ( no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: ( no )
  • The S3 file system connector: (yes / no / don't know)

Documentation

  • Does this pull request introduce a new feature? (no)

@flinkbot
Copy link
Collaborator

flinkbot commented Jul 3, 2019

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.


The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

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

Thanks @AjaxXu for your good catch, LGTM, just left a test comment.

writer.setNullAt(24);
assertTrue(row.anyNull());

writer.setNullAt(55);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is useless, because the previous setNull has allowed anyNull to return to true.
How about add a test:

int numFields = 80;
			for (int i = 0; i < numFields; i++) {
				BinaryRow row = new BinaryRow(80);
				BinaryRowWriter writer = new BinaryRowWriter(row);
				assertFalse(row.anyNull());
				writer.setNullAt(i);
				assertTrue(row.anyNull());
			}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a good advise. I will change it.

Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

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

LGTM +1

Copy link
Member

@wuchong wuchong left a comment

Choose a reason for hiding this comment

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

LGTM.

Merging

wuchong pushed a commit to wuchong/flink that referenced this pull request Jul 3, 2019
@AjaxXu
Copy link
Contributor Author

AjaxXu commented Jul 3, 2019

LGTM.

Merging

Sorry for this pr, I have found a new bug with 0xFFFFFFF0, it's binary sequence is 1111111111111111111111111111111111111111111111111111111111110000. It only have 4 bits of zero, actually it need 8 to skip header. I will fix it later soon.

@@ -55,7 +55,7 @@
public final class BinaryRow extends BinaryFormat implements BaseRow {

public static final boolean LITTLE_ENDIAN = (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN);
private static final long FIRST_BYTE_ZERO = LITTLE_ENDIAN ? 0xFFF0 : 0x0FFF;
private static final long FIRST_BYTE_ZERO = LITTLE_ENDIAN ? 0xFFFFFFFFFFFFFF00L : 0x00FFFFFFFFFFFFFFL;
Copy link
Contributor Author

@AjaxXu AjaxXu Jul 3, 2019

Choose a reason for hiding this comment

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

Actually I want to use ~0xFFL instead. But I'm not sure what the perform in big endian.

Copy link
Contributor

Choose a reason for hiding this comment

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

~0xFFL and ~(0xFFL << 56L)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After test, it seems to that have the same expression with 0xFFFFFFFFFFFFFF00L and 0x00FFFFFFFFFFFFFFL, I am going to use the short expression.

@JingsongLi
Copy link
Contributor

@AjaxXu Good job! Now I think it is ready to be merged.

@AjaxXu
Copy link
Contributor Author

AjaxXu commented Jul 4, 2019

@AjaxXu Good job! Now I think it is ready to be merged.

Thanks you and Jark's review.

wuchong pushed a commit to wuchong/flink that referenced this pull request Jul 4, 2019
wuchong pushed a commit to wuchong/flink that referenced this pull request Jul 4, 2019
@asfgit asfgit closed this in 61119b8 Jul 4, 2019
@AjaxXu AjaxXu deleted the fix_long_mask_bug branch July 24, 2019 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants