| name | sedona-research |
| description | Research SedonaDB spatial functions before implementation. Use when you need to understand how a SedonaDB ST_* function works before implementing it in the sx R package. MANDATORY before implementing any new sx function. |
SedonaDB Function Research Skill
Use this skill BEFORE implementing any SedonaDB function wrapper in the sx package. Research is MANDATORY - never implement without completing this workflow first.
Critical principle
Source of Truth is Distributed. SedonaDB function behavior is defined across multiple sources:
- SQL Docs define the intended user API
- Rust Source defines the actual arguments, types, and validation
- Python Tests reveal edge cases and expected behavior
NEVER guess argument types, availability, or behavior.
Research workflow
1. SQL Documentation scan
Source: .sync/sedona-db/docs/reference/sql.md
Search for the function and extract:
2. Rust registration check
Source: .sync/sedona-db/rust/sedona-functions/src/register.rs
Search for the function in register_scalar_udfs! or register_aggregate_udfs!:
If not found in register.rs, the function is NOT available to the SQL engine.
3. Rust signature verification
Source: .sync/sedona-db/rust/sedona-functions/src/st_{function}.rs
Look for ArgMatcher::new() and document:
4. Python test review
Source: .sync/sedona-db/python/sedonadb/tests/functions/
Search for test cases in test_functions.py, test_predicates.py, or similar:
5. R ecosystem check
Source: sf package documentation for the equivalent function (e.g., ?sf::st_buffer)
Compare:
6. Document findings
Create .claude/research/sedona/{function_name}.md:
# ST_{FunctionName} Research
## Summary
[1-2 sentence description focused on sx wrapper implementation]
## SQL API
**Since:** vX.Y
**Signature:** `ST_Function(geom: Geometry, arg: Type)`
### Arguments
| Argument | Type | Required | Description |
|----------|------|----------|-------------|
| geom | Geometry/Geography | Yes | Input geometry |
| arg | Double | Yes | Description |
### Return
- Type: Geometry
- NULL behavior: [describe]
## Rust Implementation
**File:** `st_{function}.rs`
**Registration:** `crate::st_{function}::st_{function}_udf`
**Volatility:** Immutable
### ArgMatcher
```rust
ArgMatcher::new(
vec![
ArgMatcher::is_geometry_or_geography(),
ArgMatcher::is_numeric(),
],
WKB_GEOMETRY,
)
sf Equivalent
Function: sf::st_function()
Unsupported sf args: [list args sx should warn about]
Key differences: [describe]
Edge Cases (from Python tests)
- NULL input returns NULL
- Empty geometry returns [describe]
- [other edge cases]
Implementation Notes
- [Any special considerations]
- [S2/Geography handling requirements]
- [CRS considerations]
Sources
## Checklist
Before proceeding to implementation:
- [ ] Found function in SQL docs with version and signature
- [ ] Confirmed registration in `register.rs`
- [ ] Verified ArgMatcher types in Rust source
- [ ] Reviewed Python test cases for edge cases
- [ ] Compared with sf equivalent function
- [ ] Created research file at `.claude/research/sedona/{function_name}.md`
- [ ] Documented all sources with file paths/URLs
## What to do after research
Proceed to implementation using the `sedona-implement` skill.