You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Zoltan Haindrich (Jira)" <ji...@apache.org> on 2019/10/21 12:19:00 UTC

[jira] [Updated] (HIVE-22238) PK/FK selectivity estimation underscales estimations

     [ https://issues.apache.org/jira/browse/HIVE-22238?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zoltan Haindrich updated HIVE-22238:
------------------------------------
    Description: 
at [this point|https://github.com/apache/hive/blob/5098d155a1e6a164253f5fa98755273bc34085df/ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java#L2182] the parent operators rownum is scaled according to pkfkselectivity

however [pkfkselectivity is computed|https://github.com/apache/hive/blob/5098d155a1e6a164253f5fa98755273bc34085df/ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java#L2157] on a whole subtree.

Scaling it by that amount will count in estimation already used when parentstats was calculated...so depending on the number of upstream joins - this may lead to severe underestimations

what happened was:
* optimization was able to push the filter to the other side of the join
* as a result the incoming data was already filtered
* scaling down by the PK selectiviy - was actually already there...but a new "scaling" happened

  was:
at [this point|https://github.com/apache/hive/blob/5098d155a1e6a164253f5fa98755273bc34085df/ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java#L2182] the parent operators rownum is scaled according to pkfkselectivity

however [pkfkselectivity is computed|https://github.com/apache/hive/blob/5098d155a1e6a164253f5fa98755273bc34085df/ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java#L2157] on a whole subtree.

Scaling it by that amount will count in estimation already used when parentstats was calculated...so depending on the number of upstream joins - this may lead to severe underestimations


> PK/FK selectivity estimation underscales estimations
> ----------------------------------------------------
>
>                 Key: HIVE-22238
>                 URL: https://issues.apache.org/jira/browse/HIVE-22238
>             Project: Hive
>          Issue Type: Bug
>          Components: Statistics
>            Reporter: Zoltan Haindrich
>            Assignee: Zoltan Haindrich
>            Priority: Major
>         Attachments: HIVE-22238.01.patch
>
>
> at [this point|https://github.com/apache/hive/blob/5098d155a1e6a164253f5fa98755273bc34085df/ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java#L2182] the parent operators rownum is scaled according to pkfkselectivity
> however [pkfkselectivity is computed|https://github.com/apache/hive/blob/5098d155a1e6a164253f5fa98755273bc34085df/ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java#L2157] on a whole subtree.
> Scaling it by that amount will count in estimation already used when parentstats was calculated...so depending on the number of upstream joins - this may lead to severe underestimations
> what happened was:
> * optimization was able to push the filter to the other side of the join
> * as a result the incoming data was already filtered
> * scaling down by the PK selectiviy - was actually already there...but a new "scaling" happened



--
This message was sent by Atlassian Jira
(v8.3.4#803005)