harshmotw-db commented on code in PR #59669:
URL: https://github.com/apache/spark/pull/59669#discussion_r4592017809
##########
common/variant/src/main/java/org/apache/spark/types/variant/VariantBuilder.java:
##########
@@ -465,8 +694,13 @@ public void finishWritingObject(int start,
ArrayList<FieldEntry> fields) {
} else {
for (int i = 1; i < size; ++i) {
maxId = Math.max(maxId, fields.get(i).id);
- String key = fields.get(i).key;
- if (key.equals(fields.get(i - 1).key)) {
+ FieldEntry field = fields.get(i);
+ FieldEntry previous = fields.get(i - 1);
+ boolean duplicate = field.key == null ? field.id == previous.id :
+ field.key.equals(previous.key);
+ if (duplicate) {
+ String key = field.key != null ? field.key :
+ new String(field.keyBytes, StandardCharsets.UTF_8);
Review Comment:
Was the previous logic technically incorrect? Like should we not have
assumed that key is always non-null? I'm mainly wondering "why now" and whether
the canonical variant builder is changing precedent in a way that it should not.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]