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

Zongtian Hou updated HAWQ-1697:
-------------------------------
    Description: 
```
 * Create table aa(a int);

SELECT t1.sum
 FROM ( SELECT sum(a) OVER() AS sum
 FROM aa
 UNION ALL
 SELECT sum() OVER() AS sum
 FROM aa
 ) t1
 WHERE t1.sum = 1;

callstack:

 

;",0,,"execQual.c",4619,"Stack trace:
 1 0x10d1e3bce postgres errstart + 0x4fe
 2 0x10d1e368f postgres elog_internalerror + 0x2f
 3 0x10ce73662 postgres ExecInitExpr + 0xeb2
 4 0x10ce76088 postgres ExecInitExpr + 0x38d8
 5 0x10ce73b21 postgres ExecInitExpr + 0x1371
 6 0x10ce76088 postgres ExecInitExpr + 0x38d8
 7 0x10cebc7e4 postgres ExecInitResult + 0x1d4
 8 0x10ce6b4af postgres ExecInitNode + 0x2bf
 9 0x10ceb847b postgres ExecInitMotion + 0x8cb
 10 0x10ce6e0d1 postgres ExecInitNode + 0x2ee1
 11 0x10cec38c5 postgres ExecInitSort + 0x285
 12 0x10ce6d6cf postgres ExecInitNode + 0x24df
 13 0x10cecf60e postgres ExecInitWindow + 0x10e
 14 0x10ce6d9ab postgres ExecInitNode + 0x27bb
 15 0x10cec84e1 postgres ExecInitSubqueryScan + 0x4d1
 16 0x10ce6c9f1 postgres ExecInitNode + 0x1801
 17 0x10ce992e1 postgres ExecInitAppend + 0x2d1
 18 0x10ce6b614 postgres ExecInitNode + 0x424
 19 0x10ceb847b postgres ExecInitMotion + 0x8cb
 20 0x10ce6e0d1 postgres ExecInitNode + 0x2ee1
 21 0x10ce5ffa1 postgres InitPlan + 0x551
 22 0x10ce5e67b postgres ExecutorStart + 0xf2b
 23 0x10d0c2bbe postgres PortalStart + 0x51e
 24 0x10d0b91aa postgres exec_simple_query + 0x83a
 25 0x10d0b72c3 postgres PostgresMain + 0x2023
 26 0x10d050d78 postgres BackendRun + 0x418
 27 0x10d04db15 postgres BackendStartup + 0x175
 28 0x10d04a9c0 postgres ServerLoop + 0x4e0
 29 0x10d048f73 postgres PostmasterMain + 0x12e3
 30 0x10cf2128c postgres main + 0x3ac

```

  was:
Create table aa(a int);

SELECT t1.sum
FROM ( SELECT sum(a) OVER() AS sum
FROM aa
UNION ALL
SELECT sum() OVER() AS sum
FROM aa
) t1
WHERE t1.sum = 1;

callstack:

 

;",0,,"execQual.c",4619,"Stack trace:
1 0x10d1e3bce postgres errstart + 0x4fe
2 0x10d1e368f postgres elog_internalerror + 0x2f
3 0x10ce73662 postgres ExecInitExpr + 0xeb2
4 0x10ce76088 postgres ExecInitExpr + 0x38d8
5 0x10ce73b21 postgres ExecInitExpr + 0x1371
6 0x10ce76088 postgres ExecInitExpr + 0x38d8
7 0x10cebc7e4 postgres ExecInitResult + 0x1d4
8 0x10ce6b4af postgres ExecInitNode + 0x2bf
9 0x10ceb847b postgres ExecInitMotion + 0x8cb
10 0x10ce6e0d1 postgres ExecInitNode + 0x2ee1
11 0x10cec38c5 postgres ExecInitSort + 0x285
12 0x10ce6d6cf postgres ExecInitNode + 0x24df
13 0x10cecf60e postgres ExecInitWindow + 0x10e
14 0x10ce6d9ab postgres ExecInitNode + 0x27bb
15 0x10cec84e1 postgres ExecInitSubqueryScan + 0x4d1
16 0x10ce6c9f1 postgres ExecInitNode + 0x1801
17 0x10ce992e1 postgres ExecInitAppend + 0x2d1
18 0x10ce6b614 postgres ExecInitNode + 0x424
19 0x10ceb847b postgres ExecInitMotion + 0x8cb
20 0x10ce6e0d1 postgres ExecInitNode + 0x2ee1
21 0x10ce5ffa1 postgres InitPlan + 0x551
22 0x10ce5e67b postgres ExecutorStart + 0xf2b
23 0x10d0c2bbe postgres PortalStart + 0x51e
24 0x10d0b91aa postgres exec_simple_query + 0x83a
25 0x10d0b72c3 postgres PostgresMain + 0x2023
26 0x10d050d78 postgres BackendRun + 0x418
27 0x10d04db15 postgres BackendStartup + 0x175
28 0x10d04a9c0 postgres ServerLoop + 0x4e0
29 0x10d048f73 postgres PostmasterMain + 0x12e3
30 0x10cf2128c postgres main + 0x3ac


> fix bug of unsafe window function push down
> -------------------------------------------
>
>                 Key: HAWQ-1697
>                 URL: https://issues.apache.org/jira/browse/HAWQ-1697
>             Project: Apache HAWQ
>          Issue Type: Bug
>          Components: Planner
>    Affects Versions: 2.4.0.0
>            Reporter: Zongtian Hou
>            Assignee: Radar Lei
>            Priority: Major
>             Fix For: 2.5.0.0
>
>
> ```
>  * Create table aa(a int);
> SELECT t1.sum
>  FROM ( SELECT sum(a) OVER() AS sum
>  FROM aa
>  UNION ALL
>  SELECT sum() OVER() AS sum
>  FROM aa
>  ) t1
>  WHERE t1.sum = 1;
> callstack:
>  
> ;",0,,"execQual.c",4619,"Stack trace:
>  1 0x10d1e3bce postgres errstart + 0x4fe
>  2 0x10d1e368f postgres elog_internalerror + 0x2f
>  3 0x10ce73662 postgres ExecInitExpr + 0xeb2
>  4 0x10ce76088 postgres ExecInitExpr + 0x38d8
>  5 0x10ce73b21 postgres ExecInitExpr + 0x1371
>  6 0x10ce76088 postgres ExecInitExpr + 0x38d8
>  7 0x10cebc7e4 postgres ExecInitResult + 0x1d4
>  8 0x10ce6b4af postgres ExecInitNode + 0x2bf
>  9 0x10ceb847b postgres ExecInitMotion + 0x8cb
>  10 0x10ce6e0d1 postgres ExecInitNode + 0x2ee1
>  11 0x10cec38c5 postgres ExecInitSort + 0x285
>  12 0x10ce6d6cf postgres ExecInitNode + 0x24df
>  13 0x10cecf60e postgres ExecInitWindow + 0x10e
>  14 0x10ce6d9ab postgres ExecInitNode + 0x27bb
>  15 0x10cec84e1 postgres ExecInitSubqueryScan + 0x4d1
>  16 0x10ce6c9f1 postgres ExecInitNode + 0x1801
>  17 0x10ce992e1 postgres ExecInitAppend + 0x2d1
>  18 0x10ce6b614 postgres ExecInitNode + 0x424
>  19 0x10ceb847b postgres ExecInitMotion + 0x8cb
>  20 0x10ce6e0d1 postgres ExecInitNode + 0x2ee1
>  21 0x10ce5ffa1 postgres InitPlan + 0x551
>  22 0x10ce5e67b postgres ExecutorStart + 0xf2b
>  23 0x10d0c2bbe postgres PortalStart + 0x51e
>  24 0x10d0b91aa postgres exec_simple_query + 0x83a
>  25 0x10d0b72c3 postgres PostgresMain + 0x2023
>  26 0x10d050d78 postgres BackendRun + 0x418
>  27 0x10d04db15 postgres BackendStartup + 0x175
>  28 0x10d04a9c0 postgres ServerLoop + 0x4e0
>  29 0x10d048f73 postgres PostmasterMain + 0x12e3
>  30 0x10cf2128c postgres main + 0x3ac
> ```



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

Reply via email to