lowka commented on code in PR #2800:
URL: https://github.com/apache/ignite-3/pull/2800#discussion_r1387920832


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/RowHandler.java:
##########
@@ -104,4 +99,50 @@ interface RowFactory<RowT> {
          */
         RowT create(InternalTuple tuple);
     }
+
+    /**
+     * A builder to create rows. It uses the schema provided by an instance of 
row factory that created it.
+     *
+     * <pre>
+     *     // Create a row builder.
+     *     var rowBuilder = rowFactory.rowBuilder();
+     *     ...
+     *     // Call build() after all fields have been set.
+     *     var row1 = rowBuilder.build();
+     *     // Call reset() to cleanup builder's state.
+     *     rowBuilder.reset();
+     * </pre>
+     */
+    interface RowBuilder<RowT> {
+
+        /**
+         * Adds a field to the current row.
+         *
+         * @param value Field value.
+         * @return this.
+         */
+        RowBuilder<RowT> addField(@Nullable Object value);
+
+        /** Creates a new row from a previously added fields. */
+        RowT build();
+
+        /**
+         * Resets the state of this builder.
+         */
+        void reset();
+
+        /**
+         * Creates a new row and resets the state of this builder. This is a 
shorthand for:
+         * <pre>
+         *     Row row = builder.build();
+         *     builder.reset();
+         *     return row;
+         * </pre>
+         */
+        default RowT buildAndReset() {

Review Comment:
   Most people expect that `build` behaves the way it is implemented. This is 
way there is a separate `reset `method.
   
   



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to