raminqaf commented on code in PR #29636:
URL: https://github.com/apache/flink/pull/29636#discussion_r4388743756
##########
flink-core/src/main/java/org/apache/flink/types/variant/BinaryVariant.java:
##########
@@ -341,32 +347,68 @@ private void checkType(Type expected, Type actual) {
// Find the field value whose key is equal to `key`. Return null if the
key is not found.
// It is only legal to call it when `getType()` is `Type.OBJECT`.
private BinaryVariant getFieldByKey(String key) {
- byte[] keyBytes = encodeKey(key);
- return handleObject(
- value,
- pos,
- (size, idSize, offsetSize, idStart, offsetStart, dataStart) ->
{
- int index;
- // Use linear search for a short list. Switch to binary
search when the length
- // reaches `BINARY_SEARCH_THRESHOLD`.
- if (size < BINARY_SEARCH_THRESHOLD) {
- index = findFieldLinear(keyBytes, size, idSize,
idStart);
- } else {
- index = findFieldBinary(keyBytes, size, idSize,
idStart);
- // Objects that earlier Flink versions wrote are
sorted in UTF-16 order
- // instead. Only a miss for a key with a code point
from U+E000 up can be
- // wrong there, see `hasCodePointFromE000`. Such a
miss scans all fields,
- // because an object does not record which order it
uses.
- if (index < 0 && hasCodePointFromE000(keyBytes)) {
- index = findFieldLinear(keyBytes, size, idSize,
idStart);
- }
- }
- if (index < 0) {
- return null;
- }
- int offset = readUnsigned(value, offsetStart + offsetSize
* index, offsetSize);
- return new BinaryVariant(value, metadata, dataStart +
offset);
- });
+ return getFieldByKey(encodeKey(key), null);
Review Comment:
`getFieldByKey` works exactly as it was doing before when the getter is
`null`
--
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]