korlov42 commented on code in PR #2912:
URL: https://github.com/apache/ignite-3/pull/2912#discussion_r1418744516


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/InternalSqlRowSingleString.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * 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.ignite.internal.sql.engine;
+
+import org.apache.ignite.internal.binarytuple.BinaryTupleBuilder;
+import org.apache.ignite.internal.schema.BinaryTuple;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Realization of {@code InternalSqlRow} allowing to represent a SQL row with 
a single string column.
+ */
+public class InternalSqlRowSingleString implements InternalSqlRow {
+    private final String val;
+    private BinaryTuple row;
+
+    /**
+     * Constructor.
+     *
+     * @param string Value for single column row.
+     */
+    public InternalSqlRowSingleString(@Nullable String string) {
+        this.val = string;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    @Nullable

Review Comment:
   according to [our 
guidelines](https://google.github.io/styleguide/javaguide.html#s4.8.5-annotations),
 type-use annotations appear immediately before the annotated type
   
   please check this everywhere in the patch



##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/InternalSqlRowSingleBoolean.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * 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.ignite.internal.sql.engine;
+
+import org.apache.ignite.internal.binarytuple.BinaryTupleBuilder;
+import org.apache.ignite.internal.schema.BinaryTuple;
+
+/**
+ * Realization of {@code InternalSqlRow} allowing to represent a SQL row with 
a single boolean column.

Review Comment:
   ```suggestion
    * Implementation of {@code InternalSqlRow} allowing to represent a SQL row 
with a single boolean column.
   ```



##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/InternalSqlRowSingleString.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * 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.ignite.internal.sql.engine;
+
+import org.apache.ignite.internal.binarytuple.BinaryTupleBuilder;
+import org.apache.ignite.internal.schema.BinaryTuple;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Realization of {@code InternalSqlRow} allowing to represent a SQL row with 
a single string column.

Review Comment:
   ```suggestion
    * Implementation of {@code InternalSqlRow} allowing to represent a SQL row 
with a single string column.
   ```



##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/InternalSqlRowSingleString.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * 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.ignite.internal.sql.engine;
+
+import org.apache.ignite.internal.binarytuple.BinaryTupleBuilder;
+import org.apache.ignite.internal.schema.BinaryTuple;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Realization of {@code InternalSqlRow} allowing to represent a SQL row with 
a single string column.
+ */
+public class InternalSqlRowSingleString implements InternalSqlRow {
+    private final String val;
+    private BinaryTuple row;
+
+    /**
+     * Constructor.
+     *
+     * @param string Value for single column row.
+     */
+    public InternalSqlRowSingleString(@Nullable String string) {
+        this.val = string;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    @Nullable
+    public String get(int idx) {
+        assert idx == 0;
+        return val;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public int fieldCount() {
+        return 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public BinaryTuple asBinaryTuple() {
+        if (row == null) {
+            row = new BinaryTuple(1, new 
BinaryTupleBuilder(1).appendString(val).build());
+        }
+        return row;
+    }

Review Comment:
   ```suggestion
       public BinaryTuple asBinaryTuple() {
           if (row == null) {
               int estimatedSize = val == null ? 0 : val.length();
               boolean exactEstimate = val == null;
   
               row = new BinaryTuple(1, new BinaryTupleBuilder(1, 
estimatedSize, exactEstimate).appendString(val).build());
           }
   
           return row;
       }
   ```



##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ExecutionServiceImpl.java:
##########
@@ -578,19 +586,12 @@ private CompletableFuture<Void> executeFragment(IgniteRel 
treeRoot, ResolvedDepe
             if (!(node instanceof Outbox)) {
                 Function<RowT, RowT> internalTypeConverter = 
TypeUtils.resultTypeConverter(ectx, treeRoot.getRowType());
 
-                AsyncRootNode<RowT, List<Object>> rootNode = new 
AsyncRootNode<>(node, inRow -> {
-                    inRow = internalTypeConverter.apply(inRow);
-
-                    int rowSize = ectx.rowHandler().columnCount(inRow);
-
-                    List<Object> res = new ArrayList<>(rowSize);
-
-                    for (int i = 0; i < rowSize; i++) {
-                        res.add(ectx.rowHandler().get(i, inRow));
-                    }
-
-                    return res;
-                });
+                AsyncRootNode<RowT, InternalSqlRow> rootNode = new 
AsyncRootNode<>(
+                        node,
+                        inRow -> {
+                            inRow = internalTypeConverter.apply(inRow);

Review Comment:
   still, this doesn't feel right. Rows created by RowFactory are supposed to 
work with internal format only. Everything is forking now is because we still 
have ObjectsArrayRowWrapper which can store arbitrary values regardless the 
types.
   
   proper way is to have additional conversion in InternalSqlRowImpl. See 
usages of `org.apache.ignite.internal.sql.engine.util.TypeUtils#fromInternal` 
for example



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

Reply via email to