[ 
https://issues.apache.org/jira/browse/ASTERIXDB-3562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ian Maxon updated ASTERIXDB-3562:
---------------------------------
    Labels: triaged  (was: )

> Subplan variable propagation policy not aligned with its runtime
> ----------------------------------------------------------------
>
>                 Key: ASTERIXDB-3562
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-3562
>             Project: Apache AsterixDB
>          Issue Type: Bug
>          Components: COMP - Compiler
>            Reporter: Ali Alsuliman
>            Assignee: Ali Alsuliman
>            Priority: Major
>              Labels: triaged
>
> The subplan output tuple is formed by concatenating the input tuple to the 
> subplan and the subplan's root operator. The subplan's variable propagation 
> policy is expected to do the same thing.
> The subplan variable propagation policy is not aligned with its runtime 
> output tuple causing such a query to fail.
> {code:java}
> CREATE COLLECTION col PRIMARY KEY (id: int);
> SELECT array1[0:1] AS f_1,
>        array1[0:2] AS f_2
> FROM col; {code}
> The plan for the query is:
> {code:java}
> distribute result [$$17]
> -- DISTRIBUTE_RESULT  |PARTITIONED|
>   exchange
>   -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
>     project ([$$17])
>     -- STREAM_PROJECT  |PARTITIONED|
>       assign [$$17] <- [{"f_1": $$14, "f_2": $$16}]
>       -- ASSIGN  |PARTITIONED|
>         project ([$$14, $$16])
>         -- STREAM_PROJECT  |PARTITIONED|
>           subplan {
>                     assign [$$16] <- [array-slice($$20, 0, 2)]
>                     -- ASSIGN  |LOCAL|
>                       nested tuple source
>                       -- NESTED_TUPLE_SOURCE  |LOCAL|
>                  }
>           -- SUBPLAN  |PARTITIONED|
>             subplan {
>                       assign [$$14] <- [array-slice($$20, 0, 1)]
>                       -- ASSIGN  |LOCAL|
>                         nested tuple source
>                         -- NESTED_TUPLE_SOURCE  |LOCAL|
>                    }
>             -- SUBPLAN  |PARTITIONED|
>               project ([$$20])
>               -- STREAM_PROJECT  |PARTITIONED|
>                 assign [$$20] <- [$$collection2.getField("array1")]
>                 -- ASSIGN  |PARTITIONED|
>                   project ([$$collection2])
>                   -- STREAM_PROJECT  |PARTITIONED|
>                     exchange
>                     -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
>                       data-scan []<-[$$18, $$collection2, $$19] <- 
> Default.collection2
>                       -- DATASOURCE_SCAN  |PARTITIONED|
>                         exchange
>                         -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
>                           empty-tuple-source
>                           -- EMPTY_TUPLE_SOURCE  |PARTITIONED| {code}
> The runtime output for the below subplan is ($$20, $$20, $$14) where:
>  * the first $$20 is coming from the project op: project ([$$20]).
>  * the ($$20, $$14) is coming from the root assign op: assign [$$14].
> The variable propagation is also ($$20, $$20, $$14) which is matching:
> {code:java}
>             subplan {
>                       assign [$$14] <- [array-slice($$20, 0, 1)]
>                       -- ASSIGN  |LOCAL|
>                         nested tuple source
>                         -- NESTED_TUPLE_SOURCE  |LOCAL|
>                    }
>             -- SUBPLAN  |PARTITIONED|
>               project ([$$20]) {code}
> The runtime output for the second subplan is ($$20, $$20, $$14, $$20, $$20, 
> $$14, $$16) where:
>  * the first ($$20, $$20, $$14) is coming from the input subplan op.
>  * the ($$20, $$20, $$14, $$16) is coming from the root assign op: assign 
> [$$16].
> However, the variable propagation policy is ($$20, $$14, $$20, $$20, $$14, 
> $$16) which is not matching.
> {code:java}
>           subplan {
>                     assign [$$16] <- [array-slice($$20, 0, 2)]
>                     -- ASSIGN  |LOCAL|
>                       nested tuple source
>                       -- NESTED_TUPLE_SOURCE  |LOCAL|
>                  }
>           -- SUBPLAN  |PARTITIONED|
>             subplan {
>                       assign [$$14] <- [array-slice($$20, 0, 1)]
>                       -- ASSIGN  |LOCAL|
>                         nested tuple source
>                         -- NESTED_TUPLE_SOURCE  |LOCAL|
>                    }
>             -- SUBPLAN  |PARTITIONED|
>               project ([$$20]) {code}
>  
> The duplication in the subplan output tuple is a different issue and should 
> be addressed separately.



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

Reply via email to