xiangfu0 commented on code in PR #17593:
URL: https://github.com/apache/pinot/pull/17593#discussion_r2740782042
##########
pinot-plugins/pinot-input-format/pinot-protobuf/src/main/java/org/apache/pinot/plugin/inputformat/protobuf/ProtoBufRecordExtractor.java:
##########
@@ -68,23 +124,32 @@ private Object getFieldValue(Descriptors.FieldDescriptor
fieldDescriptor, Messag
@Override
public GenericRow extract(Message from, GenericRow to) {
Descriptors.Descriptor descriptor = from.getDescriptorForType();
- if (_extractAll) {
- for (Descriptors.FieldDescriptor fieldDescriptor :
descriptor.getFields()) {
- Object fieldValue = getFieldValue(fieldDescriptor, from);
- if (fieldValue != null) {
- fieldValue = convert(new ProtoBufFieldInfo(fieldValue,
fieldDescriptor));
- }
- to.putValue(fieldDescriptor.getName(), fieldValue);
- }
- } else {
- for (String fieldName : _fields) {
- Descriptors.FieldDescriptor fieldDescriptor =
descriptor.findFieldByName(fieldName);
- Object fieldValue = fieldDescriptor == null ? null :
getFieldValue(fieldDescriptor, from);
+
+ // Initialize or reinitialize cache if descriptor changed (handles schema
evolution)
+ if (_cachedDescriptorFullName == null ||
!_cachedDescriptorFullName.equals(descriptor.getFullName())) {
Review Comment:
from users perspective, you may see mixed versions of the schemas, can you
cache multiple versions?
--
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]