friendlymatthew commented on PR #7741: URL: https://github.com/apache/arrow-rs/pull/7741#issuecomment-3001685455
Hi, I wanted to get people's thoughts on the current `ObjectBuilder::insert` API design. Right now, calling `insert()` with a duplicate key results in _two_ fields with the same key in the object, which deviates from the Variant spec. We're considering changing this behavior to either return an `Err` on the second `insert()` or to update the existing value-- similar to how `std::HashMap::insert` works. From a user standpoint, I'd prefer the latter approach. However, it's a relatively expensive operation. Since each `insert()` encodes the value directly into the backing buffer, updating a key would require rewriting not just the value for that key, but also everything that comes after it in the buffer. Worst-case, we'd rewrite our entire `fields: BTreeMap<u32, usize>` since all of our value's offsets differed. cc/ @alamb @scovich -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org