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

Ivan Leskin updated HAWQ-1617:
------------------------------
    Description: 
When accessing external tables, the pushdown feature sometimes works incorrect. 
Consider the following query:

{{SELECT * FROM table_ex WHERE bool1=false AND id1=60003;}}

When this query is executed, we get an error "stack is not empty ...".

But what actually happens?

It turns out that such query is "translated" into a list of three items, which 
represents the constraints: 'BoolExpr', 'Var' and 'OpExpr' (this represents a 
constraint "WHERE NOT(bool1 = true) AND (id1 = 60003)"). Note that the list 
does not contain implicit AND operators.

Then, the list is processed by a piece of code in [pxffilters.c, where there is 
a check of presence of 
'BoolExpr's|[https://github.com/arenadata/incubator-hawq/blob/master/src/backend/access/external/pxffilters.c#L1259].]
 If 'BoolExpr's are detected, no implicit AND operators are added.

In the case described, one 'BoolExpr' element is present, and no implicit AND 
operators are added. This leads to the error mentioned above.

  was:
When accessing external tables, the pushdown feature sometimes works incorrect. 
Consider the following query:

{{SELECT * FROM table_ex WHERE bool1=false AND id1=60003;}}

When this query is executed, we get an error "stack is not empty ...".

What happens behind the curtains?

It turns out that such query is "translated" into a list of three items, which 
represents the constraints: 'BoolExpr', 'Var' and 'OpExpr' (this represents a 
constraint "WHERE NOT(bool1 = true) AND (id1 = 60003)"). Note that the list 
does not contain implicit AND operators.

Then, the list is processed by a piece of code in [pxffilters.c, where there is 
a check of presence of 
'BoolExpr's|[https://github.com/arenadata/incubator-hawq/blob/master/src/backend/access/external/pxffilters.c#L1259].]
 If 'BoolExpr's are detected, no implicit AND operators are added.

In the case described, one 'BoolExpr' element is present, and no implicit AND 
operators are added. This leads to the error mentioned above.


> Incorrect processing of boolean operators in pushdown
> -----------------------------------------------------
>
>                 Key: HAWQ-1617
>                 URL: https://issues.apache.org/jira/browse/HAWQ-1617
>             Project: Apache HAWQ
>          Issue Type: Bug
>          Components: External Tables
>            Reporter: Ivan Leskin
>            Assignee: Radar Lei
>            Priority: Major
>
> When accessing external tables, the pushdown feature sometimes works 
> incorrect. Consider the following query:
> {{SELECT * FROM table_ex WHERE bool1=false AND id1=60003;}}
> When this query is executed, we get an error "stack is not empty ...".
> But what actually happens?
> It turns out that such query is "translated" into a list of three items, 
> which represents the constraints: 'BoolExpr', 'Var' and 'OpExpr' (this 
> represents a constraint "WHERE NOT(bool1 = true) AND (id1 = 60003)"). Note 
> that the list does not contain implicit AND operators.
> Then, the list is processed by a piece of code in [pxffilters.c, where there 
> is a check of presence of 
> 'BoolExpr's|[https://github.com/arenadata/incubator-hawq/blob/master/src/backend/access/external/pxffilters.c#L1259].]
>  If 'BoolExpr's are detected, no implicit AND operators are added.
> In the case described, one 'BoolExpr' element is present, and no implicit AND 
> operators are added. This leads to the error mentioned above.



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

Reply via email to