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/05 11:23:20 UTC

[GitHub] [incubator-doris] yangzhg opened a new issue #2834: [Proposal] Full support of set operations: add INTERSECT and EXCEPT set operators

yangzhg opened a new issue #2834: [Proposal] Full support of set operations: add INTERSECT and EXCEPT set operators
URL: https://github.com/apache/incubator-doris/issues/2834
 
 
   # Description
   Generaly set functionality includes the below. but now doris has just support UNION & UNION ALL.
   ```
   UNION [DISTINCT | ALL]
   
   INTERSECT [DISTINCT | ALL]
   
   EXCEPT [DISTINCT | ALL]
   ```
   `EXCEPT ` in some systems is an alias for `MINUS`
   
   `INTERSECT` operator is used to return the results of 2 or more `SELECT` statements. However, it only returns the rows selected by all queries or data sets. If a record exists in one query and not in the other, it will be omitted from the `INTERSECT` results.
   ![image](https://user-images.githubusercontent.com/9098473/73837289-1a0d1200-484c-11ea-9057-20aeb375a8d7.png)
   The `EXCEPT` operator is used to return all rows in the first `SELECT` statement that are not returned by the second `SELECT` statement. Each `SELECT` statement will define a dataset. The `EXCEPT` operator will retrieve all records from the first dataset and then remove from the results all records from the second dataset.
   ![image](https://user-images.githubusercontent.com/9098473/73837373-4a54b080-484c-11ea-8ddf-2f7b6009c03d.png)
   
   # Syntax
   ## INTERSECT
   ```
   SELECT expression1, expression2, ... expression_n
   FROM tables
   [WHERE conditions]
   INTERSECT [DISTINCT | ALL]
   SELECT expression1, expression2, ... expression_n
   FROM tables
   [WHERE conditions];
   ```
   ## EXCEPT
   ```
   SELECT expression1, expression2, ... expression_n
   FROM tables
   [WHERE conditions]
   EXCEPT|MINUS [DISTINCT | ALL]
   SELECT expression1, expression2, ... expression_n
   FROM tables
   [WHERE conditions];
   ```
   # Subtasks
   * Convert UnionStmt class into to SetOperationStmt, add Syntax support to sqlparser.cup
   * Add INTERSECT and EXCEPT support to SetOperationStmt and planner
   * Implements IntersectNode and ExceptNode
   
   
   
   
   
   
   
   
   
   

----------------------------------------------------------------
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] yangzhg opened a new issue #2834: [Proposal] Full support of set operations: add INTERSECT and EXCEPT set operators

Posted by GitBox <gi...@apache.org>.
yangzhg opened a new issue #2834: [Proposal] Full support of set operations: add INTERSECT and EXCEPT set operators
URL: https://github.com/apache/incubator-doris/issues/2834
 
 
   # Description
   Generaly set functionality includes the below. but now doris has just support UNION & UNION ALL.
   ```
   UNION [DISTINCT | ALL]
   
   INTERSECT [DISTINCT]
   
   EXCEPT [DISTINCT]
   ```
   `EXCEPT ` in some systems is an alias for `MINUS`
   
   `INTERSECT` operator is used to return the results of 2 or more `SELECT` statements. However, it only returns the rows selected by all queries or data sets. If a record exists in one query and not in the other, it will be omitted from the `INTERSECT` results.
   ![image](https://user-images.githubusercontent.com/9098473/73837289-1a0d1200-484c-11ea-9057-20aeb375a8d7.png)
   The `EXCEPT` operator is used to return all rows in the first `SELECT` statement that are not returned by the second `SELECT` statement. Each `SELECT` statement will define a dataset. The `EXCEPT` operator will retrieve all records from the first dataset and then remove from the results all records from the second dataset.
   ![image](https://user-images.githubusercontent.com/9098473/73837373-4a54b080-484c-11ea-8ddf-2f7b6009c03d.png)
   
   # Syntax
   ## INTERSECT
   ```
   SELECT expression1, expression2, ... expression_n
   FROM tables
   [WHERE conditions]
   INTERSECT [DISTINCT]
   SELECT expression1, expression2, ... expression_n
   FROM tables
   [WHERE conditions];
   ```
   ## EXCEPT
   ```
   SELECT expression1, expression2, ... expression_n
   FROM tables
   [WHERE conditions]
   EXCEPT|MINUS [DISTINCT]
   SELECT expression1, expression2, ... expression_n
   FROM tables
   [WHERE conditions];
   ```
   # Subtasks
   * Convert UnionStmt class into to SetOperationStmt, add Syntax support to sql_parser #2843
   * Add INTERSECT and EXCEPT support to SetOperationStmt and planner #2844 
   * Implements IntersectNode and ExceptNode #2845
   
   
   
   
   
   
   
   
   
   

----------------------------------------------------------------
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] yangzhg closed issue #2834: [Proposal] Full support of set operations: add INTERSECT and EXCEPT set operators

Posted by GitBox <gi...@apache.org>.
yangzhg closed issue #2834: [Proposal] Full support of set operations: add INTERSECT and EXCEPT set operators
URL: https://github.com/apache/incubator-doris/issues/2834
 
 
   

----------------------------------------------------------------
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] EmmyMiao87 closed issue #2834: [Proposal] Full support of set operations: add INTERSECT and EXCEPT set operators

Posted by GitBox <gi...@apache.org>.
EmmyMiao87 closed issue #2834: [Proposal] Full support of set operations: add INTERSECT and EXCEPT set operators
URL: https://github.com/apache/incubator-doris/issues/2834
 
 
   

----------------------------------------------------------------
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