• Varun Gupta's avatar
    MDEV-16057: Using optimization Splitting with Group BY we see an unnecessary attached condition · 724ab9a1
    Varun Gupta authored
                t1.pk IS NOT NULL where pk is a PRIMARY KEY
    
    For equalites in the WHERE clause we create a keyuse array that contains the set of all equalities.
    For each KEYUSE inside the keyuse array we have a field "null_rejecting"
    which tells that the equality will not hold if either the left or right
    hand side of the equality is NULL.
    If the equality is NULL rejecting then we accordingly add a NOT NULL condition for the field present in
    the item val(present in the KEYUSE struct) when we are doing ref access.
    
    For the optimization of splitting with GROUP BY we always set the null_rejecting to TRUE and we are doing ref access on
    the GROUP by field. This does create a problem when the equality is NOT NULL rejecting. This happens in this case as
    in the equality we have the right hand side as t1.pk where pk is a PRIMARY KEY , hence it is NOT NULLABLE. So we should have
    null rejecting set to FALSE for such a case.
    724ab9a1
opt_split.cc 39.2 KB