Skip to content

feat: capture per-query output from CometSqlFileTestSuite via system property#3976

Draft
andygrove wants to merge 1 commit intoapache:mainfrom
andygrove:feat-sql-file-test-verbose
Draft

feat: capture per-query output from CometSqlFileTestSuite via system property#3976
andygrove wants to merge 1 commit intoapache:mainfrom
andygrove:feat-sql-file-test-verbose

Conversation

@andygrove
Copy link
Copy Markdown
Member

Which issue does this PR close?

Closes #.

Rationale for this change

When cross-checking Spark behavior across versions or against another engine, it is useful to see the actual row data returned by each query in the SQL test corpus, not just pass or fail. There was no built-in way to do this. Adding one lets us generate a machine-readable record of every query's result in one test run, which is much less fragile than extracting queries, re-running them in a separate session, and hand-formatting the output.

What changes are included in this PR?

  • CometSqlFileTestSuite honors a new system property, comet.sqlFileTest.verboseOutput. When the property is set to a file path, the suite appends a markdown-formatted record for every query it runs. Each record contains the SQL file and line, the query mode (query, query spark_answer_only, query expect_error(...), etc.), the SQL text, and Spark's actual result rows or error message.
  • A helper object VerboseOutput owns the file lifecycle. The file is created and header-stamped on the first write, then appended to for each subsequent query. Skipped files (for example those gated by MinSparkVersion) are not written to the output.
  • docs/source/contributor-guide/sql-file-tests.md documents the flag, shows a concrete Maven invocation, and notes the JDK 17 --add-opens args that must be preserved when overriding argLine.

When the property is not set the suite behaves exactly as before.

How are these changes tested?

Manually ran ./mvnw test -Dsuites="org.apache.comet.CometSqlFileTestSuite encode" -Dtest=none -DargLine="..." with and without comet.sqlFileTest.verboseOutput set. With the property unset the suite output is unchanged. With the property pointed at /tmp/encode-spark-3.5-output.md, the file is created with a header and one markdown section per executed query, and the actual assertions still run in addition to the verbose capture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant