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

feat(golang): meta string encoding algorithm in golang #1566

Merged
merged 14 commits into from
Apr 27, 2024

Conversation

qingoba
Copy link
Contributor

@qingoba qingoba commented Apr 24, 2024

What does this PR do?

This PR implements meta string encoding described in xlang serialization spec

Related issues

Does this PR introduce any user-facing change?

  • [No] Does this PR introduce any public API change?
  • [No] Does this PR introduce any binary protocol compatibility change?

@qingoba qingoba requested a review from chaokunyang as a code owner April 24, 2024 11:36
@chaokunyang
Copy link
Collaborator

This is great!

CI has some failure, could you rebase main branch?

@qingoba qingoba closed this Apr 24, 2024
@qingoba qingoba reopened this Apr 24, 2024
@qingoba
Copy link
Contributor Author

qingoba commented Apr 24, 2024

Actually I don't know how to restart CI tasks

@qingoba qingoba force-pushed the go-meta-string-dev branch from b6a6fc9 to 2f062b6 Compare April 24, 2024 11:52
@qingoba
Copy link
Contributor Author

qingoba commented Apr 24, 2024

I have rebased main branch, please review this PR.

specialChar1: e.specialChar1,
specialChar2: e.specialChar2,
outputBytes: e.EncodeLowerUpperDigitSpecial(input),
numChars: length,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I removed the needs for numChars/numBits in #1565 , maybe we can simplify the implement a little.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay, I'll read and implement it.

go/fury/meta/meta_string_decoder.go Outdated Show resolved Hide resolved
// Retrieve 5 bits every iteration from data, convert them to characters, and save them to chars
// "abc" encoded as [00000] [000,01] [00010] [0, corresponding to three bytes, which are 0, 68, 0 (68 = 64 + 4)
// In order, take the highest digit first, then the lower
chars := make([]byte, 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @qingoba , first of all thanks for your contribution to Fury.

Could we specify the capacity when initializing chars to avoid the performance degradation caused by slice expansion?

@qingoba qingoba force-pushed the go-meta-string-dev branch from 2f062b6 to 8a62500 Compare April 26, 2024 06:45
Copy link
Collaborator

@chaokunyang chaokunyang left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

"HelloWorld__123.2024": 6,
"MediaContent": 5,
"Apple_banana": 5,
"欲海回狂": 0, // not used
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about replacing it to "你好,世界"

qingoba and others added 2 commits April 26, 2024 15:42
Co-authored-by: Shawn Yang <chaokunyang@apache.org>
Co-authored-by: Shawn Yang <chaokunyang@apache.org>
@chaokunyang
Copy link
Collaborator

@qingoba Ci has some failures. Could you take a look?

"HelloWorld__123.2024": 6,
"MediaContent": 5,
"Apple_banana": 5,
"你好,世界": 0, // not used
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: format

Copy link
Collaborator

Choose a reason for hiding this comment

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

@qingoba Could you use golang format?

"MediaContent": ALL_TO_LOWER_SPECIAL,
"HelloWorld__123.2024": LOWER_UPPER_DIGIT_SPECIAL,
"Apple_banana": FIRST_TO_LOWER_SPECIAL,
"你好,世界": UTF_8,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: format

@chaokunyang chaokunyang merged commit f907f7f into apache:main Apr 27, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants