gabotechs commented on issue #16028:
URL: https://github.com/apache/datafusion/issues/16028#issuecomment-2875255482

   That's an interesting suggestion! although I imagine that identifying where 
is the actual setup code can be a non trivial task. My idea was to always run 
any statement that is considered "setup code" (pretty much anything other than 
`SELECT` and `EXPLAIN` statements) so that the workflow looks like this:
   1. Run a sqllogictest file
   ```shell
   cargo test --test sqllogictests -- aggregate
   ```
   2. get a bunch of errors:
   <details><summary>command output</summary>
   
   ```
   
   Completed 3 test files in 2 seconds                                          
                  External error: 5 errors in file 
/Users/foo/github/datafusion/datafusion/sqllogictest/test_files/aggregate.slt
   
   1. query result mismatch:
   [SQL] WITH t AS (SELECT i as c1, i + 1 as c2 FROM generate_series(1, 10) 
t(i))
   SELECT key, MIN(c), MAX(c) FROM (SELECT STRUCT(c1 AS 'a', c2 AS 'b') AS c, 
(c1 % 2) AS key FROM t) GROUP BY key
   [Diff] (-expected|+actual)
   -   0 {a: 1, b: 3} {a: 10, b: 11}
   +   0 {a: 2, b: 3} {a: 10, b: 11}
       1 {a: 1, b: 2} {a: 9, b: 10}
   at 
/Users/foo/github/datafusion/datafusion/sqllogictest/test_files/aggregate.slt:6954
   
   
   2. query result mismatch:
   [SQL] WITH t AS (SELECT i as c1, i + 1 as c2 FROM generate_series(1, 10) 
t(i))
   SELECT key, MIN(c), MAX(c) FROM (SELECT CASE WHEN c1 % 2 == 0 THEN STRUCT(c1 
AS 'a', c2 AS 'b') ELSE NULL END AS c, (c1 % 2) AS key FROM t) GROUP BY key
   [Diff] (-expected|+actual)
   -   0 {a: 1, b: 3} {a: 10, b: 11}
   +   0 {a: 2, b: 3} {a: 10, b: 11}
       1 NULL NULL
   at 
/Users/foo/github/datafusion/datafusion/sqllogictest/test_files/aggregate.slt:6962
   
   
   3. query result mismatch:
   [SQL] WITH t AS (SELECT i as c1, i + 1 as c2 FROM generate_series(1, 10) 
t(i))
   SELECT key, MIN(c), MAX(c) FROM (SELECT CASE WHEN c1 % 3 == 0 THEN STRUCT(c1 
AS 'a', c2 AS 'b') ELSE NULL END AS c, (c1 % 2) AS key FROM t) GROUP BY key
   [Diff] (-expected|+actual)
   -   0 {a: 1, b: 7} {a: 6, b: 7}
   +   0 {a: 6, b: 7} {a: 6, b: 7}
       1 {a: 3, b: 4} {a: 9, b: 10}
   at 
/Users/foo/github/datafusion/datafusion/sqllogictest/test_files/aggregate.slt:6970
   
   
   4. query result mismatch:
   [SQL] WITH t AS (SELECT i as c1 FROM generate_series(1, 10) t(i))
   SELECT MIN(c), MAX(c) FROM (SELECT STRUCT(c1 AS 'a') AS c FROM t);
   [Diff] (-expected|+actual)
   -   {a: 2} {a: 10}
   +   {a: 1} {a: 10}
   at 
/Users/foo/github/datafusion/datafusion/sqllogictest/test_files/aggregate.slt:6984
   
   
   5. query result mismatch:
   [SQL] SELECT MIN(column1),MAX(column1) FROM (
   VALUES
     (STRUCT(1 AS 'a',2 AS 'b', 3 AS 'c')),
     (STRUCT(1 AS 'a',2 AS 'b', 4 AS 'c'))
   );
   [Diff] (-expected|+actual)
   -   {a: 2, b: 2, c: 3} {a: 1, b: 2, c: 4}
   +   {a: 1, b: 2, c: 3} {a: 1, b: 2, c: 4}
   at 
/Users/foo/github/datafusion/datafusion/sqllogictest/test_files/aggregate.slt:6991
   
   
   
   Error: Execution("1 failures")
   error: test failed, to rerun pass `-p datafusion-sqllogictest --test 
sqllogictests`
   ```
   </details>
   3. just pick one of the failing test reported in stdout and use its line 
number
   ```
   cargo test --test sqllogictests -- aggregate:6954
   ```
   <details><summary>command output</summary>
   
   ```
   Completed 3 test files in 0 seconds                                          
                  External error: 1 errors in file 
/Users/gabriel.musatmestre/github/datafusion/datafusion/sqllogictest/test_files/aggregate.slt
   
   1. query result mismatch:
   [SQL] WITH t AS (SELECT i as c1, i + 1 as c2 FROM generate_series(1, 10) 
t(i))
   SELECT key, MIN(c), MAX(c) FROM (SELECT STRUCT(c1 AS 'a', c2 AS 'b') AS c, 
(c1 % 2) AS key FROM t) GROUP BY key
   [Diff] (-expected|+actual)
   -   0 {a: 1, b: 3} {a: 10, b: 11}
   +   0 {a: 2, b: 3} {a: 10, b: 11}
       1 {a: 1, b: 2} {a: 9, b: 10}
   at 
/Users/gabriel.musatmestre/github/datafusion/datafusion/sqllogictest/test_files/aggregate.slt:6954
   
   
   
   Error: Execution("1 failures")
   error: test failed, to rerun pass `-p datafusion-sqllogictest --test 
sqllogictests`
   ```
   </details>
   4. launch just the test that you care about with a debugger attached, making 
sure that the debugger doesn't do 1e6 irrelevant stops in breakpoints due to 
other tests running


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