Mihai Budiu created CALCITE-7225:
------------------------------------

             Summary: Comparing ROW values with different lengths causes an 
IndexOutOfBoudsException
                 Key: CALCITE-7225
                 URL: https://issues.apache.org/jira/browse/CALCITE-7225
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.40.0
            Reporter: Mihai Budiu
            Assignee: Mihai Budiu


The following test in SqlValidatorTest causes a crash:

{code:java}
sql("select ROW(1) = ROW(1, 2)").ok();
{code}

stack trace:

{code}
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.calcite.sql.type.InferTypes.lambda$static$1(InferTypes.java:71)
        at 
org.apache.calcite.sql.validate.SqlValidatorImpl.inferUnknownTypes(SqlValidatorImpl.java:2194)
        at 
org.apache.calcite.sql.validate.SqlValidatorImpl.inferUnknownTypes(SqlValidatorImpl.java:2202)
        at 
org.apache.calcite.sql.validate.SqlValidatorImpl.expandSelectItem(SqlValidatorImpl.java:519)
        at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelectList(SqlValidatorImpl.java:5118)
{code}

For reference Postgres gives the following error:

Query Error: unequal number of entries in row expressions



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

Reply via email to