sdimbsn commented on a change in pull request #6235: Druid with Oak supporting 
also plain mode  v04
URL: https://github.com/apache/incubator-druid/pull/6235#discussion_r213232091
 
 

 ##########
 File path: 
processing/src/main/java/io/druid/segment/incremental/OakIncrementalIndex.java
 ##########
 @@ -0,0 +1,569 @@
+/*
+ * 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 io.druid.segment.incremental;
+
+import com.google.common.collect.Iterators;
+import com.google.common.collect.Maps;
+import io.druid.data.input.InputRow;
+import io.druid.data.input.MapBasedRow;
+import io.druid.data.input.Row;
+import io.druid.java.util.common.StringUtils;
+import io.druid.java.util.common.logger.Logger;
+import io.druid.java.util.common.parsers.ParseException;
+import io.druid.query.aggregation.AggregatorFactory;
+import io.druid.query.aggregation.BufferAggregator;
+import io.druid.query.aggregation.PostAggregator;
+import io.druid.segment.ColumnValueSelector;
+
+import java.nio.ByteBuffer;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Function;
+
+import io.druid.segment.DimensionHandler;
+import io.druid.segment.DimensionIndexer;
+import io.druid.segment.column.ColumnCapabilitiesImpl;
+import io.druid.segment.column.ValueType;
+import com.oath.oak.OakMapBuilder;
+import com.oath.oak.OakMap;
+import com.oath.oak.CloseableIterator;
+import com.oath.oak.OakTransformView;
+import sun.misc.VM;
+
+import javax.annotation.Nullable;
+
+
+/**
+ */
+public class OakIncrementalIndex extends 
InternalDataIncrementalIndex<BufferAggregator>
+{
+
+  private static final Logger log = new Logger(OakIncrementalIndex.class);
+
+  // When serializing an object from IncrementalIndexRow.dims, we use:
+  // 1. 4 bytes for representing its type (Double, Float, Long or String)
+  // 2. 8 bytes for saving its value or the array position and length (in the 
case of String)
+  static final Integer ALLOC_PER_DIM = 12;
+  static final Integer NO_DIM = -1;
+  static final Integer TIME_STAMP_INDEX = 0;
+  static final Integer DIMS_LENGTH_INDEX = TIME_STAMP_INDEX + Long.BYTES;
+  static final Integer ROW_INDEX_INDEX = DIMS_LENGTH_INDEX + Integer.BYTES;
+  static final Integer DIMS_INDEX = ROW_INDEX_INDEX + Integer.BYTES;
+  // Serialization and deserialization offsets
+  static final Integer VALUE_TYPE_OFFSET = 0;
+  static final Integer DATA_OFFSET = VALUE_TYPE_OFFSET + Integer.BYTES;
+  static final Integer ARRAY_INDEX_OFFSET = VALUE_TYPE_OFFSET + Integer.BYTES;
+  static final Integer ARRAY_LENGTH_OFFSET = ARRAY_INDEX_OFFSET + 
Integer.BYTES;
+
+  OakMap<IncrementalIndexRow, Row> oak;
+
+  private OffheapAggsManager aggsManager;
+  private AtomicInteger versionCounter; // Only used in Plain mode
+
+  Map<String, String> env = System.getenv();
+
+  OakIncrementalIndex(
+          IncrementalIndexSchema incrementalIndexSchema,
+          boolean deserializeComplexMetrics,
+          boolean reportParseExceptions,
+          boolean concurrentEventAdd,
+          int maxRowCount
+  )
+  {
+    super(incrementalIndexSchema, reportParseExceptions, maxRowCount);
+
+    this.aggsManager = new OffheapAggsManager(incrementalIndexSchema, 
deserializeComplexMetrics,
+            reportParseExceptions, concurrentEventAdd, rowSupplier,
+            columnCapabilities, null, this);
+
+    this.versionCounter = new AtomicInteger(0);
+    IncrementalIndexRow minIncrementalIndexRow = getMinIncrementalIndexRow();
+
+    long maxDirectMemory = VM.maxDirectMemory();
 
 Review comment:
   It may be better to get the capacity in constructor, e.g. instead of 
rowsCount. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org

Reply via email to