NIFI-14491 Support other types in CreateBoxFileMetadataInstance#9891
NIFI-14491 Support other types in CreateBoxFileMetadataInstance#9891awelless wants to merge 1 commit intoapache:mainfrom
Conversation
0acbf47 to
d9064a4
Compare
d9064a4 to
9dab608
Compare
sfc-gh-rpaulin
left a comment
There was a problem hiding this comment.
This is a good addition @awelless. Provided a few suggestions but this looks like the behavior a user would expect for each of these types.
| final String path = "/" + fieldName; | ||
|
|
||
| if (isNumber(fieldType)) { | ||
| metadata.add(path, record.getAsDouble(fieldName)); |
There was a problem hiding this comment.
Since isNumber is checking up to BigInteger and BigDecimal (arbitrary precision) it's possible that a number larger than double precision will be retrieved. Given box only accepts up to double precision this seems appropriate. Just wanted to make sure we're calling out the preference that we are opting for being more accepting of numbers being rounded or set to positive or negative infinity over throwing an error. Agree with the approach but wanted to call out the design decision.
| "author": "Jones" | ||
| "author": "Jones", | ||
| "int": 1, | ||
| "double": 1.234, |
There was a problem hiding this comment.
Might be good to add a large number to demonstrate we are preferring rounding over erroring when numbers requiring more than 64 bits.
There was a problem hiding this comment.
Good point. Added a value in the test presenting that scenario
9dab608 to
efcaafa
Compare
| } | ||
|
|
||
| private boolean isDate(final RecordFieldType fieldType) { | ||
| return RecordFieldType.DATE.equals(fieldType); |
There was a problem hiding this comment.
| return RecordFieldType.DATE.equals(fieldType); | |
| return RecordFieldType.DATE.equals(fieldType) || RecordFieldType.TIMESTAMP.equals(fieldType); |
There is also a timestamp record type, would this be picked up by date or should it be also added in?
There was a problem hiding this comment.
Box supports dates only. I.e. the time part is 00:00:00.000. I find that treating timestamps as a date is quite risky, as we'll have to drop the time.
If someone wants to put timestamp as a date, they should do the conversion themselves.
efcaafa to
42d4892
Compare
Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com> This closes apache#9891.
Summary
NIFI-14491
Adding support for numeric, date and array types in
CreateBoxFileMetadataInstance.Adding support for date type in
UpdateBoxFileMetadataInstance.Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000NIFI-00000Pull Request Formatting
mainbranchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
mvn clean install -P contrib-checkLicensing
LICENSEandNOTICEfilesDocumentation