Csaba Ringhofer has uploaded this change for review. ( http://gerrit.cloudera.org:8080/24540
Change subject: POC: Port native C++ geospatial functions to WKB mode ...................................................................... POC: Port native C++ geospatial functions to WKB mode Port of https://gerrit.cloudera.org/#/c/20602/ to WKB_EXPERIMENTAL mode. Functions that previously ran as Java UDFs in WKB mode now have native C++ implementations using Boost.Geometry. Only 2D geometries are supported — 3D/4D types (Z/M dimensions) are rejected at the WKB header parsing level. Architecture: The C++ implementation is layered into five concerns: - wkb-format.h: Low-level WKB binary parsing (header validation, coordinate extraction, type mapping). Assumes little-endian byte order throughout. - wkb-serialization: Reads WKB bytes into Boost.Geometry model types (point2d, linestring2d, polygon2d, etc.) and writes them back. Also provides bounding-box computation directly from raw WKB without full deserialization. - geometry-wrapper-wkb: High-level wrapper that holds one geometry instance (tagged union style via OGCType enum). Provides FromWkb/FromWkt/FromCoordinates deserialization, ToWkb/ToWkt serialization, and geometry property methods (Area, Length, Distance, NumPoints, IsSimple, etc.) that delegate to Boost.Geometry algorithms. - relation-wrapper-wkb: Template-based spatial predicate evaluator. Uses a policy pattern (ContainsPredicate, IntersectsPredicate, etc.) with double dispatch over LHS/RHS geometry types. - geospatial-functions-wkb-ir.cc: Thin entry points registered as Impala BUILTINs. These parse UDF arguments, delegate to the wrapper/serialization layers above, and return Impala UDF result types. Supporting headers: - wkt.h: WKT parsing via Boost.Geometry read_wkt(), with polygon correction. - utils.h: Binning logic (ported from ESRI BinUtils.java), ring orientation checks, and polygon assembly from rings. - formatted-double.h: Custom double type for controlled WKT output formatting. - common.h: Boost.Geometry type aliases and OGC type constants. On the frontend, HiveEsriGeospatialBuiltins is reorganized so that in WKB mode, functions with C++ natives are no longer registered as Java UDFs. A new addWkbNatives() method registers them as BUILTINs with GEOMETRY type signatures. Tests for 3D/4D functions (ST_Z, ST_M, ST_Is3D, etc.) are moved to a separate HIVE_ESRI-only test file since they are not applicable to the WKB native path. Change-Id: I0047acebd4aaa774bf6bb8ec0618515d38ad6aae --- M be/src/codegen/impala-ir.cc M be/src/exprs/geo/CMakeLists.txt M be/src/exprs/geo/common.h A be/src/exprs/geo/formatted-double.h A be/src/exprs/geo/geometry-wrapper-wkb.cc A be/src/exprs/geo/geometry-wrapper-wkb.h A be/src/exprs/geo/geospatial-functions-wkb-ir.cc M be/src/exprs/geo/geospatial-functions.h A be/src/exprs/geo/relation-wrapper-wkb.cc A be/src/exprs/geo/relation-wrapper-wkb.h A be/src/exprs/geo/utils.h A be/src/exprs/geo/wkb-format.h A be/src/exprs/geo/wkb-serialization.cc A be/src/exprs/geo/wkb-serialization.h A be/src/exprs/geo/wkt.h M be/src/exprs/scalar-expr-evaluator.cc M fe/src/compat-hive-3/java/org/apache/impala/compat/HiveEsriGeospatialBuiltins.java A testdata/workloads/functional-query/queries/QueryTest/geospatial-esri-high-dimension.test M testdata/workloads/functional-query/queries/QueryTest/geospatial-esri.test M tests/custom_cluster/test_geospatial_library.py M tests/query_test/test_geospatial_functions.py 21 files changed, 2,945 insertions(+), 367 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/40/24540/1 -- To view, visit http://gerrit.cloudera.org:8080/24540 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I0047acebd4aaa774bf6bb8ec0618515d38ad6aae Gerrit-Change-Number: 24540 Gerrit-PatchSet: 1 Gerrit-Owner: Csaba Ringhofer <[email protected]>
