yanghua commented on a change in pull request #991: Hudi Test Suite (Refactor) URL: https://github.com/apache/incubator-hudi/pull/991#discussion_r342443764
########## File path: hudi-bench/src/main/java/org/apache/hudi/bench/dag/WorkflowDagGenerator.java ########## @@ -0,0 +1,70 @@ +/* + * 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.hudi.bench.dag; + +import java.util.ArrayList; +import java.util.List; +import org.apache.hudi.bench.configuration.DeltaConfig.Config; +import org.apache.hudi.bench.dag.nodes.DagNode; +import org.apache.hudi.bench.dag.nodes.HiveQueryNode; +import org.apache.hudi.bench.dag.nodes.InsertNode; +import org.apache.hudi.bench.dag.nodes.UpsertNode; +import org.apache.hudi.common.util.collection.Pair; + +public class WorkflowDagGenerator { + + public WorkflowDag build() { + + DagNode root = new InsertNode(Config.newBuilder() + .withNumRecordsToInsert(100) + .withNumInsertPartitions(1) + .withNumTimesToRepeat(2) + .withRecordSize(1000).build()); + + DagNode child1 = new InsertNode(Config.newBuilder() + .withNumRecordsToInsert(100) + .withNumInsertPartitions(1) + .withNumTimesToRepeat(2) + .withRecordSize(1000).build()); + + root.addChildNode(child1); + + DagNode newNode2 = new UpsertNode(Config.newBuilder() + .withNumRecordsToUpdate(100) + .withNumUpsertPartitions(2) + .withNumTimesToRepeat(1) + .withRecordSize(1000).build()); + + // Tests running 2 nodes in parallel + child1.addChildNode(newNode2); + + List<Pair<String, Integer>> queryAndResult = new ArrayList<>(); + queryAndResult.add(Pair.of("select " + "count(*) from testdb1.hive_trips group " + + "by rider having count(*) < 1", 0)); + DagNode queryNode1 = new HiveQueryNode(Config.newBuilder() + .withHiveQueryAndResults(queryAndResult).withHiveLocal(true).build()); + child1.addChildNode(queryNode1); + + List<DagNode> rootNodes = new ArrayList<>(); + rootNodes.add(root); Review comment: Here is a suggestion about the naming of the nodes to make the DAG more clear. For example, we can refactor them with: `root`-> `firstLevel`, `child1` -> `secondLevel`, `child2` -> `thirdLevel1`, `newNode2` -> `thirdLevel2`. Just a example, there may be another way to make the structure more clear. ---------------------------------------------------------------- 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] With regards, Apache Git Services
