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

   ### Background
   
   Lance Blob v2 scans return descriptors separately from their contents. FILE 
references must retain their source after scanner EOF and while moving between 
Doris operators and backends.
   
   ### What problem does this PR solve?
   
   Issue Number: TODO(author): the issue is opened with the PR
   Related PR: #68853 (FILE prerequisite)
   PR Type: Feature
   
   Problem Summary:
   Expose top-level Lance Blob v2 columns as FILE and retrieve selected 
payloads with FL_GET_BINARY. FE pins the dataset snapshot and storage options, 
assigns a separate query-wide source ID to each Blob column and distributes its 
read resources to participating backends. FILE values retain their source and 
native row IDs through copying, transport and aggregation; a query-owned reader 
resolves handles and reads contents on demand.
   
   ### Details
   
   - **Change map:** Production +1353/-105 lines; tests +892/-147; Thrift 
fields/comments +18/-0; no generated code or dependency/patch changes. FE maps 
types and plans per-column resources; BE builds descriptors and performs 
deferred reads; FILE columns, transport and collect_list retain private 
references; tests cover planning, identity preservation and error paths.
   - **Scope:** Remote top-level Blob v2, including inline, packed, dedicated 
and external storage supported by the pinned SDK. Local dataset roots, 
registered local bases, local external objects and nested Blob schema fields 
remain unsupported. Payloads are bounded by VARBINARY representation.
   - **Design:** Keep read resources at query scope and source/native-row IDs 
on each FILE value. Reuse dataset handles by URI, version and access options 
while resolving each Blob column separately. Keep descriptor construction and 
scan parameter utilities in lance_reader_helper; name batch construction 
build_lance_blob_descriptor_columns and single-column conversion 
convert_lance_blob_descriptors_to_file_column; reader state, timing and scan 
orchestration stay in LanceTableReader. The record-batch converter has a 
separate Blob append method alongside global row-ID append handling.
   - **Usage:** SELECT id, HEX(FL_GET_BINARY(image)) FROM 
lance_catalog.db.assets ORDER BY id;
   - **Default behavior:** Blob v2 maps to FILE automatically. Content reads 
are explicit; scanning references does not read payloads. FE rejects local 
roots and registered bases only when projecting Blob columns, using the same 
snapshot's existing Java getBasePaths API; BE rejects per-value local external 
URIs and propagates SDK failures as query errors.
   - **Compatibility:** Blob reads require execution version 20. Optional 
Thrift fields retain the release-branch IDs; field 47 remains reserved for the 
4.1 s3_resources field. DataTypeFile retains its legacy column encoding below 
version 20, while Blob references are rejected there. collect_list states 
containing FILE always use binary serialization; no compatibility with the 
unpublished JSON FILE aggregate state is promised. TLanceFileDesc.dataset_uri 
and version are marked deprecated in favor of TLanceScanParams while remaining 
populated/read for compatibility. Legacy FE split identity and temporary row-ID 
fetch RuntimeState objects remain supported. SQL FILE fields contain no read 
credentials; resources and native handles are query-local.
   - **Behavior change:** Remote top-level Lance Blob columns become readable 
as FILE. Existing inline FILE behavior and ordinary non-Blob scans are 
preserved.
   
   ### Testing
   
   Before the naming-only follow-up, BE ASAN: 120 Lance tests passed in 11 
suites, including the originally reported multi-vector case, persistent read 
errors, missing indexes, malformed global row-ID lengths and serde failures 
that must not publish partial columns. FE: 70 focused tests passed with zero 
failures/errors/skips, including native manifest registry extraction; FE 
sources are unchanged by these test-only follow-ups. build.sh --fe passed with 
Checkstyle enabled and zero violations. The original feature also passed 177 BE 
tests covering FILE copy/serialization/functions/aggregation. After removing 
the collect_list FILE legacy-format fallback, 15 focused FILE and collect 
aggregation ASAN tests passed, including opaque bytes in FILE/ARRAY/MAP/STRUCT 
at execution versions 19 and 20, nullable inputs, limits and Blob IDs. BE build 
hygiene and modified-file clang-format 16 checks passed. Production refactor 
static analysis passed previously; changed-line analysis of the collect_li
 st simplification passed without warnings. The final descriptor-helper rename 
passed 8 focused Lance Blob ASAN tests, modified-file formatting/header hygiene 
and changed-line clang-tidy. Inverse-renaming plus token comparison establishes 
unchanged behavior; the two Thrift edits are comments only.
   
   ### Notes for Reviewers
   
   Review resource assignment/distribution, FILE identity preservation and 
FL_GET_BINARY together. Blob descriptors require FE-assigned source IDs but do 
not require QueryContext while being built: row-ID fetch RPCs use temporary 
states. Six helper functions and the Blob append body were compared against 
their pre-refactor versions and retain the same tokens except for 
formatting/parameter substitution. The Blob descriptor timer still excludes 
empty batches. Vector and full-text test result helpers propagate the first 
read error; all 20 callers use fatal assertions with the full Status text 
instead of continuing an EOF loop after failure. Index-range setup, row-ID 
decoding and nested-null setup also propagate errors before their results are 
consumed. Schema name/length prerequisites are fatal, and assertion-only shape 
helpers are guarded at their caller. Per-value external URIs may trigger 
outbound BE reads through SELECT on an authorized Lance table or file TVF; no 
new artifact-load
 ing path or FE endpoint property is added.
   
   ### Release note
   
   Lance top-level Blob v2 columns can be queried as FILE and their contents 
read as VARBINARY with FL_GET_BINARY.


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