-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[feature-#1353][kafka-connector] add value deocder #1371
Conversation
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(); | ||
} |
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.
Is using the 'switch-case' struct better?
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.
agree . I will make a change
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.
'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
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(); | ||
} |
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.
Same as above.
Nice contribution! |
+1 |
valueDecoderTest already done! |
@FlechazoW already done! cc |
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.
+1
Add value decoder, for the purpose that we only need value
Which issue you fix
#1353
Checklist: