[ 
https://issues.apache.org/jira/browse/ASTERIXDB-1520?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15414522#comment-15414522
 ] 

Yingyi Bu commented on ASTERIXDB-1520:
--------------------------------------

The query plan displays correctly:

{noformat}
distribute result [%0->$$6]
-- DISTRIBUTE_RESULT  |PARTITIONED|
  exchange
  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
    project ([$$6])
    -- STREAM_PROJECT  |PARTITIONED|
      assign [$$6] <- [function-call: asterix:open-record-constructor, 
Args:[AString: {linenum1}, %0->$$18, AString: {count1}, %0->$$24, AString: 
{t2info}, %0->$$17]]
      -- ASSIGN  |PARTITIONED|
        exchange
        -- SORT_MERGE_EXCHANGE [$$18(ASC) ]  |PARTITIONED|
          order (ASC, %0->$$18) 
          -- STABLE_SORT [$$18(ASC)]  |PARTITIONED|
            exchange
            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
              project ([$$17, $$18, $$24])
              -- STREAM_PROJECT  |PARTITIONED|
                exchange
                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                  group by ([$$30 := %0->$$19]) decor ([%0->$$18; %0->$$24]) {
                            aggregate [$$17] <- [function-call: 
asterix:listify, Args:[function-call: asterix:open-record-constructor, 
Args:[AString: {linenum2}, %0->$$25, AString: {count2}, %0->$$23]]]
                            -- AGGREGATE  |LOCAL|
                              select (function-call: algebricks:not, 
Args:[function-call: algebricks:is-missing, Args:[%0->$$21]])
                              -- STREAM_SELECT  |LOCAL|
                                nested tuple source
                                -- NESTED_TUPLE_SOURCE  |LOCAL|
                         }
                  -- PRE_CLUSTERED_GROUP_BY[$$19]  |PARTITIONED|
                    exchange
                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                      order (ASC, %0->$$19) (ASC, %0->$$25) 
                      -- STABLE_SORT [$$19(ASC), $$25(ASC)]  |PARTITIONED|
                        exchange
                        -- HASH_PARTITION_EXCHANGE [$$19]  |PARTITIONED|
                          select (function-call: algebricks:eq, Args:[%0->$$24, 
%0->$$23])
                          -- STREAM_SELECT  |PARTITIONED|
                            project ([$$18, $$19, $$21, $$23, $$24, $$25])
                            -- STREAM_PROJECT  |PARTITIONED|
                              assign [$$25, $$23] <- [function-call: 
asterix:field-access-by-name, Args:[%0->$$1, AString: {linenum}], 
function-call: asterix:field-access-by-name, Args:[%0->$$1, AString: {count2}]]
                              -- ASSIGN  |PARTITIONED|
                                project ([$$1, $$18, $$19, $$21, $$24])
                                -- STREAM_PROJECT  |PARTITIONED|
                                  exchange
                                  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                    left-outer-unnest-map [$$21, $$1, $$22] <- 
function-call: asterix:index-search, Args:[AString: {Book}, AInt32: {0}, 
AString: {test}, AString: {Book}, ABoolean: {true}, ABoolean: {false}, AInt32: 
{1}, %0->$$35, AInt32: {1}, %0->$$35, TRUE, TRUE, TRUE]
                                    -- BTREE_SEARCH  |PARTITIONED|
                                      exchange
                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                        order (ASC, %0->$$35) 
                                        -- STABLE_SORT [$$35(ASC)]  
|PARTITIONED|
                                          exchange
                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                            project ([$$18, $$19, $$35, $$24])
                                            -- STREAM_PROJECT  |PARTITIONED|
                                              exchange
                                              -- ONE_TO_ONE_EXCHANGE  
|PARTITIONED|
                                                left-outer-unnest-map [$$34, 
$$35] <- function-call: asterix:index-search, Args:[AString: {NumIndex4}, 
AInt32: {0}, AString: {test}, AString: {Book}, ABoolean: {true}, ABoolean: 
{true}, AInt32: {1}, %0->$$24, AInt32: {1}, %0->$$24, TRUE, TRUE, TRUE]
                                                -- BTREE_SEARCH  |PARTITIONED|
                                                  exchange
                                                  -- BROADCAST_EXCHANGE  
|PARTITIONED|
                                                    project ([$$18, $$19, $$24])
                                                    -- STREAM_PROJECT  
|PARTITIONED|
                                                      assign [$$24] <- 
[function-call: asterix:field-access-by-name, Args:[%0->$$0, AString: {count1}]]
                                                      -- ASSIGN  |PARTITIONED|
                                                        select (function-call: 
algebricks:lt, Args:[%0->$$18, AInt64: {10}])
                                                        -- STREAM_SELECT  
|PARTITIONED|
                                                          assign [$$18] <- 
[function-call: asterix:field-access-by-name, Args:[%0->$$0, AString: 
{linenum}]]
                                                          -- ASSIGN  
|PARTITIONED|
                                                            project ([$$0, 
$$19])
                                                            -- STREAM_PROJECT  
|PARTITIONED|
                                                              exchange
                                                              -- 
ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                                                unnest-map 
[$$19, $$0, $$20] <- function-call: asterix:index-search, Args:[AString: 
{Book}, AInt32: {0}, AString: {test}, AString: {Book}, ABoolean: {false}, 
ABoolean: {false}, AInt32: {1}, %0->$$33, AInt32: {1}, %0->$$33, TRUE, TRUE, 
TRUE]
                                                                -- BTREE_SEARCH 
 |PARTITIONED|
                                                                  exchange
                                                                  -- 
ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                                                    order (ASC, 
%0->$$33) 
                                                                    -- 
STABLE_SORT [$$33(ASC)]  |PARTITIONED|
                                                                      exchange
                                                                      -- 
ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                                                        project 
([$$33])
                                                                        -- 
STREAM_PROJECT  |PARTITIONED|
                                                                          
exchange
                                                                          -- 
ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                                                            
unnest-map [$$32, $$33] <- function-call: asterix:index-search, Args:[AString: 
{NumIndex2}, AInt32: {0}, AString: {test}, AString: {Book}, ABoolean: {false}, 
ABoolean: {false}, AInt32: {0}, AInt32: {1}, %0->$$31, TRUE, FALSE, FALSE]
                                                                            -- 
BTREE_SEARCH  |PARTITIONED|
                                                                              
exchange
                                                                              
-- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
                                                                                
assign [$$31] <- [AInt32: {10}]
                                                                                
-- ASSIGN  |PARTITIONED|
                                                                                
  empty-tuple-source
                                                                                
  -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
{noformat}

In the plan,   "-- PRE_CLUSTERED_GROUP_BY[$$19]  |PARTITIONED|" is the physical 
operator for "group by ([$$30 := %0->$$19]) decor ([%0->$$18; %0->$$24])", 
while the rest between the two is a nested subplan inside the logical group-by 
operator.

{noformat}
group by ([$$30 := %0->$$19]) decor ([%0->$$18; %0->$$24]) {
                            aggregate [$$17] <- [function-call: 
asterix:listify, Args:[function-call: asterix:open-record-constructor, 
Args:[AString: {linenum2}, %0->$$25, AString: {count2}, %0->$$23]]]
                            -- AGGREGATE  |LOCAL|
                              select (function-call: algebricks:not, 
Args:[function-call: algebricks:is-missing, Args:[%0->$$21]])
                              -- STREAM_SELECT  |LOCAL|
                                nested tuple source
                                -- NESTED_TUPLE_SOURCE  |LOCAL|
                         }
                  -- PRE_CLUSTERED_GROUP_BY[$$19]  |PARTITIONED|
{noformat}

> Preclustered Group by is displayed incorrectly in the web UI
> ------------------------------------------------------------
>
>                 Key: ASTERIXDB-1520
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-1520
>             Project: Apache AsterixDB
>          Issue Type: Bug
>          Components: Web Interface
>            Reporter: Abdullah Alamoudi
>            Assignee: Yingyi Bu
>            Priority: Critical
>
> To reproduce, uncheck execute query, check show optimized plan and run the 
> following:
> drop dataverse test if exists;
> create dataverse test;
> use dataverse test;
> create type AuxiliaryType as open {
>   id:int32,
>   num:int32
> }
> create type LineType as open {
> }
> create dataset Book(LineType) with meta(AuxiliaryType)
> primary key meta().id;
> create index NumIndex1 on Book(meta().num);
> create index NumIndex2 on Book(linenum:int32) enforced;
> create index NumIndex3 on Book(count1:int32) enforced;
> create index NumIndex4 on Book(count2:int32) enforced;
> for $t1 in dataset Book
> where $t1.linenum < 10
> order by $t1.linenum
> return {
> "linenum1": $t1.linenum,
> "count1":$t1.count1,
> "t2info": for $t2 in dataset Book
>           where $t1.count1 /* +indexnl */= $t2.count2
>           order by $t2.linenum
>           return {"linenum2": $t2.linenum,
>                   "count2":$t2.count2}
> };
> -- PRE_CLUSTERED_GROUP_BY[$$19]  |PARTITIONED|
>                           {
>                             -- AGGREGATE  |LOCAL|
>                               -- STREAM_SELECT  |LOCAL|
>                                 -- NESTED_TUPLE_SOURCE  |LOCAL|
>                           }
> will show incorrectly as:
>                           {
>                             -- AGGREGATE  |LOCAL|
>                               -- STREAM_SELECT  |LOCAL|
>                                 -- NESTED_TUPLE_SOURCE  |LOCAL|
>                           }
> -- PRE_CLUSTERED_GROUP_BY[$$19]  |PARTITIONED|



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to