apilloud commented on a change in pull request #13759:
URL: https://github.com/apache/beam/pull/13759#discussion_r561506574



##########
File path: 
sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/BeamZetaSqlCalcRel.java
##########
@@ -191,27 +212,95 @@ public void setup() {
       stream = exp.stream();
     }
 
+    @StartBundle
+    public void startBundle() {
+      pending = new HashMap<>();
+      previousRow = null;
+      previousFuture = null;
+    }
+
+    @Override
+    public Duration getAllowedTimestampSkew() {
+      return Duration.millis(Long.MAX_VALUE);
+    }
+
     @ProcessElement
-    public void processElement(ProcessContext c) throws InterruptedException {
-      Map<String, Value> columns = new HashMap<>();
-      Row row = c.element();
-      for (int i : referencedColumns) {
-        columns.put(
-            columnName(i),
-            ZetaSqlBeamTranslationUtils.toZetaSqlValue(
-                row.getBaseValue(i, Object.class), 
inputSchema.getField(i).getType()));
+    public void processElement(
+        @Element Row row, @Timestamp Instant t, BoundedWindow w, 
OutputReceiver<Row> r)
+        throws InterruptedException {
+      final Future<Value> vf;
+
+      if (row.equals(previousRow)) {

Review comment:
       Oops, this should be set at the end of this if block. This is to 
mitigate the negative performance impact of adding `BoundedWindow` as an 
argument to `processElement`. When this argument is present, `processElement` 
will potentially be called multiple times with the same row and different 
windows. See: 
https://github.com/apache/beam/blob/3bb232fb098700de408f574585dfe74bbaff7230/runners/core-java/src/main/java/org/apache/beam/runners/core/SimpleDoFnRunner.java#L187




----------------------------------------------------------------
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:
[email protected]


Reply via email to