-
Notifications
You must be signed in to change notification settings - Fork 20
Upcast int/float in long/double in sink #220
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
Upcast int/float in long/double in sink #220
Conversation
...ery/src/main/java/com/google/cloud/flink/bigquery/sink/serializer/AvroToProtoSerializer.java
Outdated
Show resolved
Hide resolved
return Long.valueOf(String.valueOf((int) element.getShort(fieldNumber))); | ||
case INTEGER: | ||
return Long.valueOf(String.valueOf(element.getInt(fieldNumber))); | ||
case DATE: | ||
// read in the form of - number of days since EPOCH (Integer) | ||
return element.getInt(fieldNumber); | ||
case BIGINT: | ||
return element.getLong(fieldNumber); | ||
case FLOAT: | ||
return element.getFloat(fieldNumber); | ||
return Double.valueOf(String.valueOf(element.getFloat(fieldNumber))); |
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.
Why are we converting to string then long/double here? Wouldn't this be super inefficient? Why not just cast the values? (long) element.getInt(...)
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.
Fair point. #222 looks good?
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.
Thank you for fixing this so quickly!
Fixes #219
/gcbrun