ihuzenko commented on a change in pull request #1527: DRILL-4456: Add Hive
translate UDF
URL: https://github.com/apache/drill/pull/1527#discussion_r232305628
##########
File path:
contrib/storage-hive/core/src/main/java/org/apache/drill/exec/expr/fn/HiveFunctionRegistry.java
##########
@@ -102,15 +116,15 @@ public void register(DrillOperatorTable operatorTable) {
}
}
- private <C,I> void register(Class<? extends I> clazz,
ArrayListMultimap<String,Class<? extends I>> methods) {
+ private <I> void register(Class<? extends I> clazz,
ArrayListMultimap<String, Class<? extends I>> methods) {
Review comment:
If it's not required to have separate renameUDF(names) method, then it's
possible to simplify body of this method:
```
private <C, I> void register(Class<? extends I> clazz,
ArrayListMultimap<String, Class<? extends I>> methods) {
Description desc = clazz.getAnnotation(Description.class);
Stream<String> names;
if (desc != null) {
names = Stream.of(desc.name().split(",")).map(String::trim);
} else {
names = Stream.of(clazz).map(Class::getName)
.map(name -> name.replace('.', '_'));
}
names.map(String::toLowerCase)
.map(funName -> FUNCTION_REPLACE_MAP.getOrDefault(funName, funName))
.forEach(udfFunName -> methods.put(udfFunName, clazz));
UDFType type = clazz.getAnnotation(UDFType.class);
if (type != null && !type.deterministic()) {
nonDeterministicUDFs.add(clazz);
}
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services