nvidia/udf-convert-to-sql
Assists with converting an Apache Spark UDF to a functionally equivalent Spark SQL expression. This is step 2 of 3 in the UDF conversion workflow (udf-gen-test -> udf-convert-to-sql -> udf-benchmark). Use this skill when you have a CPU UDF with a unit test and need to convert it to SQL for GPU acceleration.
npx skills add https://github.com/NVIDIA/cudf-spark --skill udf-convert-to-sql
Before making any edits, create a visible TODO checklist for every workflow step in this skill and keep it updated. Do not produce a final answer until every required checklist item is marked complete.
Derive <CamelName> and <snake_name> from the UDF class name.
> Note: Commands require access to /tmp (Spark temp storage) and /dev (GPU device). If commands fail due to sandbox restrictions, re-run them unsandboxed.
Implement the SQL expression in a file at src/main/resources/<snake_name>.sql.
Read examples/ for example UDF-to-SQL conversions for the target language.
Do NOT hardcode test sample values or outputs. The SQL expression must work correctly for ANY potential input.
Update src/test/scala/com/udf/SqlComparisonTest.scala:
src/main/resources/<snake_name>.sql fileThen run the test:
mvn test -Dsuites=com.udf.SqlComparisonTest
If the test fails, analyze the error and iterate on the SQL expression.
Treat the unit test as the CPU behavior specification. Do not weaken or remove test cases silently.
TODO/NOTE in the SQL statement explaining the mismatch.If the user explicitly asked for the judge, a judge subagent, or a review agent, treat that as an explicit request for delegation: you MUST launch a separate subagent with model: inherit and instruct it to use the udf-judge-conversion skill. Ask it to review the UnitTest, SqlComparisonTest, and SQL expression.
If the user did not request a judge/review agent, mark this step as skipped and continue to Step 4. If a required judge subagent is blocked by tool policy, stop and tell the user that explicit permission/instruction is needed.
If you run the judge, wait for it to complete and review its report. If the judge finds any issues, 1) fix the issues, 2) re-run the tests, and 3) re-run the judge subagent.
Review your own work to ensure:
Upon successful completion:
src/main/resources/<snake_name>.sqlThese outputs are required for Step 3: Benchmark.
Take nvidia/udf-convert-to-sql from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.