suggest-native-expression

Assesses Spark expressions for native Rust implementation in Comet and files GitHub issues.

1.3k|364|Updated Jan 15, 2024
One-click install
npx skills add https://github.com/apache/datafusion-comet --skill suggest-native-expression
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: suggest-native-expression
Source: https://github.com/apache/datafusion-comet/tree/main/.ai/skills/suggest-native-expression
Command: npx skills add https://github.com/apache/datafusion-comet --skill suggest-native-expression

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Deciding which Spark expressions running through Comet's JVM codegen dispatcher are worth reimplementing natively in Rust is error-prone and repetitive. This Skill scores candidates on Spark compatibility confidence and native performance upside, records verdicts in a persistent audit log so disqualified expressions are never re-litigated, and files exactly one well-structured GitHub issue per run.

Core Features & Use Cases

  • Candidate Selection: Builds the expression pool from Comet's serde definitions (not the docs table), excludes ruled-out families, already-assessed expressions, and ones with existing issues, then ranks by workload presence in TPC-H/TPC-DS.
  • Two-Axis Scoring: Rates compatibility confidence against a hazard checklist (JVM formatting APIs, regex features, collation, BigDecimal rounding, timezones) and native upside based on per-row allocation, vectorization techniques, and Spark fallback cases.
  • Empirical Calibration: When a rating is borderline, gathers real evidence by inspecting generated kernel code, running proxy benchmarks, or measuring allocation rates.
  • Audit Trail and Issue Filing: Appends a dated verdict line to per-category audit pages under docs/source/contributor-guide/expression-audits/ and files a labeled GitHub issue with the full assessment.
  • Use Case: A maintainer asks which codegen-dispatched expression to tackle next; the Skill surveys the pool, picks the top candidate, verifies no prior issue exists, scores it, and files a ready-to-pick-up proposal issue.

Quick Start

Run the suggest-native-expression skill with an expression name like 'mask' to assess it, or with no argument to survey the whole pool and recommend the best native candidate.

Frequently Asked Questions about suggest-native-expression

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

FAQPage Schema
How do I decide which Spark expression to implement natively in Comet?

Run this skill with no argument to survey the full pool of codegen-dispatched expressions. It builds the candidate list from the serde definitions, excludes already-assessed or ruled-out expressions, ranks by workload presence, and files one GitHub issue for the top candidate.

How do I check if a specific expression is worth a native Rust implementation?

Pass the expression name as the argument, for example 'mask'. The skill reads its serde trait, scores compatibility confidence against a hazard checklist, scores native upside from per-row allocation and vectorization potential, and records the verdict in the audit log.

What makes a native implementation faster than Comet's codegen dispatch?

The dispatcher costs one JNI round trip per batch plus per-row JVM heap allocation for non-primitive results, with no vectorization. A native kernel wins when it removes allocation that scales with batch size or applies a proven technique like zero-copy buffer reuse or an ASCII fast path.

Does the skill implement the native expression itself?

No. Its deliverables are a compatibility and upside verdict, a dated audit-log line, and one filed GitHub issue. Actual implementation is delegated to the implement-comet-expression, wire-datafusion-function, or audit-comet-expression skills depending on the proposal.

What happens when an expression fails the compatibility check?

A Low compatibility rating is a hard disqualifier regardless of upside, because the dispatcher is byte-exact with Spark. The skill records a Disqualified line with a specific named blocker in the audit log and does not file an issue.

Why does the skill build the candidate pool from serde code instead of the docs table?

The docs table's Implementation column comes from a function-registry lookup, so dispatcher-routed expressions whose SQL name does not resolve render as a dash and vanish from table-driven searches. Grepping CometCodegenDispatch in the serde sources captures all candidates reliably.