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


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/SqlRowHandler.java:
##########
@@ -440,4 +424,54 @@ RowSchema rowSchema() {
             }
         }
     }
+
+    private static class RowBuilderImpl implements RowBuilder<RowWrapper> {
+
+        private final int schemaLen;
+
+        private final RowSchema rowSchema;
+
+        Object[] data;
+
+        int fieldIdx;
+
+        RowBuilderImpl(RowSchema rowSchema) {
+            this.rowSchema = rowSchema;
+            this.schemaLen = rowSchema.fields().size();
+            fieldIdx = 0;
+        }
+
+        /** {@inheritDoc} */
+        @Override
+        public RowBuilder<RowWrapper> newRow() {
+            data = new Object[schemaLen];
+            fieldIdx = 0;
+            return this;
+        }
+
+        /** {@inheritDoc} */
+        @Override
+        public RowBuilder<RowWrapper> addField(Object value) {
+            checkState();
+
+            data[fieldIdx++] = value;
+            return this;
+        }
+
+        /** {@inheritDoc} */
+        @Override
+        public RowWrapper build() {
+            checkState();
+
+            Object[] row = data;
+            data = null;
+            fieldIdx = 0;
+
+            return new ObjectsArrayRowWrapper(rowSchema, row);
+        }
+
+        private void checkState() {
+            assert data != null : "Row has not been initialised";

Review Comment:
   Fixed.



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