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

[feature-#1353][kafka-connector] add value deocder #1371

Merged
merged 4 commits into from
Nov 3, 2022

Conversation

liumengkai
Copy link
Contributor

@liumengkai liumengkai commented Nov 2, 2022

Add value decoder, for the purpose that we only need value

Which issue you fix

#1353

Checklist:

  • I have executed the 'mvn spotless:apply' command to format my code.
  • I have a meaningful commit message (including the issue id, the template of commit message is '[label-type-#issue-id][fixed-module] a meaningful commit message.')
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have checked my code and corrected any misspellings.
  • My commit is only one. (If there are multiple commits, you can use 'git squash' to compress multiple commits into one.)

@FlechazoW FlechazoW linked an issue Nov 3, 2022 that may be closed by this pull request
3 tasks
Comment on lines 83 to 89
if (DEFAULT_CODEC.defaultValue().equals(kafkaConf.getCodec())) {
this.decode = new JsonDecoder();
this.decoder = new JsonDecoder();
} else if (VALUE_CODEC.defaultValue().equals(kafkaConf.getCodec())) {
this.decoder = new ValueDecoder();
} else {
this.decode = new TextDecoder();
this.decoder = new TextDecoder();
}
Copy link
Member

Choose a reason for hiding this comment

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

Is using the 'switch-case' struct better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree . I will make a change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

'flink.configuration.ConfigOption.defaultValue' is not a constant expression. so It can't be written after case.like this

case DEFAULT_CODEC.defaultValue:
    this.decoder = decoder

So I change DEFAULT_CODEC type from flink.configuration.ConfigOption to String

Comment on lines 94 to 100
if (DEFAULT_CODEC.defaultValue().equals(kafkaConf.getCodec())) {
this.decode = new JsonDecoder();
this.decoder = new JsonDecoder();
} else if (VALUE_CODEC.defaultValue().equals(kafkaConf.getCodec())) {
this.decoder = new ValueDecoder();
} else {
this.decode = new TextDecoder();
this.decoder = new TextDecoder();
}
Copy link
Member

Choose a reason for hiding this comment

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

Same as above.

@FlechazoW
Copy link
Member

Nice contribution!

@Paddy0523
Copy link
Contributor

+1

@liumengkai
Copy link
Contributor Author

valueDecoderTest already done!

@liumengkai liumengkai requested review from FlechazoW and removed request for FlechazoW November 3, 2022 07:46
@liumengkai
Copy link
Contributor Author

@FlechazoW already done! cc

Copy link
Member

@FlechazoW FlechazoW left a comment

Choose a reason for hiding this comment

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

+1

@FlechazoW FlechazoW merged commit c9fd382 into DTStack:master Nov 3, 2022
@liumengkai liumengkai deleted the feat-#1353_add_value_decoder branch December 2, 2022 09:26
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.

[Feature][kafka-connector] Does the codec in Kafka play the correct role
3 participants