You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Thomas Rebele (Jira)" <ji...@apache.org> on 2026/01/30 09:55:00 UTC
[jira] [Updated] (HIVE-29424) CBO plans should use histogram statistics for range predicates with a CAST
[ https://issues.apache.org/jira/browse/HIVE-29424?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thomas Rebele updated HIVE-29424:
---------------------------------
Description:
Similar to HIVE-29364: the CBO planner should use the histogram statistics to estimate the selectivity of predicates such as
* {{cast(b as BIGINT) < 6}}
* {{cast(g as timestamp) >= "2020-11-7 00:00:00"}}
* {{cast(g as timestamp) BETWEEN "2020-11-01 00:00:00" AND "2020-11-06 00:00:00"}}
The hint of HIVE-29364 should be taken into account: if the CAST throws away information, the histogram statistics should not be used. E.g., {{{}CAST(128 as TINYINT) = -128{}}}, so a {{CAST(intField as TINYINT) > 42}} should not be treated the same as {{{}intField > 42{}}}, if the intField is outside of the range of TINYINT.
> CBO plans should use histogram statistics for range predicates with a CAST
> --------------------------------------------------------------------------
>
> Key: HIVE-29424
> URL: https://issues.apache.org/jira/browse/HIVE-29424
> Project: Hive
> Issue Type: Improvement
> Reporter: Thomas Rebele
> Assignee: Thomas Rebele
> Priority: Major
>
> Similar to HIVE-29364: the CBO planner should use the histogram statistics to estimate the selectivity of predicates such as
> * {{cast(b as BIGINT) < 6}}
> * {{cast(g as timestamp) >= "2020-11-7 00:00:00"}}
> * {{cast(g as timestamp) BETWEEN "2020-11-01 00:00:00" AND "2020-11-06 00:00:00"}}
> The hint of HIVE-29364 should be taken into account: if the CAST throws away information, the histogram statistics should not be used. E.g., {{{}CAST(128 as TINYINT) = -128{}}}, so a {{CAST(intField as TINYINT) > 42}} should not be treated the same as {{{}intField > 42{}}}, if the intField is outside of the range of TINYINT.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)