You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/03/29 21:24:25 UTC

[GitHub] [beam] ibzib commented on a change in pull request #14263: [BEAM-10943] Enable SqlTransform::registerUdf in ZetaSQL.

ibzib commented on a change in pull request #14263:
URL: https://github.com/apache/beam/pull/14263#discussion_r603623438



##########
File path: sdks/java/extensions/sql/zetasql/src/test/java/org/apache/beam/sdk/extensions/sql/zetasql/ZetaSqlJavaUdfTest.java
##########
@@ -186,6 +188,25 @@ public void testExpectedNullArgument() {
     pipeline.run().waitUntilFinish(Duration.standardMinutes(PIPELINE_EXECUTION_WAITTIME_MINUTES));
   }
 
+  public static class IncrementFn implements BeamSqlUdf {
+    public Long eval(Long i) {
+      return i + 1;
+    }
+  }
+
+  @Test
+  public void testSqlTransformRegisterUdf() {
+    String sql = "SELECT increment(0);";
+    PCollection<Row> stream =
+        pipeline.apply(
+            SqlTransform.query(sql)
+                .withQueryPlannerClass(ZetaSQLQueryPlanner.class)

Review comment:
       Note to self: this test doesn't work because ZetaSQLQueryPlanner does not have BeamJavaUdfCalcRule enabled by default, and we can't pass a ZetaSQLQueryPlanner instance to SqlTransform (only the class itself).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org