fhyy opened a new pull request, #28444:
URL: https://github.com/apache/superset/pull/28444

   <!---
   Please write the PR title following the conventions at 
https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   Fixed issue #28443 
   Renamed `db_engine_specs` parameter `allows_alias_to_source_column` to 
`order_by_allows_alias_to_source_column` and added the new parameter 
`group_by_allows_alias_to_source_column`.
   
   The previous parameter is used to tell the SQLA generator to rename aliases 
used in `ORDER BY` statements with aggregations, to ensure that the source 
column is referenced. Some engines (e.g. Drill) needs to be able to do the same 
thing for aliases in `GROUP BY` statements.
   
   The new parameter is used to tell the SQLA generator to rename any alias of 
a source column that is used in an aggregation in a `GROUP BY` statement, to 
ensure that the source column is referenced.
   
   Added documentation of the new `group_by_allows_alias_to_source_column` 
parameter, and fixed errors in the documentation of 
`order_by_allows_alias_to_source_column`/(previously)`allows_alias_to_source_column`
   
   For example this query
   ```
   SELECT length(n_name) AS n_name
   ...
   GROUP BY length(n_name)
   ```
   becomes
   ```
   SELECT length(n_name) AS n_name__
   ...
   GROUP BY length(n_name)
   ```
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   ![Screenshot from 2024-05-12 
19-37-24](https://github.com/apache/superset/assets/14278584/d83ba91c-a23a-4621-80ac-ac1a9320aca9)
   ![Screenshot from 2024-05-12 
19-39-17](https://github.com/apache/superset/assets/14278584/6c02118f-b94e-43e3-9ccf-04de15517d8c)
   
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   1. Start Superset
   2. Navigate to the Superset web application and login
   3. Connect to a Drill database
   4. Create a dataset of the Drill database
   5. Create a chart from that dataset
   6. Select visualization type Table with query mode Aggregate
   7. Add two columns in the dimensions
   8. Aggregate the data of one of the columns (e.g. length(column_a))
   9. Press "view query"
   10. The query should now contain a GROUP BY statement of an aggregation, and 
the alias of that aggregation should have "__" at the end of the name.
   Example:
   ```
   SELECT length(n_name) AS n_name__
   ...
   GROUP BY length(n_name)
   ```
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [X] Has associated issue: Fixes #28443
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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: notifications-unsubscr...@superset.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to