apache / apache/sedona-db

rust/sedona-functions: Add `ST_xxxFromWKB()` functions

Closed
#206 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
503
Forks
61
Avg merge
2d 5h
Merged PRs (30d)
91

Description

As part of #174, there are a few functions that are the same as WKB + validation:

- ST_LinestringFromWKB (with alias: ST_LineFromWKB)
- ST_PointFromWKB

These are slightly different than our existing "FromWKB/Binary" because our existing fromwkb/binary is lazy and doesn't copy anything. We do have a validation loop and we can add an optional type validator:

https://github.com/apache/sedona-db/blob/95c156d507f9ce67dde1fd3ec6e1a196c70a39a6/rust/sedona-functions/src/st_geomfromwkb.rs#L111

...could be

```rust
if let Some(expected_geometry_type_id) = self.expected_geometry_type {
// Create a builder
executor.execute_wkb_void(|_maybe_item| {
// add them item or add null to the builder for _maybe_items whose type id doesn't match
})?;
executor.finish(builder.finish())
} else {
executor.execute_wkb_void(|_maybe_item| Ok(()))?;
args[0].cast_to(self.out_type.storage_type(), None)
}
```

The steps for adding a parameter to the Udf struct and creating the udf with documentation are very similar to https://github.com/apache/sedona-db/issues/205

Contributor guide

Open the contributing guide

Research direction

Start in rust/sedona-functions/src/st_geomfromwkb.rs at the cited validation loop, then compare the UDF parameter and documentation steps with issue #205. Add the requested ST_LinestringFromWKB/ST_LineFromWKB and ST_PointFromWKB functions with type validation, and confirm their documented names and aliases are available.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
database
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.