You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2023/01/18 10:15:04 UTC

[GitHub] [doris] qzsee opened a new issue, #16069: [Bug] fix be coredump when children of FunctionCallExpr is folded

qzsee opened a new issue, #16069:
URL: https://github.com/apache/doris/issues/16069

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Version
   
   master
   
   ### What's Wrong?
   
   ```sql
   
   CREATE TABLE `a` (
     `k1` int(11) NULL COMMENT "",
     `k2` bitmap BITMAP_UNION NULL COMMENT "",
     `k3` bitmap BITMAP_UNION NULL COMMENT ""
   ) ENGINE=OLAP
   AGGREGATE KEY(`k1`)
   COMMENT "OLAP"
   DISTRIBUTED BY HASH(`k1`) BUCKETS 10
   PROPERTIES (
   "replication_num" = "1",
   "in_memory" = "false",
   "storage_format" = "V2"
   );
   
   CREATE TABLE `b` (
     `k1` int(11) NULL COMMENT ""
   ) ENGINE=OLAP
   DUPLICATE KEY(`k1`)
   COMMENT "OLAP"
   DISTRIBUTED BY HASH(`k1`) BUCKETS 10
   PROPERTIES (
   "replication_num" = "1",
   "in_memory" = "false",
   "storage_format" = "V2"
   ); 
   
   select  count(distinct case when false then k2 when true then k3 end) as tmp from a where k1 in (select k1 from b group by k1);
   ERROR 1105 (HY000): errCode = 2, detailMessage = VSlotRef - invalid slot id 0
   ```
   #### For the selectList rewrite
   
   `count(distinct case when false then k2 when true then k3 end)` rewrite to `count(k3)`
   
   `count(k3)` information:
   
   ```java
   FunctionCallExpr
   - fnParams
     - isDistinct = true
     - exprs
       - CaseExpr
         -  0 = {BoolLiteral@6749} "BoolLiteral false"
            1 = {SlotRef@6750} "SlotRef(k2)"
            2 = {BoolLiteral@6751} "BoolLiteral(true)"
            3 = {SlotRef@6752} "SlotRef(k3)"
   - child
     - SlotRef(k3)
   ```
   #### For the Stmt rewrite
   It rewrite Selectlist again
   
   use `CountDistinctToBitmapOrHLLRule` rewrite `count(k3)` to `bitmap_union_count`
   
   `bitmap_union_count` information
   
   ```java
   FunctionCallExpr
   - fnParams
     - isDistinct = true
     - exprs
       - CaseExpr
         -  0 = {BoolLiteral@6749} "BoolLiteral false"
            1 = {SlotRef@6750} "SlotRef(k2)"
            2 = {BoolLiteral@6751} "BoolLiteral(true)"
            3 = {SlotRef@6752} "SlotRef(k3)"
   - child
     -  0 = {BoolLiteral@6749} "BoolLiteral false"
         1 = {SlotRef@6750} "SlotRef(k2)"
         2 = {BoolLiteral@6751} "BoolLiteral(true)"
         3 = {SlotRef@6752} "SlotRef(k3)"
   ```
   `bitmap_union_count` FunctionCallExpr's child should `k3` instead of `CaseExpr`
   and child(1) `SlotRef(k2)` slot id and parent tuple id are last time outdate information.
   so Be could coredump.
   
   ### What You Expected?
   
   correct
   
   ### How to Reproduce?
   
   _No response_
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] BiteTheDDDDt closed issue #16069: [Bug] fix be coredump when children of FunctionCallExpr is folded

Posted by "BiteTheDDDDt (via GitHub)" <gi...@apache.org>.
BiteTheDDDDt closed issue #16069: [Bug] fix be coredump when children of FunctionCallExpr is folded
URL: https://github.com/apache/doris/issues/16069


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org