Skip to content

Misc cleanups for error handling, naming/signatures, and partitioning in skill templates [skip ci]#15116

Merged
rishic3 merged 2 commits into
NVIDIA:mainfrom
rishic3:udf-skill-pr-followups
Jun 25, 2026
Merged

Misc cleanups for error handling, naming/signatures, and partitioning in skill templates [skip ci]#15116
rishic3 merged 2 commits into
NVIDIA:mainfrom
rishic3:udf-skill-pr-followups

Conversation

@rishic3

@rishic3 rishic3 commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Description

This is a follow-up to address a few comments on #15058.

  • (comment) - executeGpu now closes its result internally and returns void
  • (comment) - no longer catching write errors and letting it throw (more easily reviewable with whitespace off)
  • (comment) - rename verifyUDFResults -> assertUDFResults to clarify that this calls assertions
  • (comment) - bumped to repartition(2) and encouraging 10+ test cases, for more realistic parallelism while ensuring the UDF is actually fed multi-row columns

Checklists

Documentation

  • Updated for new or modified user-facing features or behaviors
  • No user-facing change

Testing

  • Added or modified tests to cover new code paths
  • Covered by existing tests
    (Please provide the names of the existing tests in the PR description.)
  • Not required

Performance

  • Tests ran and results are added in the PR description
  • Issue filed with a link in the PR description
  • Not required

Signed-off-by: Rishi Chandra <rishic@nvidia.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Follow-up cleanup to the UDF skill templates to align with prior review feedback: clarify naming/signatures, tighten resource ownership expectations, and encourage more realistic test partitioning.

Changes:

  • Renamed verifyUDFResultsassertUDFResults across templates/docs to reflect assertion semantics.
  • Updated Scala test templates to use repartition(2) to better exercise multi-row columnar execution paths.
  • Adjusted benchmark template error/report handling and clarified GPU benchmark resource-lifecycle expectations (executeGpu closes its result and returns Unit).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
skills/udf-judge-conversion/SKILL.md Updates judge guidance to reference assertUDFResults instead of verifyUDFResults.
skills/udf-gen-test/templates/scala/src/test/scala/com/udf/UnitTest.scala Renames results-check helper, updates TODO guidance, and changes repartitioning to 2.
skills/udf-gen-test/templates/scala/src/test/scala/com/udf/SqlComparisonTest.scala Updates to assertUDFResults and uses repartition(2) for test input.
skills/udf-gen-test/templates/scala/src/test/scala/com/udf/CudfComparisonTest.scala Updates to assertUDFResults and uses repartition(2) for test input.
skills/udf-gen-test/templates/scala/src/main/scala/com/udf/bench/SparkBenchRunner.scala Stops swallowing report-write exceptions; report writing failures now propagate.
skills/udf-gen-test/templates/scala/src/main/scala/com/udf/bench/MicroBenchRunner.scala Changes executeGpu to Unit and updates docs/call site to reflect internal close of the GPU result.

Comment thread skills/udf-gen-test/templates/scala/src/test/scala/com/udf/UnitTest.scala Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@rishic3 rishic3 requested a review from abellina June 23, 2026 15:30
@rishic3

rishic3 commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator Author

build

@greptile-apps

greptile-apps Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This is a housekeeping follow-up that addresses code-review comments from PR #15058, touching only the skill template files and the judge SKILL.md — no production plugin code is changed.

  • executeGpu in MicroBenchRunner now returns Unit and closes the ColumnVector internally via withResource, removing the burden from the call site.
  • writeReport in SparkBenchRunner no longer silently swallows write errors; they propagate as exceptions.
  • verifyUDFResults is renamed to assertUDFResults consistently across the three test templates and SKILL.md.
  • All three test templates bump repartition(1)repartition(2) and add guidance to include 10+ test cases for more realistic multi-row coverage.

Confidence Score: 4/5

Safe to merge; all changes are in skill template files with no impact on the production Spark plugin. The one nuance worth a follow-up is how write errors in the success path are reported.

The rename, repartition bump, and executeGpu void-return changes are clean and consistent across all template files. The removal of the silent write-error catch in SparkBenchRunner is an improvement in visibility, but it creates a path where a successful benchmark run can exit with failure status if the JSON write fails — the outer catch handler will log it as a benchmark failure and write an error report rather than surfacing just the write problem.

skills/udf-gen-test/templates/scala/src/main/scala/com/udf/bench/SparkBenchRunner.scala — the success-path writeReport call now sits inside the try block that feeds the error handler.

Important Files Changed

Filename Overview
skills/udf-gen-test/templates/scala/src/main/scala/com/udf/bench/SparkBenchRunner.scala Removed try/catch that silently swallowed write errors in writeReport; exceptions now propagate. A write failure in the success path will be caught by the outer catch block, causing the run to exit with failure status even though the benchmark itself succeeded.
skills/udf-gen-test/templates/scala/src/main/scala/com/udf/bench/MicroBenchRunner.scala executeGpu changed to return Unit and close its ColumnVector internally; call site cleaned up. Resource lifecycle is now correctly managed.
skills/udf-gen-test/templates/scala/src/test/scala/com/udf/UnitTest.scala verifyUDFResults renamed to assertUDFResults; repartition(1) bumped to repartition(2) with explanatory comment and 10+ test case guidance added.
skills/udf-gen-test/templates/scala/src/test/scala/com/udf/CudfComparisonTest.scala Call sites updated to assertUDFResults; repartition(2) with comment. Straightforward rename.
skills/udf-gen-test/templates/scala/src/test/scala/com/udf/SqlComparisonTest.scala Call sites updated to assertUDFResults; repartition(2) with comment. Straightforward rename.
skills/udf-judge-conversion/SKILL.md Single reference to verifyUDFResults updated to assertUDFResults to stay in sync with the renamed template method.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant Main as SparkBenchRunner.main
    participant Job as Spark Job
    participant WR as writeReport
    participant EH as catch(Exception)

    Main->>Job: execute benchmark
    Job-->>Main: success / elapsed
    Main->>WR: "writeReport(status=success)"
    alt write succeeds
        WR-->>Main: ok
        Main->>Main: sys.exit(0)
    else write throws IOException
        WR-->>EH: IOException (caught by outer catch)
        EH->>WR: "writeReport(status=error)"
        EH->>Main: sys.exit(1)
        Note over EH,Main: benchmark was successful but exits with failure
    end
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant Main as SparkBenchRunner.main
    participant Job as Spark Job
    participant WR as writeReport
    participant EH as catch(Exception)

    Main->>Job: execute benchmark
    Job-->>Main: success / elapsed
    Main->>WR: "writeReport(status=success)"
    alt write succeeds
        WR-->>Main: ok
        Main->>Main: sys.exit(0)
    else write throws IOException
        WR-->>EH: IOException (caught by outer catch)
        EH->>WR: "writeReport(status=error)"
        EH->>Main: sys.exit(1)
        Note over EH,Main: benchmark was successful but exits with failure
    end
Loading

Comments Outside Diff (1)

  1. skills/udf-gen-test/templates/scala/src/main/scala/com/udf/bench/SparkBenchRunner.scala, line 55-98 (link)

    P2 Write failure mis-reports a successful benchmark run as an error

    With the try/catch removed, a successful benchmark (lines 57–61 complete fine) that then hits an IOException during writeReport will be caught by the outer case e: Exception handler. The handler logs "Benchmark run failed", writes an error report with status = "error", and calls sys.exit(1) — even though the benchmark itself finished successfully. The original silent-swallow was admittedly wrong, but letting the exception escape the success block into the error handler misattributes the cause. Moving writeReport outside the try/catch (so it propagates unconditionally rather than into the error handler) or re-catching specifically in the success block would prevent the false-failure report.

Reviews (1): Last reviewed commit: "add a trailing comma" | Re-trigger Greptile

@wjxiz1992 wjxiz1992 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good practices, LGTM!

@abellina abellina left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rishic3 this looks good

@rishic3 rishic3 merged commit a2f9319 into NVIDIA:main Jun 25, 2026
49 checks passed
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.

5 participants