[ https://issues.apache.org/jira/browse/BEAM-5202?focusedWorklogId=151664&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-151664 ]
ASF GitHub Bot logged work on BEAM-5202: ---------------------------------------- Author: ASF GitHub Bot Created on: 05/Oct/18 16:12 Start Date: 05/Oct/18 16:12 Worklog Time Spent: 10m Work Description: amaliujia commented on a change in pull request #6580: [BEAM-5202] register UDF/UDAF with ServiceLoader URL: https://github.com/apache/beam/pull/6580#discussion_r223060787 ########## File path: sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/SqlTransform.java ########## @@ -151,6 +156,35 @@ public static SqlTransform query(String queryString) { .build(); } + /** Load all UDF/UDAF from {@link UdfUdafRegister}. */ + public SqlTransform autoRegisterUdfUdaf() { + List<UdfDefinition> newUdfs = new ArrayList<>(); + List<UdafDefinition> newUdafs = new ArrayList<>(); + + for (UdfUdafRegister ins : + Lists.newArrayList(ServiceLoader.<UdfUdafRegister>load(UdfUdafRegister.class))) { Review comment: `ServiceLoader` implements `Iterable` interface so you don't need to wrap it into a arraylist to do `for each`. ---------------------------------------------------------------- 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: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 151664) Time Spent: 20m (was: 10m) > register UDF/UDAF with ServiceLoader > ------------------------------------ > > Key: BEAM-5202 > URL: https://issues.apache.org/jira/browse/BEAM-5202 > Project: Beam > Issue Type: Improvement > Components: dsl-sql > Reporter: Xu Mingmin > Assignee: Xu Mingmin > Priority: Major > Time Spent: 20m > Remaining Estimate: 0h > > create a ServiceLoader for UDF/UDAF register, if the autoLoad option is set > to TRUE. -- This message was sent by Atlassian JIRA (v7.6.3#76005)