comphead opened a new pull request, #4337:
URL: https://github.com/apache/datafusion-comet/pull/4337
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases. You can
link an issue to this PR using the GitHub syntax. For example `Closes #123`
indicates that this PR will close issue #123.
-->
Part #4150
## Rationale for this change
Spark `csc(x) = 1 / sin(x)` was unsupported in Comet, falling back to
Spark. The upstream `datafusion-spark` crate (53.1.0) ships a Spark-compatible
`SparkCsc` implementation, so we can wire it
directly with no native Rust written in this repo.
This PR also adds a new Claude Code skill that codifies the wiring
workflow used here, so future contributors can apply the same recipe
consistently.
## What changes are included in this PR?
**Wire Spark `Csc` to `datafusion-spark`:**
- `spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala` —
register `classOf[Csc] -> CometScalarFunction("csc")` in `mathExpressions`.
- `native/core/src/execution/jni_api.rs` — register `SparkCsc` in
`register_datafusion_spark_function`.
- `docs/source/user-guide/latest/expressions.md` — add `Csc` to the Math
Expressions table.
- `docs/source/contributor-guide/spark_expressions_support.md` — flip
`csc` checkbox to supported.
Upstream function:
`datafusion_spark::function::math::trigonometry::SparkCsc`. Wiring follows
Pattern B (one-line Scala passthrough + one-line UDF registration).
**New Claude Code skill `wire-datafusion-function`:**
- `.claude/skills/wire-datafusion-function/SKILL.md` — project-level skill
that walks contributors through wiring an existing DataFusion or
`datafusion-spark` function into Comet. Documents the three
wiring patterns (passthrough, UDF registration, custom serde with
restrictions), the SQL-test coverage requirements (parquet-backed inputs,
NULLs, FP edge cases, integer/decimal min/max), and the
hand-curated docs that must be updated. Complements the existing
`implement-comet-expression` skill — used here to scaffold the csc wiring.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]