udf-convert-to-sql

Convert Apache Spark UDFs into equivalent Spark SQL expressions.

993|294|Updated May 14, 2020
One-click install
npx skills add https://github.com/NVIDIA/cudf-spark --skill udf-convert-to-sql
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: udf-convert-to-sql
Source: https://github.com/NVIDIA/cudf-spark/tree/main/skills/udf-convert-to-sql
Command: npx skills add https://github.com/NVIDIA/cudf-spark --skill udf-convert-to-sql

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill removes the manual effort of translating an Apache Spark UDF into an equivalent Spark SQL expression while keeping the CPU behavior as the reference.

Core Features & Use Cases

  • SQL Conversion: Produces a resource-backed SQL expression for a specific UDF so the logic can run in a GPU-accelerated Spark pipeline.
  • Test Alignment: Updates the comparison test to point at the correct SQL file and class names, then iterates until CPU and SQL outputs match.
  • Workflow Support: Fits the udf-gen-test to udf-convert-to-sql to udf-benchmark sequence used when moving validated UDF logic toward acceleration.

Quick Start

Use this skill to convert the UDF class into a Spark SQL expression and update the comparison test so it can be validated against the CPU implementation.

Frequently Asked Questions about udf-convert-to-sql

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert a Spark UDF to a SQL expression for GPU acceleration?

To convert a Spark UDF to a SQL expression for GPU acceleration, you translate the user-defined function into a functionally equivalent Spark SQL resource. This shifts execution from CPU-bound JVM logic to GPU-accelerated SQL operations.

What is the process for migrating Apache Spark UDFs to GPU-ready SQL?

Migrating Apache Spark UDFs to GPU-ready SQL involves generating a resource-backed SQL file and updating the SqlComparisonTest. You then iterate test execution until CPU and SQL outputs match for equivalence checking.

Why do I need to test CPU and SQL output parity when converting Spark UDFs?

Testing CPU and SQL output parity is required when converting Spark UDFs to prevent logic discrepancies. The CPU implementation serves as the reference behavior, ensuring the GPU-accelerated SQL expression matches exactly without overfitting to sample cases.

Does converting Spark UDFs to SQL work without external dependencies?

Yes, converting Spark UDFs to SQL works without external dependencies. The conversion requires only a correct snake-case SQL resource and an updated comparison test to validate functional equivalence within your Apache Spark environment.

Can I use Apache Spark SQL expressions directly in a GPU acceleration workflow?

You can use Spark SQL expressions directly in a GPU acceleration workflow by replacing UDFs with equivalent SQL. This allows the pipeline to execute logic natively on the GPU, bypassing CPU bottlenecks during large-scale data processing.