Ali Alsuliman created ASTERIXDB-3562:
----------------------------------------
Summary: 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
The subplan variable propagation policy is not aligned with its runtime output
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}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)