Dominik Wosiński created FLINK-23863:
----------------------------------------

             Summary: AVRO Raw types do not match for UDFs
                 Key: FLINK-23863
                 URL: https://issues.apache.org/jira/browse/FLINK-23863
             Project: Flink
          Issue Type: Improvement
          Components: API / DataStream, Table SQL / API
    Affects Versions: 1.13.2
            Reporter: Dominik Wosiński


It seems that for some reason when using UDF, we can't properly use RAW types 
at least for AVRO generated classes. The following code:
```

{color:#bbb529}@FunctionHint{color}(
 input = Array(
 {color:#cc7832}new {color}DataTypeHint(value = 
{color:#6a8759}"RAW"{color}{color:#cc7832}, {color}bridgedTo = 
classOf[TestEnum])
 ){color:#cc7832},
{color} output = {color:#cc7832}new {color}DataTypeHint(value = 
{color:#6a8759}"RAW"{color}{color:#cc7832}, {color}bridgedTo = 
classOf[SecondEnum])
)
{color:#cc7832}class {color}EnumMappingFunction {color:#cc7832}extends 
{color}ScalarFunction {

 {color:#cc7832}def 
{color}{color:#ffc66d}eval{color}({color:#72737a}event{color}: TestEnum): 
SecondEnum = {SecondEnum.{color:#9876aa}ANOTHER_TEST_VALUE{color}}
 }
```

Will result in this rather unhelpful error:
```
Caused by: org.apache.flink.table.api.ValidationException: Invalid argument 
type at position 0. Data type RAW('org.test.TestEnum', '...') expected but 
RAW('org.test.TestEnum', '...') passed.
```
Perhaps it is due to different type serializer that is generated by Flink SQL 
and the `DataTypeHint` ? 

I've created the following minimal reproducible example to make it easier to 
identify the error  https://github.com/Wosin/FlinkRepro.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to