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

ASF GitHub Bot logged work on BEAM-10093:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 04/Jun/20 22:48
            Start Date: 04/Jun/20 22:48
    Worklog Time Spent: 10m 
      Work Description: kennknowles commented on a change in pull request 
#11820:
URL: https://github.com/apache/beam/pull/11820#discussion_r435594096



##########
File path: 
sdks/java/testing/nexmark/src/main/java/org/apache/beam/sdk/nexmark/queries/zetasql/ZetaSqlQuery0.java
##########
@@ -0,0 +1,92 @@
+/*
+ * 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.zetasql;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import org.apache.beam.sdk.coders.Coder;
+import org.apache.beam.sdk.extensions.sql.SqlTransform;
+import org.apache.beam.sdk.extensions.sql.zetasql.ZetaSQLQueryPlanner;
+import org.apache.beam.sdk.metrics.Counter;
+import org.apache.beam.sdk.metrics.Metrics;
+import org.apache.beam.sdk.nexmark.model.Bid;
+import org.apache.beam.sdk.nexmark.model.Event;
+import org.apache.beam.sdk.nexmark.model.Event.Type;
+import org.apache.beam.sdk.nexmark.model.sql.SelectEvent;
+import org.apache.beam.sdk.nexmark.queries.NexmarkQueryTransform;
+import org.apache.beam.sdk.nexmark.queries.NexmarkQueryUtil;
+import org.apache.beam.sdk.schemas.transforms.Convert;
+import org.apache.beam.sdk.transforms.DoFn;
+import org.apache.beam.sdk.transforms.Filter;
+import org.apache.beam.sdk.transforms.PTransform;
+import org.apache.beam.sdk.transforms.ParDo;
+import org.apache.beam.sdk.values.PCollection;
+import org.apache.beam.sdk.values.Row;
+
+/**
+ * Query 0: Pass events through unchanged.
+ *
+ * <p>This measures the overhead of the Beam ZetaSql implementation and test 
harness like conversion
+ * from Java model classes to Beam records.
+ *
+ * <p>{@link Bid} events are used here at the moment, ås they are most 
numerous with default
+ * configuration.
+ */
+public class ZetaSqlQuery0 extends NexmarkQueryTransform<Bid> {
+
+  public ZetaSqlQuery0() {
+    super("ZetaSqlQuery0");
+  }
+
+  @Override
+  public PCollection<Bid> expand(PCollection<Event> allEvents) {
+    PCollection<Row> rows =
+        allEvents
+            .apply(Filter.by(NexmarkQueryUtil.IS_BID))
+            .apply(getName() + ".SelectEvent", new SelectEvent(Type.BID));
+
+    return rows.apply(getName() + ".Serialize", 
logBytesMetric(rows.getCoder()))
+        .setRowSchema(rows.getSchema())
+        .apply(
+            SqlTransform.query("SELECT * FROM PCOLLECTION")
+                .withQueryPlannerClass(ZetaSQLQueryPlanner.class))

Review comment:
       Yea fair enough. When I started, I did not know how much things would 
differ. It was suggested that the dialects would not really be compatible, but 
actually they are. I stopped short of a real refactor but I'll go ahead with 
something now that it is working.




----------------------------------------------------------------
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:
us...@infra.apache.org


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

    Worklog Id:     (was: 441567)
    Time Spent: 1h 20m  (was: 1h 10m)

> Add ZetaSQL Nexmark variant
> ---------------------------
>
>                 Key: BEAM-10093
>                 URL: https://issues.apache.org/jira/browse/BEAM-10093
>             Project: Beam
>          Issue Type: New Feature
>          Components: testing-nexmark
>            Reporter: Kenneth Knowles
>            Assignee: Kenneth Knowles
>            Priority: P2
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Most queries will be identical, but best to simply stay decoupled, so this is 
> a copy/paste/modify job.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to