[
https://issues.apache.org/jira/browse/HIVE-26505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17790021#comment-17790021
]
Krisztian Kasa commented on HIVE-26505:
---------------------------------------
This is the expression sent by {{PartitionPruner}} to HMS
get_partitions_spec_by_expr
{code}
(true and (cp = '2022-08-23')) is not true
{code}
This removes partition cp = '2022-08-23' from the partitions which should be
scan.
CBO plan
{code}
HiveProject(id=[$0], cp=[$1])
HiveFilter(condition=[IS NOT TRUE(AND(=($0, _UTF-16LE'a'), =($1,
_UTF-16LE'2022-08-23')))])
HiveTableScan(table=[[default, test0831]], table:alias=[test0831])
{code}
Expression
{code}
IS NOT TRUE(AND(=($0, _UTF-16LE'a'), =($1, _UTF-16LE'2022-08-23')))
{code}
is converted to
{code}
GenericUDFOPNotTrue(GenericUDFOPAnd(Const boolean true,
GenericUDFOPEqual(Column[cp], Const string 2022-08-23)))
{code}
in RelOptHiveTable.computePartitionList
https://github.com/apache/hive/blob/f4c4d6b2ec1555abb844b6f348f879719b0a67c3/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/RelOptHiveTable.java#L476-L478
> Case When Some result data is lost when there are common column conditions
> and partitioned column conditions
> -------------------------------------------------------------------------------------------------------------
>
> Key: HIVE-26505
> URL: https://issues.apache.org/jira/browse/HIVE-26505
> Project: Hive
> Issue Type: Bug
> Components: Hive
> Affects Versions: 3.1.0, 4.0.0-alpha-1
> Reporter: GuangMing Lu
> Priority: Critical
> Labels: check, hive-4.0.0-must
>
> {code:java}https://issues.apache.org/jira/browse/HIVE-26505#
> create table test0831 (id string) partitioned by (cp string);
> insert into test0831 values ('a', '2022-08-23'),('c', '2022-08-23'),('d',
> '2022-08-23');
> insert into test0831 values ('a', '2022-08-24'),('b', '2022-08-24');
> select * from test0831;
> +-------------+--------------+
> | test0831.id | test0831.cp |
> +-------------+--------------+
> | a | 2022-08-23 |
> | b | 2022-08-23 |
> | a | 2022-08-23 |
> | c | 2022-08-24 |
> | d | 2022-08-24 |
> +-------------+--------------+
> select * from test0831 where (case when id='a' and cp='2022-08-23' then 1
> else 0 end)=0;
> +--------------+--------------+
> | test0830.id | test0830.cp |
> +--------------+--------------+
> | a | 2022-08-24 |
> | b | 2022-08-24 |
> +--------------+--------------+
> {code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)