zstan commented on code in PR #1979:
URL: https://github.com/apache/ignite-3/pull/1979#discussion_r1182515298


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/TypeUtils.java:
##########
@@ -275,7 +276,14 @@ private static boolean hasConvertableFields(RelDataType 
resultType) {
         } else if (storageType == Period.class) {
             return (int) ((Period) val).toTotalMonths();
         } else if (storageType == byte[].class) {
-            return new ByteString((byte[]) val);
+            if (val instanceof String) {
+                return new ByteString(((String) 
val).getBytes(StandardCharsets.UTF_8));
+            } else if (val instanceof byte[]) {
+                return new ByteString((byte[]) val);
+            } else {
+                assert val instanceof ByteString : "Expected ByteString but 
got " + val + "<" + val.getClass().getTypeName() + ">";

Review Comment:
   ```suggestion
                   assert val instanceof ByteString : "Expected ByteString but 
got " + val + ", type=" + val.getClass().getTypeName();
   ```



##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/util/TestQueryProcessor.java:
##########
@@ -0,0 +1,81 @@
+/*
+ * 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.util;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.internal.app.IgniteImpl;
+import org.apache.ignite.internal.sql.engine.AsyncSqlCursor;
+import org.apache.ignite.internal.sql.engine.QueryContext;
+import org.apache.ignite.internal.sql.engine.QueryProcessor;
+import org.apache.ignite.internal.sql.engine.property.PropertiesHolder;
+import org.apache.ignite.internal.sql.engine.session.SessionId;
+import org.apache.ignite.internal.sql.engine.session.SessionInfo;
+
+/**
+ * {@link QueryProcessor} that handles test {@link NativeTypeWrapper native 
type wrappers} .
+ */
+public final class TestQueryProcessor implements QueryProcessor {
+
+    private final QueryProcessor queryProcessor;
+
+    public TestQueryProcessor(Ignite ignite) {
+        this.queryProcessor = ((IgniteImpl) ignite).queryEngine();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void start() {
+        queryProcessor.start();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void stop() throws Exception {
+        queryProcessor.stop();
+    }
+
+    @Override
+    public SessionId createSession(PropertiesHolder properties) {
+        return queryProcessor.createSession(properties);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public CompletableFuture<Void> closeSession(SessionId sessionId) {
+        return queryProcessor.closeSession(sessionId);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public List<SessionInfo> liveSessions() {
+        return queryProcessor.liveSessions();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public CompletableFuture<AsyncSqlCursor<List<Object>>> 
querySingleAsync(SessionId sessionId, QueryContext context, String qry,
+            Object... params) {
+
+        Object[] unwrappedParams = 
Arrays.stream(params).map(NativeTypeWrapper::unwrap).toArray();

Review Comment:
   seems unwrappedParams not used anythere ? Why do we need such a wrapper, did 
i miss smth ?



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