OIiveirra opened a new pull request, #71342: URL: https://github.com/apache/doris/pull/71342
### Background Iceberg v3 tables can expose native `GEOMETRY` and `GEOGRAPHY` columns in Doris. Today, Flight SQL clients must project `ST_AsBinary(g)` to read their WKB bytes. The resulting binary field does not tell the client how to interpret the coordinates or connect the vertices. ### What problem does this PR solve? Issue Number: #65615 (Arrow type fidelity and client-visible behavior) Related PR: #69032 (introduced native Iceberg spatial types) PR Type: Feature Problem Summary: A direct projection of a default spatial column now returns a `geoarrow.wkb` field. The FE publishes the same metadata during schema discovery that the BE sends with the result batches. GeoArrow readers can distinguish planar and spherical edges while ordinary Arrow readers can still access the WKB bytes. ### Details - **Scope:** Default top-level `GEOMETRY` and `GEOGRAPHY` result fields over Flight SQL. Nested spatial fields, custom coordinate reference systems and non-default edge algorithms remain unsupported for direct output. - **Design:** The BE writes the original WKB and NULLs through the existing Arrow binary serializer. The result field carries the GeoArrow extension name and `OGC:CRS84`. Geometry uses GeoArrow's default planar edges. Geography explicitly declares spherical edges. Only a tagged WKB result keeps 32-bit offsets across batches. Iceberg spatial writes can still use `LargeBinary` for large batches. - **Usage:** For an Iceberg table `places` with a default Geography column `location`, run `SELECT location FROM places` over Flight SQL to obtain a spherical GeoArrow field. Use `SELECT ST_AsBinary(location) FROM places` for plain WKB. - **Default behavior:** No session or server setting is required. - **Compatibility:** Ordinary `VARBINARY` and explicit `ST_AsBinary` results retain their existing Arrow representation. Direct spatial output requires a supporting FE and the BEs that serve the result. During a rolling upgrade, clients can continue using `ST_AsBinary`. The change adds no dependency or persisted format. - **Behavior change:** Direct default spatial projections that used to fail during result schema conversion now succeed. ### Testing - Local FE: all 40 tests in `DorisFlightSqlSchemaTest` passed. Local BE: the Release build and 59 targeted Arrow tests passed at the final commit. - On the initial implementation, queried a real Iceberg v3 table using Java Flight SQL. Schema discovery, flight info and the returned batches agreed for a point, a line crossing the antimeridian and SQL NULL. Read the captured IPC with PyArrow and GeoArrow and checked the original bytes of both ordinary binary columns and `ST_AsBinary`. - On the final commit, tested offset selection at the 2 GiB boundary using actual Iceberg and Flight field schemas and a supplied byte count. Restoring the previous selection rule failed both Iceberg spatial assertions. This test does not allocate a multi-GiB batch. ### Release note Flight SQL clients can select default top-level Geometry and Geography columns directly as GeoArrow WKB. ### Check List (For Author) - Behavior changed: Yes (see Details) - Does this need documentation: Yes. Update the Flight SQL client guidance in the spatial type documentation. - Pre-submission status: Ready ### AI Disclosure - Tool: OpenAI Codex - Generated: Implementation, tests, code review and PR description. - Human review: The author selected the scope and requested the Iceberg compatibility fix. Line-by-line human code review has not been reported. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
