clintropolis commented on a change in pull request #12073:
URL: https://github.com/apache/druid/pull/12073#discussion_r783009496
##########
File path:
processing/src/main/java/org/apache/druid/segment/DimensionDictionary.java
##########
@@ -160,4 +173,16 @@ public int getIdForNull()
lock.readLock().unlock();
}
}
+
+ private long getObjectSize(@Nonnull T object)
Review comment:
hmm, this method is presumptuous and breaks the contract of this class
being generic. I think a size estimator function should be passed into this
method, it needs to be public so that callers can override it, or maybe it
should be abstract and some `StringDimensionDictionary` should be implemented
to minimize function calls since its going to be a pretty hot method
##########
File path:
processing/src/main/java/org/apache/druid/query/aggregation/AggregatorAndSize.java
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.aggregation;
+
+/**
+ * Encapsulates an {@link Aggregator} and the initial size in bytes required by
+ * the Aggregator.
+ */
+public class AggregatorAndSize
+{
+
+ // TODO: include default overhead for object sizes
Review comment:
nit: unresolved todo
##########
File path:
processing/src/main/java/org/apache/druid/segment/DimensionIndexer.java
##########
@@ -127,7 +127,7 @@
* @return An array containing an encoded representation of the input row
value.
*/
@Nullable
- EncodedKeyComponentType
processRowValsToUnsortedEncodedKeyComponent(@Nullable Object dimValues, boolean
reportParseExceptions);
+ EncodedDimensionValue<EncodedKeyComponentType>
processRowValsToUnsortedEncodedKeyComponent(@Nullable Object dimValues, boolean
reportParseExceptions);
Review comment:
nit: javadoc params and return type needs updated.. but this isn't
really new, it basically needed updated long ago, it is not always an array 😅
##########
File path:
server/src/main/java/org/apache/druid/segment/realtime/plumber/RealtimePlumber.java
##########
@@ -271,6 +271,7 @@ private Sink getSink(long timestamp)
config.getAppendableIndexSpec(),
config.getMaxRowsInMemory(),
config.getMaxBytesInMemoryOrDefault(),
+ true,
Review comment:
i've noticed a few places that aren't wired up to config are using true,
so using the new behavior with no way out, is that intentional? this one in
particular probably doesn't matter all that much these days (i hope), but i'm
less sure about all of them, and it isn't consistent because i see some hard
coded false in there too
##########
File path:
processing/src/main/java/org/apache/druid/segment/incremental/IncrementalIndex.java
##########
@@ -557,12 +573,17 @@ IncrementalIndexRowResult toIncrementalIndexRow(InputRow
row)
DimensionIndexer indexer = desc.getIndexer();
Object dimsKey = null;
try {
- dimsKey =
indexer.processRowValsToUnsortedEncodedKeyComponent(row.getRaw(dimension),
true);
+ final EncodedDimensionValue<?> encodedDimensionValue
+ =
indexer.processRowValsToUnsortedEncodedKeyComponent(row.getRaw(dimension),
true);
Review comment:
i guess due to the way this refactor was done (compared to aggs) there
is no real way to turn off calculating the estimates, even if we aren't using
them. maybe it doesn't matter if there is no/minimal performance impact
--
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]