So,

If anyone else comes across this problem then a workaround is
available for RepeatedVarCharHolder
not accepting null values.

It involves creating an identical function that uses "VarCharHolder input1"
instead of the Repeated* one.
This function will only be called for non array values and it just passes
the null back.

Can't say I like the approach but it works.

Regards,
 -Stefan

On Tue, Nov 10, 2015 at 1:24 PM, Stefán Baxter <[email protected]>
wrote:

> Hi,
>
> I have a UDF that deals with arrays and concatenates their value. It's
> working fine with JSON but when working with Avro it returns an error.
>
> The error seems a bit misleading as it claims to be bot a schema change
> exception and a missing function exception.
>
> *The error is:*
>
> Error: SYSTEM ERROR: SchemaChangeException: Failure while trying to
> materialize incoming schema.  Errors:
> Error in expression at index -1.  Error: Missing function implementation:
> [listassortedcsv(NULL-OPTIONAL)].  Full expression: --UNKNOWN EXPRESSION--..
>
>
>
> *The function does exist and is declared like this:*
>
> @FunctionTemplate(name = "listAsSortedCSV", scope = 
> FunctionTemplate.FunctionScope.SIMPLE, nulls = 
> FunctionTemplate.NullHandling.NULL_IF_NULL)
>
> public static class listAsSortedCSV implements DrillSimpleFunc {
>
>     @Param
>
>     RepeatedVarCharHolder input1;
>
> *In Avro the field is declared like a union:*
>
> {"name": "categories", "type": ["null",{"type":"array", "items": "string"}]}
>
>
> The data currently only contains null values
>
> I have other functions that deal with null values that work just fine.
>
> Is it possible that the RepeatedVarCharHolder signals "mandatory" values
> or is unable to accept null?
>
> Regards,
>  -Stefan
>
>

Reply via email to