sajjad-moradi commented on a change in pull request #6546: URL: https://github.com/apache/incubator-pinot/pull/6546#discussion_r577250380
########## File path: pinot-tools/src/main/java/org/apache/pinot/tools/data/generator/DataGenerator.java ########## @@ -163,26 +174,75 @@ private FieldSpec buildSpec(DataGeneratorSpec genSpec, String column) { public static void main(String[] args) throws IOException { - final String[] columns = {"column1", "column2", "column3", "column4", "column5"}; + final Map<String, DataType> dataTypes = new HashMap<>(); final Map<String, FieldType> fieldTypes = new HashMap<>(); final Map<String, TimeUnit> timeUnits = new HashMap<>(); final Map<String, Integer> cardinality = new HashMap<>(); final Map<String, IntRange> range = new HashMap<>(); final Map<String, Map<String, Object>> template = new HashMap<>(); - - for (final String col : columns) { - dataTypes.put(col, DataType.INT); - fieldTypes.put(col, FieldType.DIMENSION); - cardinality.put(col, 1000); + Map<String, Double> mvCountMap = new HashMap<>(); + Map<String, Integer> lengthMap = new HashMap<>(); + List<String> columnNames = new ArrayList<>(); + + int cardinalityValue = 5; + int strLength = 5; + + String colName = "colInt"; + dataTypes.put(colName, DataType.INT); Review comment: Apparently this was a test for data generator. Just wanted to add more cases to it. ########## File path: pinot-tools/src/main/java/org/apache/pinot/tools/data/generator/DataGeneratorSpec.java ########## @@ -38,6 +38,8 @@ private final Map<String, Integer> cardinalityMap; private final Map<String, IntRange> rangeMap; private final Map<String, Map<String, Object>> patternMap; + private final Map<String, Double> mvCountMap; // map of column name to average number of values per entry + private final Map<String, Integer> lengthMap; // map of column name to average length of th entry (used for string generator) Review comment: Right. Updated it. ########## File path: pinot-tools/src/main/java/org/apache/pinot/tools/data/generator/MultiValueGeneratorHelper.java ########## @@ -0,0 +1,54 @@ +/** + * 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.pinot.tools.data.generator; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.function.Supplier; + + +/** + * A helper class for generating multi value entries + */ +public class MultiValueGeneratorHelper { + + /** + * Generate MV entries + * + * @param numberOfValuesPerEntry number of values per each row + * @param rand random object + * @param nextItemFunc function to get the next random item + * @return + */ + public static List<Object> generateMultiValueEntries(double numberOfValuesPerEntry, Random rand, + Supplier<Object> nextItemFunc) { + List<Object> entries = new ArrayList<>(); + int i = 0; + for (; i < numberOfValuesPerEntry - 1; i++) { Review comment: I'm using the index `i` in the next statement. I could use `numberOfValuesPerEntry - Math.floor(numberOfValuesPerEntry)` instead of `numberOfValuesPerEntry - i`, but index `i` has exactly that value and we already have it. ---------------------------------------------------------------- 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 --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org