Pavel Pereslegin created IGNITE-27635:
-----------------------------------------

             Summary: Sql. Confusing error message when validating an INSERT 
with incorrect number of arguments in the VALUES statement
                 Key: IGNITE-27635
                 URL: https://issues.apache.org/jira/browse/IGNITE-27635
             Project: Ignite
          Issue Type: Bug
          Components: sql ai3
            Reporter: Pavel Pereslegin


Currently the following (incorrect) INSERT statement
{code:sql}
CREATE TABLE test(id INT PRIMARY KEY, val INT);
INSERT INTO test VALUES (1), (2), (3);
{code}

Fails with confusing error
{noformat}
java.lang.IndexOutOfBoundsException: index (1) must be less than size (1)
  at 
com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:1369)
  at 
com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:1351)
  at 
com.google.common.collect.SingletonImmutableList.get(SingletonImmutableList.java:46)
  at 
org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.validateQuery(IgniteSqlValidator.java:248)
  at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateInsert(SqlValidatorImpl.java:5334)
  at 
org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.validateInsert(IgniteSqlValidator.java:236)
{noformat}

Before IGNITE-26634, the error message looked like this:
{noformat}
IGN-SQL-4 Failed to validate query. From line 1, column 13 to line 1, column 
16: Number of INSERT target columns (2) does not equal number of source items 
(1)
{noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to