clintropolis commented on a change in pull request #12250:
URL: https://github.com/apache/druid/pull/12250#discussion_r803244872



##########
File path: 
processing/src/main/java/org/apache/druid/segment/DimensionHandler.java
##########
@@ -116,6 +116,7 @@ DimensionMergerV9 makeMerger(
       IndexSpec indexSpec,
       SegmentWriteOutMedium segmentWriteOutMedium,
       ColumnCapabilities capabilities,
+      boolean shouldStore,

Review comment:
       nit: wondering if maybe this should be on `IndexSpec` or if it needs 
passed in at all and `IndexMergerV9` could just choose to skip or not based on 
the setting, instead of passed separately to each dimension handler/dimension 
merger, unless it would be useful to be configurable per column?
   
   this way seems fine too though

##########
File path: 
processing/src/main/java/org/apache/druid/segment/column/BitmapIndexes.java
##########
@@ -0,0 +1,105 @@
+/*
+ * 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 com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import org.apache.druid.collections.bitmap.BitmapFactory;
+import org.apache.druid.collections.bitmap.ImmutableBitmap;
+import org.apache.druid.common.config.NullHandling;
+import org.apache.druid.segment.serde.StringBitmapIndexColumnPartSupplier;
+
+import javax.annotation.Nullable;
+import java.util.function.IntSupplier;
+
+public final class BitmapIndexes
+{
+  /**
+   * Returns a bitmapIndex for null-only columns.
+   *
+   * @param rowCountSupplier a supplier that returns the row count of the 
segment that the column belongs to.
+   *                         Getting from the supplier the row count can be 
expensive and thus should be
+   *                         evaluated lazily.
+   * @param bitmapFactory    a bitmapFactory to create a bitmapIndex.
+   */
+  public static BitmapIndex forNullOnlyColumn(IntSupplier rowCountSupplier, 
BitmapFactory bitmapFactory)

Review comment:
       nit maybe `forNilColumn` to be more consistent naming with selectors

##########
File path: 
processing/src/main/java/org/apache/druid/segment/serde/StringBitmapIndexColumnPartSupplier.java
##########
@@ -34,8 +35,8 @@
 public class StringBitmapIndexColumnPartSupplier implements 
Supplier<BitmapIndex>
 {
   private final BitmapFactory bitmapFactory;
-  private final GenericIndexed<ImmutableBitmap> bitmaps;
-  private final GenericIndexed<String> dictionary;
+  private final CloseableIndexed<ImmutableBitmap> bitmaps;
+  private final CloseableIndexed<String> dictionary;

Review comment:
       is there any reason to make these a less specific type? (want to avoid 
anything funny happening performance wise in jvm since this code area is pretty 
hot)

##########
File path: 
indexing-service/src/main/java/org/apache/druid/indexing/common/task/AppenderatorDriverRealtimeIndexTask.java
##########
@@ -781,7 +781,8 @@ private Appenderator newAppenderator(
         toolbox.getCachePopulatorStats(),
         rowIngestionMeters,
         parseExceptionHandler,
-        isUseMaxMemoryEstimates()
+        isUseMaxMemoryEstimates(),
+        getContextValue(Tasks.STORE_EMPTY_COLUMNS_KEY, 
toolbox.getConfig().isStoreEmptyColumns())

Review comment:
       nit format (also a handful of other places, intellij probably did you 
dirty in a refactor)

##########
File path: 
processing/src/main/java/org/apache/druid/segment/serde/ColumnPartSerde.java
##########
@@ -39,13 +41,23 @@
     @JsonSubTypes.Type(name = "floatV2", value = 
FloatNumericColumnPartSerdeV2.class),
     @JsonSubTypes.Type(name = "longV2", value = 
LongNumericColumnPartSerdeV2.class),
     @JsonSubTypes.Type(name = "doubleV2", value = 
DoubleNumericColumnPartSerdeV2.class),
+    @JsonSubTypes.Type(name = "null", value = NullColumnPartSerde.class)
 })
 public interface ColumnPartSerde
 {
   @Nullable
   Serializer getSerializer();
 
-  Deserializer getDeserializer();
+  /**
+   * Returns a Deserializer to read a column from a segment.
+   *
+   * @param rowCountSupplier          a supplier that returns the row count of 
the segment that the column belongs to.
+   *                                  Getting from the supplier the row count 
can be expensive and thus should be
+   *                                  evaluated lazily.
+   * @param segmentBitmapSerdeFactory bitmapSerdeFactory stored in the 
segment. Each columnPartSerde may have their own
+   *                                  bitmapSerdeFactory.
+   */
+  Deserializer getDeserializer(IntSupplier rowCountSupplier, 
BitmapSerdeFactory segmentBitmapSerdeFactory);

Review comment:
       hmm, this seems a bit strange of a change
   
   In most implementations, i think these things are basically part of the 
`ColumnPartSerde` when it is created (and the bitmap serde factory is shared 
across all columns via the index spec), why is it passed into creating the 
deserializer?




-- 
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