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

Yingyi Bu commented on ASTERIXDB-1285:
--------------------------------------

[~iabsalyamov],  can you separate the fix as an independent change?

> Introduce index rewrite does not properly handle conjunctive predicates
> -----------------------------------------------------------------------
>
>                 Key: ASTERIXDB-1285
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-1285
>             Project: Apache AsterixDB
>          Issue Type: Bug
>            Reporter: Ildar Absalyamov
>            Assignee: Ildar Absalyamov
>            Priority: Minor
>
> The following query with a conjunctive predicate produces incorrect B-tree 
> search argument
> {noformat}
> drop dataverse tpch if exists;
> create dataverse tpch;
> use dataverse tpch;
> create type OrderType as open {
>   o_orderkey: int32,
>   o_custkey: int32,
>   o_orderstatus: string,
>   o_totalprice: double,
>   o_orderdate: string,
>   o_orderpriority: string,
>   o_clerk: string,
>   o_shippriority: int32,
>   o_comment: string
> }
> create dataset Orders(OrderType) primary key o_orderkey;
> for $o in dataset('Orders')
> where $o.o_orderkey >=int32("0") and $o.o_orderkey < "foo"
> order by $o.o_orderkey
> return $o
> {noformat}
> Incorrect query plan:
> {noformat}
> distribute result [%0->$$0]
> -- DISTRIBUTE_RESULT  |PARTITIONED|
>   exchange 
>   -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
>     project ([$$0])
>     -- STREAM_PROJECT  |PARTITIONED|
>       exchange 
>       -- SORT_MERGE_EXCHANGE [$$10(ASC) ]  |PARTITIONED|
>         unnest-map [$$10, $$0] <- function-call: asterix:index-search, 
> Args:[AString: {Orders}, AInt32: {0}, AString: {tpch}, AString: {Orders}, 
> ABoolean: {false}, ABoolean: {false}, ABoolean: {false}, AInt32: {1}, 
> %0->$$12, AInt32: {1}, %0->$$13, TRUE, FALSE, FALSE]
>         -- BTREE_SEARCH  |PARTITIONED|
>           exchange 
>           -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
>             assign [$$12, $$13] <- [AInt32: {0}, AString: {foo}]
>             -- ASSIGN  |PARTITIONED|
>               empty-tuple-source
>               -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
> {noformat}
> The correct query plan should have created a search argument on the first 
> part of conjunctive predicate and leave selectOp to filter out the second 
> part.
> This happens because introduce index rewrite rule only considers first part 
> of conjunctive predicate to determine the index applicability



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

Reply via email to