This is an automated email from the ASF dual-hosted git repository.

mayanks pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 81504cd  Bug fix: PinotSegmentToAvroConverter does not handle BYTES 
data type. (#5789)
81504cd is described below

commit 81504cdff7c99a0361e8ffde5f598b6be52cc1ff
Author: Mayank Shrivastava <maya...@apache.org>
AuthorDate: Mon Aug 3 17:36:40 2020 -0700

    Bug fix: PinotSegmentToAvroConverter does not handle BYTES data type. 
(#5789)
    
    * `PinotSegmentColumnReader.getValue()` returns `byte[]` for BYTES data 
type. However, GenericRecord
       expects a ByteBuffer, due to which the converter fails.
    
    * There are only two callers for this api, one in 
`PinotSegmentToAvroConverter`, and another in Star Tree builder.
    
    * While we could change the return type to ByteBuffer, it is unclear at 
this time what the future usage would be.
      Based on that, handiling it in `PinotSegmentToAvroConverter.
---
 .../pinot/tools/segment/converter/PinotSegmentToAvroConverter.java   | 5 +++++
 1 file changed, 5 insertions(+)

diff --git 
a/pinot-tools/src/main/java/org/apache/pinot/tools/segment/converter/PinotSegmentToAvroConverter.java
 
b/pinot-tools/src/main/java/org/apache/pinot/tools/segment/converter/PinotSegmentToAvroConverter.java
index fb77382..846302d 100644
--- 
a/pinot-tools/src/main/java/org/apache/pinot/tools/segment/converter/PinotSegmentToAvroConverter.java
+++ 
b/pinot-tools/src/main/java/org/apache/pinot/tools/segment/converter/PinotSegmentToAvroConverter.java
@@ -19,6 +19,7 @@
 package org.apache.pinot.tools.segment.converter;
 
 import java.io.File;
+import java.nio.ByteBuffer;
 import java.util.Arrays;
 import org.apache.avro.Schema;
 import org.apache.avro.file.DataFileWriter;
@@ -60,6 +61,10 @@ public class PinotSegmentToAvroConverter implements 
PinotSegmentConverter {
             if (value instanceof Object[]) {
               record.put(field, Arrays.asList((Object[]) value));
             } else {
+              // PinotSegmentRecordReader returns byte[] instead of ByteBuffer.
+              if (value instanceof byte[]) {
+                value = ByteBuffer.wrap((byte[]) value);
+              }
               record.put(field, value);
             }
           }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to