[ 
https://issues.apache.org/jira/browse/HIVE-24666?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17272061#comment-17272061
 ] 

Zhihua Deng edited comment on HIVE-24666 at 1/26/21, 12:05 PM:
---------------------------------------------------------------

{quote}You're not wrong, this patch works for the specific bug you are 
reporting, but introduces deeper plan changes that are not necessary.
{code:java}
FilterExprOrExpr(children: SelectColumnIsTrue(col 4:boolean)(children: 
CastLongToBooleanViaLongToLong(col 2:int) -> 4:boolean), SelectColumnIsTrue(col 
5:boolean)(children: CastStringToBoolean(col 0) -> 5:boolean))
{code}
Would have been correct even without the SelectColumnIsTrue\{quote}

Added a unit test(TestVectorFilterExpressions#testCastFilter) to show that a 
SelectColumnIsTrue is needed for the cast filter, and I will recheck on this.

 


was (Author: dengzh):
 
{quote}You're not wrong, this patch works for the specific bug you are 
reporting, but introduces deeper plan changes that are not necessary.
{code:java}
FilterExprOrExpr(children: SelectColumnIsTrue(col 4:boolean)(children: 
CastLongToBooleanViaLongToLong(col 2:int) -> 4:boolean), SelectColumnIsTrue(col 
5:boolean)(children: CastStringToBoolean(col 0) -> 5:boolean))
{code}
Would have been correct even without the SelectColumnIsTrue
{quote}
{{Added a unit 
test([TestVectorFilterExpressions|https://github.com/apache/hive/pull/1890/files#diff-be207977ebc589f19de15ab322b294334b524846ae6c49aade6b01b82f35b3fc]#testCastFilter)
 to show that a SelectColumnIsTrue is needed for the cast filter, and I will 
recheck on this.}}

> Vectorized UDFToBoolean may unable to filter rows if input is string
> --------------------------------------------------------------------
>
>                 Key: HIVE-24666
>                 URL: https://issues.apache.org/jira/browse/HIVE-24666
>             Project: Hive
>          Issue Type: Bug
>          Components: Vectorization
>            Reporter: Zhihua Deng
>            Assignee: Zhihua Deng
>            Priority: Minor
>              Labels: pull-request-available
>         Attachments: HIVE-24666.2.patch
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> If we use cast boolean in where conditions to filter rows,  in vectorization 
> execution the filter is unable to filter rows,  step to reproduce:
> {code:java}
> create table vtb (key string, value string);
> insert into table vtb values('0', 'val0'), ('false', 'valfalse'),('off', 
> 'valoff'),('no','valno'),('vk', 'valvk');
> select distinct value from vtb where cast(key as boolean); {code}
> It's seems we don't generate a SelectColumnIsTrue to filter the rows if the 
> casted type is string:
>  
> https://github.com/apache/hive/blob/ff6f3565e50148b7bcfbcf19b970379f2bd59290/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java#L2995-L2996



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

Reply via email to