You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2023/01/19 15:45:18 UTC

[GitHub] [ignite-3] ygerzhedovich commented on a diff in pull request #1528: IGNITE-18422: Sql. Match number of dynamic parameters with given parameters

ygerzhedovich commented on code in PR #1528:
URL: https://github.com/apache/ignite-3/pull/1528#discussion_r1081461103


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/IgniteSqlValidator.java:
##########
@@ -459,15 +459,23 @@ private boolean isSystemFieldName(String alias) {
     /** {@inheritDoc} */
     @Override
     protected void inferUnknownTypes(RelDataType inferredType, SqlValidatorScope scope, SqlNode node) {
-        if (node instanceof SqlDynamicParam && inferredType.equals(unknownType)) {
-            Object param = parameters[((SqlDynamicParam) node).getIndex()];
-            RelDataType type;
-            if (param == null) {
-                type = typeFactory().createSqlType(SqlTypeName.NULL);
+        if (node instanceof SqlDynamicParam) {
+            int index = ((SqlDynamicParam) node).getIndex();
+            if (index >= parameters.length) {
+                throw newValidationError(node, RESOURCE.dynamicParamIllegal());

Review Comment:
   I think we should also throw error in case user pass concrete values more than query has dynamics parameters. And seems it could be done a little bit earlier.



-- 
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-unsubscribe@ignite.apache.org

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