robertwb commented on code in PR #29944:
URL: https://github.com/apache/beam/pull/29944#discussion_r1451043565


##########
sdks/typescript/src/apache_beam/transforms/localParDo.ts:
##########
@@ -0,0 +1,285 @@
+/*

Review Comment:
   It looks like this is a copy of parDo, but it's hard to see the diff.



##########
sdks/typescript/src/apache_beam/runners/runner.ts:
##########
@@ -64,21 +64,22 @@ export class PipelineResult {
  * transforms, non-trivial windowing, etc. are used).
  */
 export function createRunner(options: any = {}): Runner {
-  let runnerConstructor: (any) => Runner;
   if (options.runner === undefined || options.runner === "default") {
-    runnerConstructor = defaultRunner;
-  } else if (options.runner === "direct") {
-    runnerConstructor = require("./direct_runner").directRunner;
-  } else if (options.runner === "universal") {
-    runnerConstructor = require("./universal").universalRunner;
-  } else if (options.runner === "flink") {
-    runnerConstructor = require("./flink").flinkRunner;
-  } else if (options.runner === "dataflow") {
-    runnerConstructor = require("./dataflow").dataflowRunner;
-  } else {
-    throw new Error("Unknown runner: " + options.runner);
+    return defaultRunner(options);
   }
-  return runnerConstructor(options);
+  if (options.runner === "direct") {

Review Comment:
   I'm fine with returning directly, but lets keep the elif statements to 
highlight the mutual exclusivity. 



##########
sdks/typescript/test/localParDo.ts:
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { registerLocalParDo } from "../src/apache_beam/serialization";
+import * as beam from "../src/apache_beam";
+import { directRunner } from "../src/apache_beam/runners/direct_runner";
+
+export const log = {
+  exportName: 'log',

Review Comment:
   I assume these must be unique? 



##########
sdks/typescript/test/localParDo.ts:
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { registerLocalParDo } from "../src/apache_beam/serialization";
+import * as beam from "../src/apache_beam";
+import { directRunner } from "../src/apache_beam/runners/direct_runner";
+
+export const log = {
+  exportName: 'log',
+  process: function (lines) {
+    console.log(lines);
+    return lines
+  }
+};
+
+registerLocalParDo(log)

Review Comment:
   I'm not quite following how we ensure this gets called. 



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to