github-advanced-security[bot] commented on code in PR #16068: URL: https://github.com/apache/druid/pull/16068#discussion_r1570539467
########## processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/column/KeyMappingGroupByColumnSelectorStrategy.java: ########## @@ -0,0 +1,230 @@ +/* + * 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.druid.query.groupby.epinephelinae.column; + +import org.apache.druid.query.DimensionComparisonUtils; +import org.apache.druid.query.groupby.ResultRow; +import org.apache.druid.query.groupby.epinephelinae.Grouper; +import org.apache.druid.query.ordering.StringComparator; +import org.apache.druid.segment.ColumnValueSelector; +import org.apache.druid.segment.DimensionHandlerUtils; +import org.apache.druid.segment.column.ColumnType; +import org.apache.druid.segment.column.NullableTypeStrategy; + +import javax.annotation.Nullable; +import javax.annotation.concurrent.NotThreadSafe; +import java.nio.ByteBuffer; + +/** + * Strategy for grouping single value dimensions which can have variable-width objects. Materializing such objects on the buffer + * require an additional step of mapping them to an integer index. The integer index can be materialized on the buffer within + * a fixed width, and is often backed by a dictionary representing the actual dimension object. It is used for arrays, + * and complex types. + * <p> + * The visibility of the class is limited, and the callers must use one of the two variants of the mapping strategy: + * 1. TODO(laksh): PrebuiltDictionaryGroupByColumnSelectorStrategy - (not available, because no one is using it) + * 2. {@link DictionaryBuildingGroupByColumnSelectorStrategy} + * <p> + * {@code null} can be represented by either -1 or the position of null in the dictionary it was stored when it was + * encountered. This is fine, because most of the time, the dictionary id has no value of its own, and is converted back to + * the value it represents, before doing further operations. The only place where it would matter would be when + * {@link DimensionIdCodec#canCompareIds()} is true, and we compare directly on the dictionary ids for prebuilt + * dictionaries (we can't compare ids for the dictionaries built on the fly in the grouping strategy). However, in that case, + * it is guaranteed that the dictionaryId of null represented by the pre-built dictionary would be the lowest (most likely 0) + * and therefore nulls (-1) would be adjacent to nulls (represented by the lowest non-negative dictionary id), and would get + * grouped in the later merge stages. + * <p> + * It only handles single value dimensions, i.e. every type except for strings. Strings are handled by the implementations + * of {@link KeyMappingMultiValueGroupByColumnSelectorStrategy} + * <p> + * It only handles non-primitive types, because numeric primitives are handled by the {@link FixedWidthGroupByColumnSelectorStrategy} + * and the string primitives are handled by the {@link KeyMappingMultiValueGroupByColumnSelectorStrategy} + * + * @param <DimensionType>> Class of the dimension Review Comment: ## Spurious Javadoc @param tags @param tag "<DimensionType>>" does not match any actual type parameter of type "KeyMappingGroupByColumnSelectorStrategy". [Show more details](https://github.com/apache/druid/security/code-scanning/7293) -- 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. To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org