GitHub user zuyu opened a pull request:

    https://github.com/apache/incubator-quickstep/pull/271

    QUICKSTEP-95: Fixed the exception due to zero tuple estimation for th…

    …e empty project expression.
    
    The problem is that 
[tuple_slot_bytes_](https://github.com/apache/incubator-quickstep/blob/master/storage/SplitRowStoreTupleStorageSubBlock.cpp#L128)
 is ZERO if the project expression is empty, and 
[later](https://github.com/apache/incubator-quickstep/blob/master/storage/SplitRowStoreTupleStorageSubBlock.cpp#L142)
 results in a divide-by-zero exception.
    
    It is easy to reproduce:
    
    ```
    $ create table r (a int, b char(20));
    $ insert into r values(1, 'madison');
    $ create table s (a int, c float);
    $ select s.a from r, s where r.a > 0;
    ```
    
    ```
    I0619 18:26:45.097215 1944100864 PhysicalGenerator.cpp:196] Optimized 
physical plan:
    TopLevelPlan
    +-plan=NestedLoopsJoin
    | +-left=Selection
    | | +-input=TableReference[relation=r]
    | | | +-AttributeReference[id=0,name=a,relation=r,type=Int]
    | | | +-AttributeReference[id=1,name=b,relation=r,type=Char(20)]
    | | +-filter_predicate=Greater
    | | | +-AttributeReference[id=0,name=a,relation=r,type=Int]
    | | | +-Literal[value=0,type=Int]
    | | +-project_expressions=
    | |   +-[]
    | +-right=TableReference[relation=s]
    | | +-AttributeReference[id=2,name=a,relation=s,type=Int]
    | | +-AttributeReference[id=3,name=c,relation=s,type=Float]
    | +-join_predicate=Literal[value=true]
    | +-project_expressions=
    |   +-AttributeReference[id=2,name=a,relation=s,type=Int]
    +-output_attributes=
      +-AttributeReference[id=2,name=a,relation=s,type=Int]
    ```
    
    Floating point exception: 8

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/zuyu/incubator-quickstep quickstep-95

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-quickstep/pull/271.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #271
    
----
commit 6ced931251f76e977ab1bae94e91bb75103e26c4
Author: Zuyu Zhang <zu...@apache.org>
Date:   2017-06-19T20:53:52Z

    QUICKSTEP-95: Fixed the exception due to zero tuple estimation for the 
empty project expression.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to