@@ -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
0 commit comments