Peeyush Gupta created ASTERIXDB-3512:
----------------------------------------

             Summary: Error with query if secondary indexes created
                 Key: ASTERIXDB-3512
                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-3512
             Project: Apache AsterixDB
          Issue Type: Bug
          Components: COMP - Compiler
            Reporter: Peeyush Gupta


Following are the steps to reproduce the issue
 - Create two dataset {{collection1}} and {{collection2}}
 - Create the following index
{code:java}
CREATE INDEX idx1 ON collection2 (date: STRING, oid: STRING, sym: STRING, reg: 
BIGINT); {code}
Execute the following query
{code:java}
with tmp1 AS (
    SELECT S.sym
    FROM  collection1 AS S
    WHERE S.date = NOW_LOCAL('1111-11-11')),
  tmp2 AS (
    SELECT O.sym
    FROM collection2 AS O
    WHERE O.date = NOW_LOCAL('1111-11-11') )
SELECT sl1.sym
FROM tmp1 AS sl1 
UNION ALL
SELECT sl2.sym
FROM tmp2 as sl2;{code}
Results in the following error
{code:java}
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
        at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) 
~[?:?]
        at 
jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) 
~[?:?]
        at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266) 
~[?:?]
        at java.util.Objects.checkIndex(Objects.java:361) ~[?:?]
        at java.util.ArrayList.get(ArrayList.java:427) ~[?:?]
        at 
org.apache.hyracks.algebricks.core.algebra.operators.logical.AggregateOperator.computeOutputTypeEnvironment(AggregateOperator.java:93)
 ~[algebricks-core-7.2.4-7070.jar:7.2.4-7070]
        at 
org.apache.hyracks.algebricks.core.rewriter.base.AlgebricksOptimizationContext.computeAndSetTypeEnvironmentForOperator(AlgebricksOptimizationContext.java:318)
 ~[algebricks-core-7.2.4-7070.jar:7.2.4-7070]
        at 
org.apache.hyracks.algebricks.core.algebra.util.OperatorPropertiesUtil.typeOpRec(OperatorPropertiesUtil.java:253)
 ~[algebricks-core-7.2.4-7070.jar:7.2.4-7070]
        at 
org.apache.hyracks.algebricks.core.algebra.util.OperatorPropertiesUtil.typeOpRec(OperatorPropertiesUtil.java:246)
 ~[algebricks-core-7.2.4-7070.jar:7.2.4-7070]
        at 
org.apache.hyracks.algebricks.core.algebra.util.OperatorPropertiesUtil.typeOpRec(OperatorPropertiesUtil.java:246)
 ~[algebricks-core-7.2.4-7070.jar:7.2.4-7070]
        at 
org.apache.hyracks.algebricks.core.algebra.util.OperatorPropertiesUtil.typeOpRec(OperatorPropertiesUtil.java:246)
 ~[algebricks-core-7.2.4-7070.jar:7.2.4-7070]
        at 
org.apache.hyracks.algebricks.core.algebra.util.OperatorPropertiesUtil.typeOpRec(OperatorPropertiesUtil.java:246)
 ~[algebricks-core-7.2.4-7070.jar:7.2.4-7070]
        at 
org.apache.hyracks.algebricks.core.algebra.util.OperatorPropertiesUtil.typeOpRec(OperatorPropertiesUtil.java:246)
 ~[algebricks-core-7.2.4-7070.jar:7.2.4-7070]
        at 
org.apache.hyracks.algebricks.core.algebra.util.OperatorPropertiesUtil.typeOpRec(OperatorPropertiesUtil.java:246)
 ~[algebricks-core-7.2.4-7070.jar:7.2.4-7070]
        at 
org.apache.asterix.optimizer.rules.am.IntroduceSelectAccessMethodRule.checkAndApplyTheSelectTransformation(IntroduceSelectAccessMethodRule.java:528)
 ~[asterix-algebra-7.2.4-7070.jar:7.2.4-7070]
        at 
org.apache.asterix.optimizer.rules.am.IntroduceSelectAccessMethodRule.checkAndApplyTheSelectTransformation(IntroduceSelectAccessMethodRule.java:405)
 ~[asterix-algebra-7.2.4-7070.jar:7.2.4-7070]
 {code}



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

Reply via email to