LiaCastaneda commented on code in PR #16454:
URL: https://github.com/apache/datafusion/pull/16454#discussion_r2179760623


##########
datafusion/substrait/tests/testdata/test_plans/join_with_expression_key.json:
##########
@@ -0,0 +1,814 @@
+{

Review Comment:
   Sorry for the huge substrait plan, this is the SQL version:
   ```
   CREATE TABLE index_metrics
     (
        index_name VARCHAR,
        host       VARCHAR,
        size_bytes BIGINT
     );
   
   CREATE TABLE db_metrics
     (
        host        VARCHAR,
        total_bytes BIGINT
     );
   
   INSERT INTO index_metrics
               (index_name,
                host,
                size_bytes)
   VALUES      ( 'aaa',
                 'host-a',
                 128 ),
               ( 'bbb',
                 'host-b',
                 256 );
   
   INSERT INTO db_metrics
               (host,
                total_bytes)
   VALUES      ('host-a',
                107),
               ('host-b',
                214);
   
   WITH index_sizes
        AS (SELECT index_name      AS index,
                   Upper(host)     AS host_expr,
                   Max(size_bytes) AS idx_size
            FROM   index_metrics
            WHERE  index_name IN ( 'aaa' )
            GROUP  BY index_name,
                      Upper(host)),
        db_sizes
        AS (SELECT Upper(host)      AS host_expr,-- scalar func
                   Max(total_bytes) AS db_size
            FROM   db_metrics
            WHERE  Upper(host) IN (SELECT host_expr
                                   FROM   index_sizes) -- semi-join
            GROUP  BY Upper(host))
   SELECT ix.index,
          ds.host_expr                         AS host,
          ix.idx_size,
          ds.db_size,
          ( ix.idx_size / ds.db_size ) * 100.0 AS pct_of_db
   FROM   index_sizes ix
          JOIN db_sizes ds
            ON ix.host_expr = ds.host_expr; 
   ```



-- 
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: github-unsubscr...@datafusion.apache.org

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


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

Reply via email to