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

Gopal V updated HIVE-21781:
---------------------------
    Summary: Optimizer: Constant folding without CBO skips the aggregates  
(was: Vectorization: Incomplete vectorization of "or false" with CBO off)

> Optimizer: Constant folding without CBO skips the aggregates
> ------------------------------------------------------------
>
>                 Key: HIVE-21781
>                 URL: https://issues.apache.org/jira/browse/HIVE-21781
>             Project: Hive
>          Issue Type: Bug
>          Components: Logical Optimizer
>            Reporter: Gopal V
>            Priority: Major
>
> {code}
> create temporary table foo (x int) ;
> insert into foo values(1),(2),(3),(4),(5);
> set hive.explain.user=false;
> explain vectorization detail select count(case when (x=1 or false) then 1 
> else 0 end ) from foo
> {code}
> {code}
> |                     Group By Operator              |
> |                       aggregations: count(CASE WHEN (((x = 1) or false)) 
> THEN (1) ELSE (0) END) |
> |                       Group By Vectorization:      |
> |                           aggregators: 
> VectorUDAFCount(IfExprLongScalarLongScalar(col 3:boolean, val 1, val 
> 0)(children: VectorUDFAdaptor(((x = 1) or false))(children: 
> LongColEqualLongScalar(col 0:int, val 1) -> 2:boolean) -> 3:boolean) -> 
> 4:int) -> bigint |
> |                           className: VectorGroupByOperator |
> {code}
> The pass-through Calcite fixes this.
> {code}
> | OPTIMIZED SQL: SELECT COUNT(CASE WHEN `x` = 1 THEN 1 ELSE 0 END) AS `$f0` |
> | FROM `default`.`foo`     
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to