gortiz commented on code in PR #10191:
URL: https://github.com/apache/pinot/pull/10191#discussion_r1132202429


##########
pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/IndexCreator.java:
##########
@@ -0,0 +1,62 @@
+/**
+ * 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.pinot.segment.spi.index;
+
+import java.io.Closeable;
+import java.io.IOException;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+
+/**
+ * The interface used to create indexes.
+ *
+ * The lifecycle for an IndexCreator is to be created, receive one or more 
calls to either
+ * {@link #add(Object, int)} or {@link #add(Object[], int[])} (but not
+ * mix them),
+ * a call to {@link #seal()} and finally be closed. Calls to add cell methods 
must be done in document id order,
+ * starting from the first document id.
+ */
+public interface IndexCreator extends Closeable {
+  /**
+   * Adds the given single value cell to the index.
+   *
+   * Rows will be added in docId order, starting with the one with docId 0.
+   *
+   * @param value The nonnull value of the cell. In case the cell was actually 
null, a default value is received instead
+   * @param dictId An optional dictionary value of the cell. If there is no 
dictionary, -1 is received
+   */
+  void add(@Nonnull Object value, int dictId)
+      throws IOException;
+
+  /**
+   * Adds the given multi value cell to the index
+   *
+   * Rows will be added in docId order, starting with the one with docId 0.
+   *
+   * @param values The nonnull value of the cell. In case the cell was 
actually null, an empty array is received instead
+   * @param dictIds An optional array of dictionary values. If there is no 
dictionary, null is received.
+   */
+  void add(@Nonnull Object[] values, @Nullable int[] dictIds)

Review Comment:
   I know, but here I'm introducing both to be more explicit. Like adding bold 
in a text just to emphasize something. If you think that is problematic I can 
remove it.
   
   I know this is not the place to discuss it, but I have to say that the 
convention is not correct. Or better said, it is partial in the sense that 
tools doesn't know that. We should add `@ParametersAreNonnullByDefault` to all 
packages in order to inform tools that this is our standard. For example with 
that `spotless` or `spotbugs` can detect NPE at compile time. Otherwise they 
require explicit nullability annotations anywhere.



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