Skip to content

Commit bcf1aa2

Browse files
committed
geo types impl
1 parent 40e6746 commit bcf1aa2

29 files changed

Lines changed: 5289 additions & 23 deletions

clippy.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# The kernel Error enum contains large variants (ArrowError, ObjectStore::Error) that push
2+
# the enum past clippy's default 128-byte threshold. Raise the threshold to accommodate the
3+
# existing design rather than boxing all error variants.
4+
large-error-threshold = 200

ffi/src/expressions/engine_visitor.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,32 @@ fn visit_expression_scalar(
593593
}
594594
Scalar::Array(array) => visit_expression_array(visitor, array, sibling_list_id),
595595
Scalar::Map(map_data) => visit_expression_map(visitor, map_data, sibling_list_id),
596+
// v1: geo scalars are not exposed over FFI. There is no `visit_literal_geometry` /
597+
// `visit_literal_geography` callback in `EngineExpressionVisitor`, and no corresponding
598+
// `visit_expression_literal_geometry` / `_geography` FFI entry point exists in
599+
// `kernel_visitor.rs`, so engines cannot construct these variants from C. Hitting this
600+
// path means an expression containing a geo literal was built in Rust-only code and is
601+
// being walked across the FFI boundary -- the CRS information carried on the Scalar is
602+
// dropped here and a null literal is substituted so the sibling list stays well-formed.
603+
//
604+
// Upgrade path (see plan doc appendix): add nullable
605+
// `visit_literal_geometry: Option<extern "C" fn(...)>` fields to
606+
// `EngineExpressionVisitor` and sibling `extern "C" fn visit_expression_literal_geometry`
607+
// kernel-side entries. Keep this arm as a fallback when the nullable field is None.
608+
Scalar::Geometry(_) => {
609+
tracing::error!(
610+
"FFI does not yet support Scalar::Geometry; routing to null literal. \
611+
Add visit_literal_geometry callbacks to support round-tripping CRS."
612+
);
613+
call!(visitor, visit_literal_null, sibling_list_id)
614+
}
615+
Scalar::Geography(_) => {
616+
tracing::error!(
617+
"FFI does not yet support Scalar::Geography; routing to null literal. \
618+
Add visit_literal_geography callbacks to support round-tripping CRS."
619+
);
620+
call!(visitor, visit_literal_null, sibling_list_id)
621+
}
596622
}
597623
}
598624

ffi/src/schema.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ fn visit_schema_impl(schema: &StructType, visitor: &mut EngineSchemaVisitor) ->
328328
&DataType::DATE => call!(visit_date),
329329
&DataType::TIMESTAMP => call!(visit_timestamp),
330330
&DataType::TIMESTAMP_NTZ => call!(visit_timestamp_ntz),
331+
DataType::Primitive(PrimitiveType::Geometry(_) | PrimitiveType::Geography(_)) => {
332+
call!(visit_binary)
333+
}
331334
}
332335
}
333336

0 commit comments

Comments
 (0)