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 2020/02/11 03:20:05 UTC

[GitHub] [incubator-doris] yangzhg opened a new pull request #2877: [FIX] fix a bug when using grouping set without all column in a grouping set item

yangzhg opened a new pull request #2877: [FIX] fix a bug when using grouping set without all column in a grouping set item
URL: https://github.com/apache/incubator-doris/pull/2877
 
 
   fix a bug when using grouping sets without all column in a grouping set item will produce wrong value.
   fix grouping function check will not work in group by clause

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] morningman commented on a change in pull request #2877: [FIX] fix a bug when using grouping set without all column in a grouping set item

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #2877: [FIX] fix a bug when using grouping set without all column in a grouping set item
URL: https://github.com/apache/incubator-doris/pull/2877#discussion_r377635413
 
 

 ##########
 File path: gensrc/thrift/PlanNodes.thrift
 ##########
 @@ -396,6 +396,8 @@ struct TRepeatNode {
   3: required list<i64> repeat_id_list
   // A list of integer list, it indicates the position of the grouping virtual slot.
   4: required list<list<i64>> grouping_list
+  // A list of all slot
+  5: required set<Types.TSlotId> all_slot_id
 
 Review comment:
   All newly added fields should be optional, or it will cause incompatible.
   And name should be `all_slot_ids`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] morningman merged pull request #2877: [FIX] fix a bug when using grouping set without all column in a grouping set item

Posted by GitBox <gi...@apache.org>.
morningman merged pull request #2877: [FIX] fix a bug when using grouping set without all column in a grouping set item
URL: https://github.com/apache/incubator-doris/pull/2877
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] morningman commented on a change in pull request #2877: [FIX] fix a bug when using grouping set without all column in a grouping set item

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #2877: [FIX] fix a bug when using grouping set without all column in a grouping set item
URL: https://github.com/apache/incubator-doris/pull/2877#discussion_r377634636
 
 

 ##########
 File path: fe/src/main/java/org/apache/doris/analysis/SelectStmt.java
 ##########
 @@ -351,6 +351,14 @@ public void analyze(Analyzer analyzer) throws AnalysisException, UserException {
         if (groupByClause != null && groupByClause.isGroupByExtension()) {
             groupingInfo = new GroupingInfo(analyzer, groupByClause.getGroupingType());
             groupingInfo.substituteGroupingFn(resultExprs, analyzer);
+        } else {
+            for (Expr expr : resultExprs) {
+                if (checkGroupingFn(expr)) {
+                    throw new AnalysisException(
+                            "cannot use GROUPING functions without [grouping sets|rollup|cube] a"
 
 Review comment:
   ```suggestion
                               "cannot use GROUPING functions without [grouping sets|rollup|cube] "
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] morningman commented on a change in pull request #2877: [FIX] fix a bug when using grouping set without all column in a grouping set item

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #2877: [FIX] fix a bug when using grouping set without all column in a grouping set item
URL: https://github.com/apache/incubator-doris/pull/2877#discussion_r377633873
 
 

 ##########
 File path: fe/src/main/java/org/apache/doris/analysis/GroupingInfo.java
 ##########
 @@ -85,12 +86,11 @@ public VirtualSlotRef addGroupingSlots(List<Expr> realSlots, Analyzer analyzer)
     // generate the bitmap that repeated node will repeat rows according to
     public void buildRepeat(ArrayList<Expr> groupingExprs, List<ArrayList<Expr>> groupingSetList) {
         groupingIdList = new ArrayList<>();
-        BitSet bitSetAll = new BitSet();
+        bitSetAll = new BitSet();
         bitSetAll.set(0, groupingExprs.size(), true);
-        groupingIdList.add(bitSetAll);
         switch (groupingType) {
             case CUBE:
-                for (int i = 0; i < (1 << groupingExprs.size()) - 1; i++) {
+                for (int i = 0; i < (1 << groupingExprs.size()); i++) {
 
 Review comment:
   Would add some examples for all these cases?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] morningman commented on a change in pull request #2877: [FIX] fix a bug when using grouping set without all column in a grouping set item

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #2877: [FIX] fix a bug when using grouping set without all column in a grouping set item
URL: https://github.com/apache/incubator-doris/pull/2877#discussion_r377636196
 
 

 ##########
 File path: be/src/exec/repeat_node.cpp
 ##########
 @@ -30,6 +30,7 @@ RepeatNode::RepeatNode(ObjectPool* pool, const TPlanNode& tnode,
                      const DescriptorTbl& descs)
     : ExecNode(pool, tnode, descs),
     _slot_id_set_list(tnode.repeat_node.slot_id_set_list),
+    _all_slot_id(tnode.repeat_node.all_slot_id),
 
 Review comment:
   rename to `_all_slot_ids`.
   And `tnode.repeat_node.all_slot_id` should be optional, so here you need to check whether this field is set.
   Since this is a bug, you can just return ERROR if this field is not set.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] morningman commented on a change in pull request #2877: [FIX] fix a bug when using grouping set without all column in a grouping set item

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #2877: [FIX] fix a bug when using grouping set without all column in a grouping set item
URL: https://github.com/apache/incubator-doris/pull/2877#discussion_r377632292
 
 

 ##########
 File path: fe/src/main/java/org/apache/doris/analysis/GroupByClause.java
 ##########
 @@ -202,12 +202,7 @@ public void analyze(Analyzer analyzer) throws AnalysisException {
     }
 
     public boolean isGroupByExtension() {
-        if (groupingType == GroupingType.GROUP_BY ||
-                groupingType == GroupingType.GROUPING_SETS && (groupingSetList == null || groupingSetList.size() < 2)) {
-            return false;
-        } else {
-            return true;
-        }
+        return groupingType != GroupingType.GROUP_BY;
 
 Review comment:
   Plz add comment to this function

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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