OIiveirra opened a new pull request, #71293:
URL: https://github.com/apache/doris/pull/71293

   ### Background
   
   Parquet stores the non-null values in a page consecutively. On a filtered 
spatial column, alternating points and nulls split a long physical run into 
many short logical runs.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #69032 (introduced native spatial columns)
   PR Type: Performance
   
   Problem Summary: The V2 reader enters the spatial SerDe for each retained 
non-null run. For a page with 1,536 selected points alternating with nulls, 
decode those points in one call. The regression test covers both spatial types, 
both encodings, and validation errors after filtering.
   
   ### Details
   
   - **Change map:** The Parquet reader selects the existing prepared nullable 
path for spatial columns. The column expands the appended row views, and the 
spatial SerDe reports errors at logical output positions. Most of the line 
changes are decoder tests.
   - **Why it was slow:** Each short run repeated decoder and SerDe setup. A 
counting SerDe recorded 1,536 calls in the alternating case and one in the 
clustered control.
   - **Optimization:** Decode the selected WKB into the output column, then 
move the appended views backwards to restore null positions. Long WKB stays in 
the same arena. Calculate the logical row and format the diagnostic only if 
validation fails.
   - **Results:** On a shared Intel Xeon Platinum 8457C host, the Release BEs 
scanned the same Iceberg V3 snapshots with the same FE and eight pinned BE 
cores. Each table had 1,048,576 rows, of which 917,504 passed the filter. 
Medians below are from 12 timed queries per version in six balanced orders.
   
     | Alternating-null column | Materialization, before → after | Query, 
before → after |
     | --- | --- | --- |
     | PLAIN Geometry | 54.2 → 37.0 ms | 212.5 → 202.5 ms |
     | PLAIN Geography | 56.7 → 38.7 ms | 223 → 208 ms |
     | Dictionary Geometry | 105.9 → 44.3 ms | 271 → 216 ms |
     | Dictionary Geography | 105.2 → 45.4 ms | 265.5 → 214 ms |
   
   - **Applicability and cost:** Filtered scalar spatial columns on pages with 
fragmented nulls reuse the selection map and need one pass to expand the views. 
Small or clustered batches keep the run-based path. In a separate clustered 
dictionary `VARBINARY` control, six paired Release comparisons with both query 
orders gave median changes of +2.9% in SQL elapsed time, −0.5% in 
materialization time, −0.9% in scanner CPU time, and −2.5% in cycles per query. 
Stage times varied with background load. There is no new setting or format 
change.
   
   ### Testing
   
   - The new native decoder test fails the fragmented-path assertion on the 
baseline. ASAN coverage checked output prefixes, point bytes, EMPTY versus 
NULL, and unselected invalid values. An additional fixture checked the error 
code and logical row for invalid WKB and embedded SRIDs. All 194 tests passed 
locally.
   - Verified row-dependent WKB checksums, counts, and lengths separately from 
timing. All 270 checks passed in the focused and full SQL comparisons. On 
alternating spatial inputs, fallback batches fell from 272 to 16. Clustered 
inputs stayed at 256 in both versions.
   
   ### Release note
   
   Speed up filtered reads of Iceberg spatial columns on Parquet pages with 
fragmented nulls.
   
   ### Check List (For Author)
   
   - Behavior changed: No
   - Does this need documentation: No
   - Pre-submission status: Ready
   
   ### AI Disclosure
   
   - Tool: OpenAI Codex
   - Generated: Implementation, tests, benchmark harness, and pull request 
description.
   - Human review: Author review status was not provided.
   


-- 
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]

Reply via email to