[ 
https://issues.apache.org/jira/browse/BEAM-5202?focusedWorklogId=151665&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-151665
 ]

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_r223061999
 
 

 ##########
 File path: 
sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/BeamSqlDslUdfUdafTest.java
 ##########
 @@ -133,6 +137,40 @@ public void testUdf() throws Exception {
     pipeline.run().waitUntilFinish();
   }
 
+  /** test auto-registered UDF/UDAF. */
+  @Test
+  public void testAutoUdfUdaf() throws Exception {
+    Schema resultType =
+        
Schema.builder().addInt32Field("f_int2").addInt32Field("squarecubicsum").build();
+
+    Row row = Row.withSchema(resultType).addValues(0, 4890).build();
+
+    String sql =
+        "SELECT f_int2, squaresum(cubic(f_int)) AS `squarecubicsum`"
+            + " FROM PCOLLECTION GROUP BY f_int2";
+    PCollection<Row> result =
+        boundedInput1.apply("testUdaf", 
SqlTransform.query(sql).autoRegisterUdfUdaf());
+
+    PAssert.that(result).containsInAnyOrder(row);
+    pipeline.run().waitUntilFinish();
+  }
+
+  /** Auto register for test. */
+  @AutoService(UdfUdafRegister.class)
+  public static class UdfUdafRegisterTest implements UdfUdafRegister {
 
 Review comment:
   why `UdfUdafRegisterTest` is a static class without a static 
variable/function? Why to make it static?

----------------------------------------------------------------
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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 151665)
    Time Spent: 0.5h  (was: 20m)

> 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: 0.5h
>  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)

Reply via email to