sajjad-moradi commented on code in PR #9642:
URL: https://github.com/apache/pinot/pull/9642#discussion_r1017191867


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/recordtransformer/DataTypeTransformer.java:
##########
@@ -92,6 +92,13 @@ public GenericRow transform(GenericRow record) {
           // Single-value column
           source = PinotDataType.getSingleValueType(value.getClass());
         }
+
+        if (source == PinotDataType.BYTES && dest == PinotDataType.STRING && 
value instanceof byte[]) {

Review Comment:
   Without the provided solution, a Fixed type cannot be converted to byte[]. 
Currently if the input is of type Fixed and the corresponding pinot column is 
of type BYTES, we get the following exception in `DataTypeTransformer`:
   ```
   java.lang.RuntimeException: Caught exception while transforming data type 
for column: bytesColumn
        at 
org.apache.pinot.segment.local.recordtransformer.DataTypeTransformer.transform(DataTypeTransformer.java:118)
        at 
org.apache.pinot.segment.local.recordtransformer.CompositeTransformer.transform(CompositeTransformer.java:90)
        at 
org.apache.pinot.segment.local.segment.creator.TransformPipeline.processPlainRow(TransformPipeline.java:97)
        at 
org.apache.pinot.segment.local.segment.creator.TransformPipeline.processRow(TransformPipeline.java:92)
        at 
org.apache.pinot.core.data.manager.realtime.LLRealtimeSegmentDataManager.processStreamEvents(LLRealtimeSegmentDataManager.java:554)
        at 
org.apache.pinot.core.data.manager.realtime.LLRealtimeSegmentDataManager.consumeLoop(LLRealtimeSegmentDataManager.java:429)
        at 
org.apache.pinot.core.data.manager.realtime.LLRealtimeSegmentDataManager$PartitionConsumer.run(LLRealtimeSegmentDataManager.java:622)
        at java.base/java.lang.Thread.run(Thread.java:829)
   Caused by: java.lang.IllegalArgumentException: Value: [0, 1, 2, 3] is not 
Hex encoded
        at org.apache.pinot.spi.utils.BytesUtils.toBytes(BytesUtils.java:39)
        at 
org.apache.pinot.common.utils.PinotDataType$11.toBytes(PinotDataType.java:646)
        at 
org.apache.pinot.common.utils.PinotDataType$13.convert(PinotDataType.java:762)
        at 
org.apache.pinot.segment.local.recordtransformer.DataTypeTransformer.transform(DataTypeTransformer.java:112)
        ... 7 more
   Caused by: org.apache.commons.codec.DecoderException: Illegal hexadecimal 
character [ at index 0
        at org.apache.commons.codec.binary.Hex.toDigit(Hex.java:369)
        at org.apache.commons.codec.binary.Hex.decodeHex(Hex.java:107)
        at org.apache.commons.codec.binary.Hex.decodeHex(Hex.java:77)
        at org.apache.pinot.spi.utils.BytesUtils.toBytes(BytesUtils.java:37)
        ... 10 more
   java.lang.RuntimeException: Caught exception while transforming data type 
for column: bytesColumn
        at 
org.apache.pinot.segment.local.recordtransformer.DataTypeTransformer.transform(DataTypeTransformer.java:118)
        at 
org.apache.pinot.segment.local.recordtransformer.CompositeTransformer.transform(CompositeTransformer.java:90)
        at 
org.apache.pinot.segment.local.segment.creator.TransformPipeline.processPlainRow(TransformPipeline.java:97)
        at 
org.apache.pinot.segment.local.segment.creator.TransformPipeline.processRow(TransformPipeline.java:92)
        at 
org.apache.pinot.core.data.manager.realtime.LLRealtimeSegmentDataManager.processStreamEvents(LLRealtimeSegmentDataManager.java:554)
        at 
org.apache.pinot.core.data.manager.realtime.LLRealtimeSegmentDataManager.consumeLoop(LLRealtimeSegmentDataManager.java:429)
        at 
org.apache.pinot.core.data.manager.realtime.LLRealtimeSegmentDataManager$PartitionConsumer.run(LLRealtimeSegmentDataManager.java:622)
        at java.base/java.lang.Thread.run(Thread.java:829)
   Caused by: java.lang.IllegalArgumentException: Value: [0, 1, 2, 3] is not 
Hex encoded
        at org.apache.pinot.spi.utils.BytesUtils.toBytes(BytesUtils.java:39)
        at 
org.apache.pinot.common.utils.PinotDataType$11.toBytes(PinotDataType.java:646)
        at 
org.apache.pinot.common.utils.PinotDataType$13.convert(PinotDataType.java:762)
        at 
org.apache.pinot.segment.local.recordtransformer.DataTypeTransformer.transform(DataTypeTransformer.java:112)
        ... 7 more
   Caused by: org.apache.commons.codec.DecoderException: Illegal hexadecimal 
character [ at index 0
        at org.apache.commons.codec.binary.Hex.toDigit(Hex.java:369)
        at org.apache.commons.codec.binary.Hex.decodeHex(Hex.java:107)
        at org.apache.commons.codec.binary.Hex.decodeHex(Hex.java:77)
        at org.apache.pinot.spi.utils.BytesUtils.toBytes(BytesUtils.java:37)
        ... 10 more



-- 
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]

Reply via email to