korlov42 commented on code in PR #1418:
URL: https://github.com/apache/ignite-3/pull/1418#discussion_r1049302902
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/util/QueryChecker.java:
##########
@@ -357,7 +371,7 @@ public void check() {
// Check plan.
QueryProcessor qryProc = getEngine();
- var explainCursors = qryProc.queryAsync("PUBLIC", "EXPLAIN PLAN FOR "
+ qry);
+ var explainCursors = qryProc.queryAsync("PUBLIC", "EXPLAIN PLAN FOR "
+ qry, params);
Review Comment:
I think we should not optimise query with dynamic params in case param
values are not set. Could you please file a ticket to improve this?
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/util/QueryChecker.java:
##########
@@ -276,13 +278,20 @@ public QueryChecker ordered() {
* @return This.
*/
public QueryChecker withParams(Object... params) {
+ // let's interpret null array as simple single null.
+ if (params == null) {
+ params = NULL_AS_VARARG;
+ }
+
this.params = params;
return this;
}
/**
- * Sets returns.
+ * This method add the given row to the list of expected, the order of
enumeration does not matter unless #ordered() is set.
+ *
+ * @param res Array with values one returning tuple. {@code null} array
will be interpreted as single-column-null row,
Review Comment:
```suggestion
* This method add the given row to the list of expected, the order of
enumeration does not matter unless {@link #ordered()} is set.
*
* @param res Array with values one returning tuple. {@code null} array
will be interpreted as single-column-null row.
```
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItDynamicParameterTest.java:
##########
@@ -0,0 +1,165 @@
+/*
+ * 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 static
org.apache.ignite.internal.sql.engine.util.SqlTypeUtils.toSqlType;
+
+import java.math.BigDecimal;
+import java.sql.Date;
+import java.time.LocalDate;
+import org.apache.ignite.internal.sql.engine.util.MetadataMatcher;
+import org.apache.ignite.sql.ColumnType;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+/** Dynamic parameters checks. */
+public class ItDynamicParameterTest extends AbstractBasicIntegrationTest {
+ private static final Object UNSUPPORTED_SIGN = new Object();
+
+ @Test
+ void testMetadataTypesForDynamicParameters() {
+ int i = 1;
+ for (ColumnType type : ColumnType.values()) {
+ Object param = generateValueByType(i++, type);
+ if (param == UNSUPPORTED_SIGN) {
+ continue;
+ }
+
+ assertQuery("SELECT
typeof(?)").withParams(param).returns(toSqlType(type)).check();
+ ;
Review Comment:
extra semicolon
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItDynamicParameterTest.java:
##########
@@ -0,0 +1,165 @@
+/*
+ * 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 static
org.apache.ignite.internal.sql.engine.util.SqlTypeUtils.toSqlType;
+
+import java.math.BigDecimal;
+import java.sql.Date;
+import java.time.LocalDate;
+import org.apache.ignite.internal.sql.engine.util.MetadataMatcher;
+import org.apache.ignite.sql.ColumnType;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+/** Dynamic parameters checks. */
+public class ItDynamicParameterTest extends AbstractBasicIntegrationTest {
+ private static final Object UNSUPPORTED_SIGN = new Object();
+
+ @Test
+ void testMetadataTypesForDynamicParameters() {
+ int i = 1;
+ for (ColumnType type : ColumnType.values()) {
Review Comment:
I would use `@ParameterizedTest` instead of explicit loop
--
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]