[
https://issues.apache.org/jira/browse/BEAM-12083?focusedWorklogId=575783&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-575783
]
ASF GitHub Bot logged work on BEAM-12083:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 01/Apr/21 22:17
Start Date: 01/Apr/21 22:17
Worklog Time Spent: 10m
Work Description: y1chi commented on a change in pull request #14404:
URL: https://github.com/apache/beam/pull/14404#discussion_r605974661
##########
File path:
sdks/java/testing/nexmark/src/main/java/org/apache/beam/sdk/nexmark/queries/Query13.java
##########
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ */
+package org.apache.beam.sdk.nexmark.queries;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import org.apache.beam.sdk.coders.Coder;
+import org.apache.beam.sdk.coders.CoderException;
+import org.apache.beam.sdk.metrics.Counter;
+import org.apache.beam.sdk.metrics.Metrics;
+import org.apache.beam.sdk.nexmark.NexmarkConfiguration;
+import org.apache.beam.sdk.nexmark.model.Event;
+import org.apache.beam.sdk.transforms.DoFn;
+import org.apache.beam.sdk.transforms.GroupByKey;
+import org.apache.beam.sdk.transforms.ParDo;
+import org.apache.beam.sdk.transforms.Reshuffle.AssignShardFn;
+import org.apache.beam.sdk.values.KV;
+import org.apache.beam.sdk.values.PCollection;
+
+/**
+ * Query "13" PORTABILITY_BATCH (not in original suite).
+ *
+ * <p>This benchmark is created to stress the boundary of runner and SDK in
portability world. The
+ * basic shape of this benchmark is source + GBK + ParDo, in which the GBK
read + ParDo will require
+ * that runner reads from shuffle and connects with SDK to do CPU intensive
computation.
+ */
+@SuppressWarnings({
+ "nullness" // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
+})
+public class Query13 extends NexmarkQueryTransform<Event> {
+ private final NexmarkConfiguration configuration;
+
+ public Query13(NexmarkConfiguration configuration) {
+ super("Query13");
+ this.configuration = configuration;
+ }
+
+ @Override
+ public PCollection<Event> expand(PCollection<Event> events) {
+ final Coder<Event> coder = events.getCoder();
+ return events
+ .apply("Pair with random key", ParDo.of(new
AssignShardFn<>(configuration.numKeyBuckets)))
+ .apply(GroupByKey.create())
+ .apply(
+ "ExpandIterable",
+ ParDo.of(
+ new DoFn<KV<Integer, Iterable<Event>>, Event>() {
+ @ProcessElement
+ public void processElement(
+ @Element KV<Integer, Iterable<Event>> element,
OutputReceiver<Event> r) {
+ for (Event value : element.getValue()) {
+ r.output(value);
+ }
+ }
+ }))
+ // Force round trip through coder.
+ .apply(
+ name + ".Serialize",
+ ParDo.of(
+ new DoFn<Event, Event>() {
+ private final Counter bytesMetric = Metrics.counter(name,
"bytes");
+
+ @ProcessElement
+ public void processElement(ProcessContext c) throws
CoderException, IOException {
+ ByteArrayOutputStream outStream = new
ByteArrayOutputStream();
+ coder.encode(c.element(), outStream, Coder.Context.OUTER);
Review comment:
Do we need this encoding/decoding round trip if the query aims to
benchmark against the SDK/runner boundary?
--
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 575783)
Time Spent: 1h (was: 50m)
> Nexmark Query 13
> ----------------
>
> Key: BEAM-12083
> URL: https://issues.apache.org/jira/browse/BEAM-12083
> Project: Beam
> Issue Type: New Feature
> Components: testing-nexmark
> Reporter: Rui Wang
> Assignee: Rui Wang
> Priority: P2
> Time Spent: 1h
> Remaining Estimate: 0h
>
> In portability world, we expect on workers there are runners and SDKs.
> Current Nexmark queries, e.g. Nexmark Query 0, does not stress the boundary
> between runner and SDK.
> So I propose to have Nexmark query 13, which contains a source + GBK + ParDo,
> to stress the boundary between runner and SDK.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)