By reading this it's unclear what are `eval` udfs vs `serialize` udfs, add 
comments. And I would probably just call these methods `getBeamSqlUdfs()` and 
`getSerializableFunctionUdfs()` to avoid inventing another name for these 
things.

Another approach that I can think of (don't know if it's better or not) to make 
it a bit more extensible is to use `TypeDescriptor`-style type specification:

```
udfs = ImmutableMap.builder()
   .put(BeamSqlUdf.class, new HashMap<String, BeamSqlUdf>())
   .put(SerializableFunction.class, new HashMap<String, SerializableFunction<?, 
?>>)
   .build();

public <T> Map<String, T> getUdf(TypeDescriptor<T> udfTypeDescriptor) {
   udfType = // get udf class from udfTypeDescriptor
   return udfs.get(udfType);
}

```

I imagine the usage will be like: `register.getUdfs(new 
TypeDescriptor<BeamSqlUdf>> {})`.

And I wonder wether it will be useful to have methods like 
`register.getUdf(String name, TypeDescriptor udfType);`

[ Full content available at: https://github.com/apache/beam/pull/6580 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to