[ 
https://issues.apache.org/jira/browse/NIFI-4857?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16409799#comment-16409799
 ] 

ASF GitHub Bot commented on NIFI-4857:
--------------------------------------

Github user mattyb149 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2570#discussion_r176482056
  
    --- Diff: 
nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java
 ---
    @@ -609,6 +623,9 @@ private static Object convertToAvroObject(final Object 
rawValue, final Schema fi
                     if (rawValue instanceof byte[]) {
                         return ByteBuffer.wrap((byte[]) rawValue);
                     }
    +                if (rawValue instanceof String) {
    +                    return ByteBuffer.wrap(((String) 
rawValue).getBytes(charset));
    --- End diff --
    
    In the clause above, a byte[] is wrapped in a ByteBuffer as well (that's 
where I got the code from), won't we be returning two different objects in that 
case?


> Record components do not support String <-> byte[] conversions
> --------------------------------------------------------------
>
>                 Key: NIFI-4857
>                 URL: https://issues.apache.org/jira/browse/NIFI-4857
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Matt Burgess
>            Assignee: Matt Burgess
>            Priority: Major
>
> When trying to perform a conversion of a field between a String and a byte 
> array, various errors are reporting (depending on where the conversion is 
> taking place). Here are some examples:
> 1) CSVReader, if a column with String values is specified in the schema as 
> "bytes"
> 2) ConvertRecord, if an input field is of type String and the output field is 
> of type "bytes"
> 3) ConvertRecord, if an input field is of type "bytes" and the output field 
> is of type "String"
> Many/most/all of the record components use utility methods to convert values, 
> I believe these methods need to be updated to support conversion between 
> String and byte[] values.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to