-
Notifications
You must be signed in to change notification settings - Fork 30
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
[debezium] Change function signature of EncodeDecimal
#761
Conversation
|
||
// EncodeDecimal is used to encode a [apd.Decimal] to [org.apache.kafka.connect.data.Decimal]. | ||
// The scale of the value (which is the negated exponent of the decimal) is returned as the second argument. | ||
func EncodeDecimal(decimal *apd.Decimal) ([]byte, int32) { |
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.
I chose to use int32
for the scale because that's both what apd.Decimal
uses as well as the wire representation of org.apache.kafka.connect.data.Decimal
.
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.
Make this private?
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.
Unless you are planning to have reader call EncodeDecimal and EncodeDecimalWithScale depending on whether we know the scale or not
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.
Reader is going to call both functions in different places.
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.
Hah your second comment didn't show up for me when I responded!
EncodeDecimal
EncodeDecimal
is only called by Reader in two places, and in one of those places we already have code to determine the scale, which is something we can simplify if we have aapd.Decimal
, so rather than depend on Transfer to parse strings into encodedorg.apache.kafka.connect.data.Decimal
s we'll let Reader handle the parsing toapd.Decimal
and just let Transfer handle the encoding.