Skip to content

Commit

Permalink
chore: update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sunng87 committed Oct 5, 2024
1 parent 5d75f3e commit 567dc95
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/common/function/src/scalars/geo/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ impl Accumulator for GeojsonPathAccumulator {
}

fn update_batch(&mut self, columns: &[VectorRef]) -> Result<()> {
// update batch as in datafusion just provides the accumulator original
// input.
//
// columns is vec of [`lat`, `lng`, `timestamp`]
// where
// - `lat` is a vector of `Value::Float64` or similar type. Each item in
// the vector is a row in given dataset.
// - so on so forth for `lng` and `timestamp`
ensure_columns_n!(columns, 3);

let lat = &columns[0];
Expand All @@ -89,6 +97,16 @@ impl Accumulator for GeojsonPathAccumulator {
}

fn merge_batch(&mut self, states: &[VectorRef]) -> Result<()> {
// merge batch as in datafusion gives state accumulated from the data
// returned from child accumulators' state() call
// In our particular implementation, the data structure is like
//
// states is vec of [`lat`, `lng`, `timestamp`]
// where
// - `lat` is a vector of `Value::List`. Each item in the list is all
// coordinates from a child accumulator.
// - so on so forth for `lng` and `timestamp`

ensure_columns_n!(states, 3);

let lat_lists = &states[0];
Expand Down Expand Up @@ -172,7 +190,7 @@ impl Accumulator for GeojsonPathAccumulator {
/// Example:
///
/// ```sql
/// SELECT geojson_encode(lat, lon, timestamp) FROM table;
/// SELECT geojson_encode_path(lat, lon, timestamp) FROM table [group by ...];
/// ```
///
#[as_aggr_func_creator]
Expand Down

0 comments on commit 567dc95

Please sign in to comment.