jaykanakiya commented on code in PR #19410:
URL: https://github.com/apache/druid/pull/19410#discussion_r3202997041


##########
processing/src/main/java/org/apache/druid/segment/column/StringDictionaryEncodedColumnFormat.java:
##########
@@ -0,0 +1,138 @@
+/*
+ * 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.segment.column;
+
+import org.apache.druid.data.input.impl.DimensionSchema;
+import org.apache.druid.data.input.impl.DimensionSchema.MultiValueHandling;
+import org.apache.druid.data.input.impl.NewSpatialDimensionSchema;
+import org.apache.druid.data.input.impl.StringDimensionSchema;
+import org.apache.druid.java.util.common.ISE;
+import org.apache.druid.segment.DimensionHandler;
+import org.apache.druid.segment.StringColumnFormatSpec;
+import org.apache.druid.segment.StringDimensionHandler;
+
+import javax.annotation.Nullable;
+import java.util.Collections;
+
+public class StringDictionaryEncodedColumnFormat implements ColumnFormat
+{
+  private final boolean hasMultipleValues;
+  private final boolean hasNulls;
+  private final boolean hasBitmapIndexes;
+  private final boolean hasSpatialIndexes;
+  @Nullable
+  private final StringColumnFormatSpec columnFormatSpec;
+
+  public StringDictionaryEncodedColumnFormat(
+      boolean hasMultipleValues,
+      boolean hasNulls,
+      boolean hasBitmapIndexes,
+      boolean hasSpatialIndexes,
+      @Nullable StringColumnFormatSpec columnFormatSpec
+  )
+  {
+    this.hasMultipleValues = hasMultipleValues;
+    this.hasNulls = hasNulls;
+    this.hasBitmapIndexes = hasBitmapIndexes;
+    this.hasSpatialIndexes = hasSpatialIndexes;
+    this.columnFormatSpec = columnFormatSpec;
+  }
+
+  @Override
+  public ColumnType getLogicalType()
+  {
+    return ColumnType.STRING;
+  }
+
+  @Override
+  public ColumnCapabilities toColumnCapabilities()
+  {
+    return ColumnCapabilitiesImpl.createDefault()
+                                 .setType(ColumnType.STRING)
+                                 .setDictionaryEncoded(true)
+                                 .setDictionaryValuesSorted(true)
+                                 .setDictionaryValuesUnique(true)
+                                 .setHasMultipleValues(hasMultipleValues)
+                                 .setHasNulls(hasNulls)
+                                 .setHasBitmapIndexes(hasBitmapIndexes)
+                                 .setHasSpatialIndexes(hasSpatialIndexes);
+  }
+
+  @Override
+  public DimensionHandler getColumnHandler(String columnName)
+  {
+    Integer maxStringLength = columnFormatSpec != null ? 
columnFormatSpec.getMaxStringLength() : null;
+    return new StringDimensionHandler(
+        columnName,
+        MultiValueHandling.ofDefault(),

Review Comment:
   Thanks for taking a look @FrankChen021. Updated to derive mvh from 
columnFormatSpec and use default as fallback. 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to