You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by jl...@apache.org on 2020/09/11 17:33:37 UTC
[incubator-pinot] 01/01: Fix extract method in AvroRecordExtractor
This is an automated email from the ASF dual-hosted git repository.
jlli pushed a commit to branch fix-AvroRecordExtractor
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
commit fd1cb00a4f8d0f475e114add27b81d11ef651372
Author: Jack Li(Analytics Engineering) <jl...@jlli-mn1.linkedin.biz>
AuthorDate: Fri Sep 11 10:33:09 2020 -0700
Fix extract method in AvroRecordExtractor
---
.../apache/pinot/plugin/inputformat/avro/AvroRecordExtractor.java | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/pinot-plugins/pinot-input-format/pinot-avro-base/src/main/java/org/apache/pinot/plugin/inputformat/avro/AvroRecordExtractor.java b/pinot-plugins/pinot-input-format/pinot-avro-base/src/main/java/org/apache/pinot/plugin/inputformat/avro/AvroRecordExtractor.java
index 339ab67..05cab34 100644
--- a/pinot-plugins/pinot-input-format/pinot-avro-base/src/main/java/org/apache/pinot/plugin/inputformat/avro/AvroRecordExtractor.java
+++ b/pinot-plugins/pinot-input-format/pinot-avro-base/src/main/java/org/apache/pinot/plugin/inputformat/avro/AvroRecordExtractor.java
@@ -47,13 +47,9 @@ public class AvroRecordExtractor implements RecordExtractor<GenericRecord> {
public GenericRow extract(GenericRecord from, GenericRow to) {
if (_extractAll) {
Map<String, Object> jsonMap = JsonUtils.genericRecordToJson(from);
- jsonMap.forEach((fieldName, value) -> to.putValue(fieldName, AvroUtils.convert(value)));
+ jsonMap.forEach((fieldName, value) -> to.putValue(fieldName, AvroUtils.convert(from.get(fieldName))));
} else {
- for (String fieldName : _fields) {
- Object value = from.get(fieldName);
- Object convertedValue = AvroUtils.convert(value);
- to.putValue(fieldName, convertedValue);
- }
+ _fields.forEach(fieldName -> to.putValue(fieldName, AvroUtils.convert(from.get(fieldName))));
}
return to;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org