SkinnyPigeon commented on PR #32366:
URL: https://github.com/apache/superset/pull/32366#issuecomment-2719075001

   Hey @eschutho, you pretty much handed me that on a plate. I've updated the 
PR with almost exactly what you gave me. However, I have managed to test it. 
First, I created a Dataset (PostgreSQL compatible):
   ```sql
   WITH dates AS (
       SELECT generate_series(
           (CURRENT_DATE - INTERVAL '90 days')::date,
           CURRENT_DATE::date,
           '1 day'::interval
       ) AS order_date
   ),
   products AS (
       SELECT 'Product A' AS product_name, 100 AS base_price
       UNION ALL SELECT 'Product B', 200
       UNION ALL SELECT 'Product C', 150
       UNION ALL SELECT 'Product D', 75
   ),
   regions AS (
       SELECT 'North' AS region
       UNION ALL SELECT 'South'
       UNION ALL SELECT 'East'
       UNION ALL SELECT 'West'
   ),
   sales AS (
       SELECT 
           d.order_date,
           p.product_name,
           r.region,
           p.base_price,
           ROUND((p.base_price * (0.8 + RANDOM() * 0.4))::numeric, 2) AS 
sale_price,
           FLOOR(10 + RANDOM() * 90)::int AS quantity
       FROM 
           dates d
           CROSS JOIN products p
           CROSS JOIN regions r
       WHERE 
           RANDOM() < 0.3  -- Only keep some random combinations
   )
   SELECT 
       ROW_NUMBER() OVER (ORDER BY order_date, product_name, region) AS id,
       order_date,
       product_name,
       region,
       base_price,
       sale_price,
       quantity,
       (sale_price * quantity) AS total_revenue
   FROM 
       sales
   ORDER BY 
       order_date, product_name, region
   LIMIT 100;
   ```
   Then this is the before:
   ![Screenshot 2025-03-12 at 21 35 
25](https://github.com/user-attachments/assets/9a10acbb-d773-46dc-a320-bac906bba1f1)
   
   And this is the after:
   ![Screenshot 2025-03-12 at 21 35 
33](https://github.com/user-attachments/assets/6c408879-b930-414e-874c-8f1a7a4efdcf)
   
   No more index column. I get the feeling you didn't need me for this one, but 
I'm always happy to help. This is such a great project, and it's always fun to 
work on the codebase
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to