Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ support UNION statements #21

Closed
joocer opened this issue Feb 12, 2022 · 5 comments
Closed

✨ support UNION statements #21

joocer opened this issue Feb 12, 2022 · 5 comments
Assignees
Labels
Compliance 📋 Next Release Planned for next release Planner Improvements to Planning Structural 🏗️ Changes to how the Engine works

Comments

@joocer
Copy link
Contributor

joocer commented Feb 12, 2022

UNION wil likely require changes to the parser as it may need to dynamically get the statement being worked on from a list, rather than hard-coded to 0

@joocer joocer self-assigned this Feb 12, 2022
@joocer
Copy link
Contributor Author

joocer commented Feb 25, 2022

[
   {
      "Query":{
         "with":"None",
         "body":{
            "SetOperation":{
               "op":"Union",
               "all":false,
               "left":{
                  "Select":{
                     "distinct":false,
                     "top":"None",
                     "projection":[
                        {
                           "UnnamedExpr":{
                              "Function":{
                                 "name":[
                                    {
                                       "value":"TIME",
                                       "quote_style":"None"
                                    }
                                 ],
                                 "args":[
                                    
                                 ],
                                 "over":"None",
                                 "distinct":false
                              }
                           }
                        }
                     ],
                     "from":[
                        
                     ],
                     "lateral_views":[
                        
                     ],
                     "selection":"None",
                     "group_by":[
                        
                     ],
                     "cluster_by":[
                        
                     ],
                     "distribute_by":[
                        
                     ],
                     "sort_by":[
                        
                     ],
                     "having":"None"
                  }
               },
               "right":{
                  "Select":{
                     "distinct":false,
                     "top":"None",
                     "projection":[
                        {
                           "UnnamedExpr":{
                              "Function":{
                                 "name":[
                                    {
                                       "value":"TIME",
                                       "quote_style":"None"
                                    }
                                 ],
                                 "args":[
                                    
                                 ],
                                 "over":"None",
                                 "distinct":false
                              }
                           }
                        }
                     ],
                     "from":[
                        
                     ],
                     "lateral_views":[
                        
                     ],
                     "selection":"None",
                     "group_by":[
                        
                     ],
                     "cluster_by":[
                        
                     ],
                     "distribute_by":[
                        
                     ],
                     "sort_by":[
                        
                     ],
                     "having":"None"
                  }
               }
            }
         },
         "order_by":[
            
         ],
         "limit":"None",
         "offset":"None",
         "fetch":"None"
      }
   }
]

@joocer joocer removed their assignment Mar 15, 2022
@joocer joocer added this to the 0.2 milestone Apr 20, 2022
@joocer joocer removed this from the 0.2 milestone Jul 2, 2022
@joocer joocer changed the title [FEATURE] UNION ✨ support UNION statements Aug 21, 2022
@joocer joocer added the Structural 🏗️ Changes to how the Engine works label Aug 27, 2022
@joocer
Copy link
Contributor Author

joocer commented Jan 25, 2023

Likely to be part of #808

@joocer
Copy link
Contributor Author

joocer commented Jul 1, 2023

#1017

@joocer joocer added the Planner Improvements to Planning label Jul 1, 2023
joocer added a commit that referenced this issue Nov 15, 2023
@joocer joocer added the Next Release Planned for next release label Dec 6, 2023
@joocer joocer self-assigned this Jan 4, 2024
joocer added a commit that referenced this issue Jan 7, 2024
@joocer
Copy link
Contributor Author

joocer commented Jan 7, 2024

have three outstanding issues:

SELECT * , even on the same table, doesn't resolve because of wildcard handling and pushdowns

SELECT * FROM $planets AS P1 UNION SELECT * FROM $planets AS P2;

ORDER BY not being in SELECT results in duplicate entries because the projection to get rid of the ORDERED columns is after the DISTINCT

(SELECT name FROM $planets AS P1  ORDER BY mass DESC) UNION (SELECT name FROM $planets ORDER BY diameter ASC)

Missing column, not diagnosed yet.

SELECT AVG(mass) FROM $planets AS p1 UNION SELECT SUM(diameter) FROM $planets 

@joocer
Copy link
Contributor Author

joocer commented Jan 7, 2024

SELECT * the only issue outstanding.

The first (LEFT) table is getting all of the columns, the RIGHT is handling like it's a COUNT(*) query (i.e. no columns explicitly referenced)

joocer added a commit that referenced this issue Jan 8, 2024
@joocer joocer closed this as completed in a7adc84 Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compliance 📋 Next Release Planned for next release Planner Improvements to Planning Structural 🏗️ Changes to how the Engine works
Projects
None yet
Development

No branches or pull requests

1 participant