wire-datafusion-function

Wire existing DataFusion functions into Apache Comet while preserving Spark semantics.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/sp-202/datafusion-comet-geo --skill wire-datafusion-function
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wire-datafusion-function
Source: https://github.com/sp-202/datafusion-comet-geo/tree/main/.claude/skills/wire-datafusion-function
Command: npx skills add https://github.com/sp-202/datafusion-comet-geo --skill wire-datafusion-function

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the challenge of matching Spark expression semantics to Comet by wiring an existing DataFusion or datafusion-spark function into the Comet Scala serde layer and (when needed) the native UDF registration path.

Core Features & Use Cases

  • Semantics-matched wiring patterns: Selects the lightest correct integration approach (passthrough, register + passthrough, or custom serde) based on Spark contract requirements.
  • Correct Spark-to-Comet behavior: Ensures return types, null handling, ANSI error paths, type restrictions, and foldable-only argument rules are preserved.
  • Testable integration: Adds Spark SQL file tests that exercise validity bitmaps, edge cases (NaN, infinities, boundary values), and fallback behavior when serde returns None.
  • Documentation updates: Updates the expressions user guide and support matrix while relying on generated compatibility pages for per-expression details.

Quick Start

Use wire-datafusion-function to integrate the existing upstream $ARGUMENTS function into Comet by following the wiring-pattern decision, applying the Scala serde wiring, registering the UDF only when required, and adding the corresponding SQL file tests for the directly supported input types.

Frequently Asked Questions about wire-datafusion-function

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

FAQPage Schema
How do I wire a DataFusion function into Apache Comet for a Spark expression?

To wire a DataFusion function into Comet, you select the correct integration pattern, update the QueryPlanSerde.scala file with the appropriate CometScalarFunction mapping, and add Spark SQL file tests mirroring upstream input types and edge cases.

How does Comet preserve Spark semantics when integrating datafusion-spark functions?

Comet preserves Spark semantics by matching return types, null handling, ANSI error paths, input type restrictions, and foldability rules during the serde wiring process to ensure the native function adheres to the Spark contract.

When do I need to register a native UDF for a DataFusion function in Comet?

You need to register a native UDF in Comet specifically when using the datafusion-spark pattern B integration path, whereas other wiring patterns may only require a passthrough or custom serde mapping without explicit UDF registration.

What is the best way to test Spark expression compatibility after wiring a function into Comet?

The best way to test compatibility is to add Spark SQL file tests that exercise validity bitmaps, edge cases like NaN and infinities, boundary values, and fallback behavior when the Scala serde layer returns None.

Why does my wired DataFusion function fail Spark SQL tests in Comet?

Wired DataFusion functions fail Spark SQL tests in Comet when null handling, ANSI behavior, or foldability rules do not match the Spark contract, or when the incorrect serde wiring pattern was selected for the specific expression requirements.

Can I use Comet to integrate any DataFusion function with Spark expressions?

You can use Comet to integrate DataFusion functions with Spark expressions only when the upstream function already exists, requiring you to select the lightest correct integration approach to match Spark contract details accurately.