Skip to content

[Feature](File) Support FILE type - #68853

Open
linrrzqqq wants to merge 20 commits into
apache:masterfrom
linrrzqqq:file-type
Open

linrrzqqq wants to merge 20 commits into
apache:masterfrom
linrrzqqq:file-type

Conversation

@linrrzqqq

@linrrzqqq linrrzqqq commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

apache/doris-website#4380

Problem Summary:

Introduce FILE as an independent query type for file references, metadata, and optional inline binary content.

FILE has six nullable fields: uri, offset, size, content_type, checksum, and inline. A non-NULL FILE must have a non-NULL uri or non-NULL inline. Inline content can coexist with metadata, and URI strings are preserved without FILE-specific normalization.

This PR includes:

  • FE/BE type definitions, expression handling, and serialization. Complete FILE values are preserved through exchange, query cache, and spill, including FILE nested in ARRAY, STRUCT, and MAP values.
  • Explicit conversions between FILE and STRUCT/JSON/VARIANT, field access through ELEMENT_AT, and value propagation through conditional expressions and supported container functions.
  • TO_FILE for single-object metadata lookup and LIST_FILE for directory listing with optional recursion. LIST_FILE returns two columns: path and file. Both functions use S3-compatible resources and populate checksum from ETag without downloading contents.
  • EXPLODE_FILE and EXPLODE_FILE_OUTER, exposing six nullable fields, including VARBINARY inline.
  • JSON representation for MySQL query results, with Base64-encoded inline content and result metadata accounting for its expanded length.

Current boundaries:

  • FILE column declarations in internal tables and external catalogs are disabled, including nested FILE.
  • Whole FILE values do not support comparison, sorting, hashing, grouping, DISTINCT, or MAP keys.
  • COUNT is the only supported aggregate over FILE values. FILE arguments, results, and intermediate types are unsupported in UDFs.
  • Native FILE file input/output in CSV, JSON, ORC, and Parquet is unsupported. Arrow/Flight FILE input and query-result output are also unsupported, including nested FILE. JSON conversion remains supported for query expressions and MySQL results.
  • Remote metadata functions support S3-compatible resources only. They do not download contents or compute content digests.
Doris> CREATE TABLE IF NOT EXISTS test_file_type (
    ->     id BIGINT NOT NULL,
    ->     source STRING,
    ->     f FILE NULL
    -> )
    -> UNIQUE KEY(id)
    -> DISTRIBUTED BY HASH(id) BUCKETS 1
    -> PROPERTIES (
    ->     "replication_num" = "1"
    -> );
ERROR 1105 (HY000): errCode = 2, detailMessage = FILE columns are not supported in internal tables
-- TO_FILE
SELECT TO_FILE(
    'lzq-file-s3-resource',
    's3://linrrzqqq/doris-file-type-test/my-github-avatar.jpg'
) AS f;
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| f                                                                                                                                                                                           |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| {"uri":"s3://linrrzqqq/doris-file-type-test/my-github-avatar.jpg","offset":null,"size":158663,"content_type":"image/jpeg","checksum":"ETAG:9CE0C3466E8F035CD0A6CE3389982B15","inline":null} |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.197 sec)



-- Use ELEMENT_AT to get fields inside FILE
SELECT
    ELEMENT_AT(f, 'uri') AS uri,
    ELEMENT_AT(f, 'size') AS file_size,
    ELEMENT_AT(f, 'content_type') AS content_type,
    ELEMENT_AT(f, 'checksum') AS checksum,
    ELEMENT_AT(f, 'offset') AS file_offset,
    ELEMENT_AT(f, 'inline') AS file_inline
FROM (
    SELECT TO_FILE(
        'lzq-file-s3-resource',
        's3://linrrzqqq/doris-file-type-test/my-github-avatar.jpg'
    ) AS f
) t;
    
+----------------------------------------------------------+-----------+--------------+---------------------------------------+-------------+--------------------------+
| uri                                                      | file_size | content_type | checksum                              | file_offset | file_inline              |
+----------------------------------------------------------+-----------+--------------+---------------------------------------+-------------+--------------------------+
| s3://linrrzqqq/doris-file-type-test/my-github-avatar.jpg |    158663 | image/jpeg   | ETAG:9CE0C3466E8F035CD0A6CE3389982B15 |        NULL | NULL                     |
+----------------------------------------------------------+-----------+--------------+---------------------------------------+-------------+--------------------------+


-- LIST_FILE
SELECT *
FROM LIST_FILE(
    "resource" = "lzq-file-s3-resource",
    "uri" = "s3://linrrzqqq/doris-file-type-test/",
    "recursive" = "false"
);
+----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| path                                                     | file                                                                                                                                                                                        |
+----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| s3://linrrzqqq/doris-file-type-test/my-github-avatar.jpg | {"uri":"s3://linrrzqqq/doris-file-type-test/my-github-avatar.jpg","offset":null,"size":158663,"content_type":"image/jpeg","checksum":"ETAG:9CE0C3466E8F035CD0A6CE3389982B15","inline":null} |
+----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.838 sec)

SELECT *
FROM LIST_FILE(
    "resource" = "lzq-file-s3-resource",
    "uri" = "s3://linrrzqqq/doris-file-type-test/",
    "recursive" = "true"
);
+---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| path                                                          | file                                                                                                                                                                                            |
+---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| s3://linrrzqqq/doris-file-type-test/my-github-avatar.jpg      | {"uri":"s3://linrrzqqq/doris-file-type-test/my-github-avatar.jpg","offset":null,"size":158663,"content_type":"image/jpeg","checksum":"ETAG:9CE0C3466E8F035CD0A6CE3389982B15","inline":null}     |
| s3://linrrzqqq/doris-file-type-test/recursive-test/ciallo.jpg | {"uri":"s3://linrrzqqq/doris-file-type-test/recursive-test/ciallo.jpg","offset":null,"size":46050,"content_type":"image/jpeg","checksum":"ETAG:CF413A96214E07F3E7CCB82A8B19F792","inline":null} |
+---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.076 sec)

Release note

None

@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@linrrzqqq
linrrzqqq force-pushed the file-type branch 3 times, most recently from 09fb60b to 04bc396 Compare October 11, 2026 17:47
@linrrzqqq

Copy link
Copy Markdown
Collaborator Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review status

COMPLETE static review of PR #68853 at head 04bc39642665a04901cbacae6dbf8420c11e0014 against base 8d0eacd574c37c45f8bc8ad99f053e9ec8b564bb. I reviewed the authoritative 227-path diff, relevant upstream/downstream paths, added tests and fixtures, existing threads, and three convergence rounds. Five distinct new inline findings remain: one P1 JSON load row-integrity issue and four P2 S3/optimizer issues. There are no existing inline threads or user focus points to carry forward. All suspicious candidates have been accepted, deduplicated, or dismissed; convergence is complete.

Critical checkpoints

  • Goal and proof: The six-field FILE type is wired through FE/BE planning, casts/functions, wire formats, ORC/Arrow output, JSON input, and S3 TO_FILE/LIST_FILE. The added tests provide static oracles for many valid and invalid values, but the five inline cases show the feature is not fully correct. Builds and tests were prohibited by this review contract, so none were run.
  • Scope and reuse: The broad changes are feature-related and generally reuse struct/nullable, SerDe, TVF, and resource patterns. I found no unrelated change to call out.
  • Concurrency and locks: TO_FILE pins the selected filesystem while a mutex protects bucket switching; remote HEAD runs outside that lock. Query resource snapshots, LIST_FILE pagination/cancellation, and column copy-on-write were traced; no separate race, lock-order, or deadlock issue was substantiated.
  • Lifecycle and memory: Query-owned resources and filesystem pointers have bounded lifetimes; six-child ColumnFile/VARBINARY arena ownership remains aligned across filter, cache, spill, and transport paths. I found no shared-pointer cycle, orphan allocation, or cross-translation-unit static initialization dependency.
  • Configuration: FILE transport is gated by BE execution version 17. No new dynamic configuration item requires propagation; the new recursive TVF option has an Azure-provider semantics defect (inline finding).
  • Compatibility and storage: Touched Thrift/Protobuf values and field IDs were compared with branch-3.1, 4.0, 4.1, 4.2, and master; no reused ID or incompatible existing-struct field was found. FE/BE six-child FILE encoders/decoders and old-version gates agree in the inspected paths. ORC sparse-child and nested-null compatibility were checked in both reader paths.
  • Parallel paths, conditions, and error handling: v1/v2 JSON, both ORC readers, Arrow, CSV, Parquet, S3 listing, and HEAD were traced. Strict v1 JSON FILE failure does not roll back an earlier field from the row (P1); the other inspected malformed-value paths return errors or preserve alignment. LIST_FILE raw-key and Azure depth conditions have separate P2 findings.
  • Tests and results: Added BE/FE unit tests, regression suites, ORC fixtures, and expected outputs were inspected, not executed. The strict top-level invalid FILE, special S3 key round trip, Azure nonrecursive depth, non-null FILE literal cost, and negated FILE null-stat cases lack effective coverage.
  • Observability: Existing status/error counters and logs cover direct FILE validation and S3 failures; I found no separate logging or metric defect. The JSON row-integrity path needs an atomic rejection as described inline.
  • Transactions, persistence, and writes: FE catalog/Gson/Column persistence was checked; no EditLog, visible-version, delete-bitmap, or transaction protocol change is introduced. JSON load row atomicity is broken by the P1 finding; other inspected FILE writes validate before publishing output.
  • FE/BE variables: Checked S3 resources flow through coordinator, alternate fragment builder, and direct load planner into BE query context; no missing send path was established.
  • Performance and remaining issues: Non-null FILE literal size/numeric statistics and negated FILE null Boolean statistics produce the two P2 costing findings. No other demonstrated hot-path regression or unresolved candidate remains.

Comment thread be/src/format/json/new_json_reader.cpp Resolved
@linrrzqqq

Copy link
Copy Markdown
Collaborator Author

/review

@linrrzqqq

Copy link
Copy Markdown
Collaborator Author

run buildall

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review execution on 326d74e175bfadcae63285bf4226c291214e09a6 is incomplete for convergence: a new valuable finding appeared in the third and final permitted review round. The 228 changed paths and all candidate points were swept, and the four confirmed new P2 issues are inline. This was a static review only; no builds or tests were run.

Critical checkpoints

  • Goal and scope: The PR adds a six-field FILE value through FE/BE expressions, transport, external ORC, TO_FILE, and LIST_FILE. The changes are broad but feature related. The implementation does not fully deliver consistent URI and metadata behavior because of the four inline issues.
  • Concurrency and lifecycle: Query-scoped S3 resource snapshots are immutable; TO_FILE shares fragment state across clones, locks filesystem switching, and performs remote HEAD outside the lock. Ownership and close paths showed no additional supported race, deadlock, or retention issue.
  • Configuration and compatibility: The fixed FILE execution-version gate is 17. New thrift fields are optional; touched thrift/protobuf IDs were compared with release branches, and FE/BE format gates were checked. No separate rolling-upgrade or dynamic-configuration defect was substantiated.
  • Parallel paths and conditions: Both ORC readers, sparse/nullable projections, JSON and block transport, CSV/Parquet/Arrow boundaries, S3 and Azure clients, and legacy/New Planner/stream-load resource senders were traced. The supported gaps are the four URI/metadata cases in the inline comments.
  • Tests and results: Changed BE and FE unit tests, regression suites, and expected outputs cover principal FILE operations, error handling, and transport. They lack the raw-key MIME, Azure HEAD/list ETag, and HTTP(S) LIST_FILE cases reported here. Their runtime results were not verified because execution was prohibited.
  • Observability, persistence, and writes: Remote failures and cancellation have status paths; no separate observability issue was supported. Internal FILE columns are gated; FE persistence/replay and external ORC output were inspected. No distinct transaction, crash-atomicity, or write-path defect was substantiated.
  • FE/BE variables and performance: The S3 resource map is sent on the reviewed coordinator, distributed-planner, and stream-load paths. Remote HEAD remains per row, while client switching is lock scoped and LIST_FILE is paged; no separate actionable performance issue was substantiated.
  • Other findings and existing threads: The two existing P2 statistics issues (non-null FILE literal size and IS NOT NULL range) still apply and are not reposted. The existing raw-key lookup and Azure nonrecursive LIST_FILE P2s are fixed. The existing JSON P1 describes an OK/valid=false continuation that no longer occurs: strict FILE deserialization errors propagate through RETURN_IF_ERROR, so its ID is not carried as a blocking comment. There was no additional user-provided focus.

The three-round cap ended with the Azure LIST_FILE ETag finding in round three, so this review does not claim full convergence. All four supported issues found within the permitted rounds are included below.

const auto stat_status = filesystem->stat(uri, &metadata, &state->stat_context);
if (context->state()) RETURN_IF_CANCELLED(context->state());
RETURN_IF_ERROR(stat_status);
auto content_type = to_file_content_type(uri, metadata);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Populate Azure HEAD metadata before constructing the FILE value. For an S3_PROVIDER=AZURE resource, AzureObjStorageClient::head_object reads BlobProperties but returns only BlobSize. This TO_FILE path then guesses content_type from the suffix and leaves checksum NULL even when the blob has explicit Content-Type and ETag; for example, payload.bin stored as text/csv becomes application/octet-stream. Pass those properties through ObjStorageHeadResult and cover an Azure blob whose declared type differs from its name.

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 28946 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 326d74e175bfadcae63285bf4226c291214e09a6, data reload: false

------ Round 1 ----------------------------------
============================================
q1	17384	5696	5558	5558
q2	2078	305	285	285
q3	10183	1393	842	842
q4	4682	479	349	349
q5	7441	798	536	536
q6	190	183	156	156
q7	782	803	619	619
q8	9255	1398	1038	1038
q9	5762	4475	4443	4443
q10	6836	1303	1026	1026
q11	446	255	235	235
q12	634	412	287	287
q13	18067	3139	2421	2421
q14	281	266	248	248
q15	q16	753	724	683	683
q17	1193	749	580	580
q18	7210	6239	6196	6196
q19	1114	951	610	610
q20	389	337	241	241
q21	5522	2328	2424	2328
q22	364	317	265	265
Total cold run time: 100566 ms
Total hot run time: 28946 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	6159	6137	6112	6112
q2	656	573	564	564
q3	5186	5397	4953	4953
q4	2021	2160	1541	1541
q5	5282	5172	5980	5172
q6	257	200	160	160
q7	2259	2031	1832	1832
q8	3078	2833	2806	2806
q9	8230	8230	8227	8227
q10	3844	3697	3381	3381
q11	683	437	409	409
q12	761	764	557	557
q13	2975	3528	2508	2508
q14	319	348	294	294
q15	q16	692	721	679	679
q17	8493	7522	7366	7366
q18	13145	12412	13082	12412
q19	935	793	787	787
q20	2189	2177	1935	1935
q21	5788	4667	4933	4667
q22	491	475	408	408
Total cold run time: 73443 ms
Total hot run time: 66770 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 152194 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 326d74e175bfadcae63285bf4226c291214e09a6, data reload: false

query5	4320	589	456	456
query6	415	207	189	189
query7	4806	449	224	224
query8	324	183	164	164
query9	8755	4000	4016	4000
query10	483	315	259	259
query11	5970	3411	3206	3206
query12	137	87	81	81
query13	1259	437	323	323
query14	6537	4802	4511	4511
query14_1	4297	4256	4277	4256
query15	210	201	186	186
query16	939	482	460	460
query17	839	678	563	563
query18	2424	428	313	313
query19	197	160	140	140
query20	81	79	80	79
query21	207	136	116	116
query22	13040	13085	12829	12829
query23	13172	12363	12144	12144
query23_1	12202	12185	12163	12163
query24	7078	838	471	471
query24_1	473	488	492	488
query25	543	419	369	369
query26	1259	271	139	139
query27	2750	445	275	275
query28	4595	1948	1962	1948
query29	1539	604	471	471
query30	300	216	180	180
query31	890	767	654	654
query32	145	97	88	88
query33	518	302	245	245
query34	908	845	499	499
query35	761	771	662	662
query36	818	834	740	740
query37	131	109	89	89
query38	1809	1772	1671	1671
query39	715	696	673	673
query39_1	671	679	697	679
query40	221	120	100	100
query41	72	69	67	67
query42	83	80	83	80
query43	380	382	328	328
query44	1337	704	709	704
query45	186	185	161	161
query46	852	956	581	581
query47	3028	3040	2910	2910
query48	319	314	259	259
query49	564	387	287	287
query50	670	274	213	213
query51	10275	10429	10399	10399
query52	80	77	70	70
query53	181	211	154	154
query54	227	183	191	183
query55	73	65	59	59
query56	219	203	198	198
query57	1621	1582	1548	1548
query58	272	251	242	242
query59	2347	2407	2127	2127
query60	274	233	217	217
query61	146	137	145	137
query62	400	335	282	282
query63	204	167	176	167
query64	2715	965	766	766
query65	3439	3391	3385	3385
query66	1771	403	301	301
query67	20293	20401	19909	19909
query68	2968	992	602	602
query69	379	285	270	270
query70	941	867	881	867
query71	293	219	203	203
query72	2696	2599	2308	2308
query73	507	520	294	294
query74	4587	4479	4316	4316
query75	2334	2300	1957	1957
query76	2278	1026	606	606
query77	355	417	312	312
query78	9234	9028	8488	8488
query79	967	889	521	521
query80	754	426	332	332
query81	554	329	277	277
query82	567	134	110	110
query83	284	196	177	177
query84	313	135	101	101
query85	881	429	367	367
query86	328	236	234	234
query87	1989	1984	1827	1827
query88	3641	2725	2694	2694
query89	345	286	256	256
query90	1766	177	183	177
query91	161	141	121	121
query92	95	89	83	83
query93	1016	986	562	562
query94	481	304	286	286
query95	592	403	316	316
query96	666	514	232	232
query97	2464	2423	2314	2314
query98	161	145	142	142
query99	777	763	654	654
Total cold run time: 233914 ms
Total hot run time: 152194 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 25.59 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 326d74e175bfadcae63285bf4226c291214e09a6, data reload: false

query1	0.01	0.01	0.01
query2	0.14	0.08	0.07
query3	0.36	0.20	0.21
query4	1.60	0.21	0.21
query5	0.31	0.29	0.29
query6	1.17	0.66	0.65
query7	0.03	0.01	0.00
query8	0.09	0.07	0.08
query9	0.51	0.40	0.39
query10	0.58	0.58	0.57
query11	0.33	0.18	0.18
query12	0.31	0.19	0.19
query13	0.53	0.54	0.52
query14	0.90	0.88	0.90
query15	0.67	0.59	0.59
query16	0.37	0.37	0.37
query17	1.06	1.04	0.99
query18	0.31	0.29	0.28
query19	1.98	1.85	1.86
query20	0.02	0.01	0.01
query21	15.40	0.35	0.30
query22	4.79	0.14	0.12
query23	15.87	0.49	0.29
query24	2.43	0.58	0.43
query25	0.16	0.11	0.10
query26	0.72	0.27	0.22
query27	0.10	0.10	0.10
query28	3.36	0.86	0.43
query29	12.45	4.24	3.31
query30	0.36	0.22	0.21
query31	2.75	0.60	0.36
query32	3.23	0.64	0.50
query33	3.03	3.07	3.02
query34	15.74	4.20	3.48
query35	3.42	3.39	3.40
query36	0.58	0.49	0.48
query37	0.12	0.09	0.09
query38	0.07	0.07	0.06
query39	0.06	0.06	0.06
query40	0.21	0.17	0.17
query41	0.10	0.05	0.06
query42	0.07	0.06	0.05
query43	0.07	0.05	0.06
Total cold run time: 96.37 s
Total hot run time: 25.59 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 60.95% (348/571) 🎉
Increment coverage report
Complete coverage report

@linrrzqqq

Copy link
Copy Markdown
Collaborator Author

/review

@linrrzqqq

Copy link
Copy Markdown
Collaborator Author

run buildall

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete for 3647cb947a5e7c465fdfb664467300f7299edeee (static only). No new inline findings. The existing P2 threads on FILE literal and IS NOT NULL statistics remain applicable and are not duplicated. The earlier P1 JSON row rollback thread does not apply to this head: the FILE-specific success-with-invalid-row branch is gone, and invalid FILE decoding now propagates an error rather than continuing with a partially appended row. No existing P0/P1 blocker remains applicable.

Critical checkpoints:

  • Goal and proof: The change adds a six-field FILE value through FE/BE types, wire transport, TO_FILE, LIST_FILE, casts, field access, and EXPLODE_FILE. The added BE/FE unit cases and regression suites exercise those paths, including invalid values and resource access. Their execution was prohibited for this review, so this is a static conclusion.
  • Scope and clarity: The 185 changed paths stay within the FILE feature, supporting object metadata and version transport, and their tests. No unrelated change was identified.
  • Concurrency: TO_FILE protects lazy filesystem creation with a mutex and performs remote HEAD outside that lock. Query resources are collected per execution; LIST_FILE uses one generator task and streamed pages. No unprotected shared mutation or lock-order issue was substantiated.
  • Lifecycle and initialization: Per-statement resource snapshots reach the first BE query context through every fragment construction path; TO_FILE pins the filesystem across HEAD and checks cancellation. No new cross-translation-unit static initialization dependency, ownership cycle, or unreleased handle was found.
  • Configuration: The FE max BE execution version advances to the immutable FILE minimum, version 17. No dynamic configuration behavior is introduced.
  • Compatibility and wire IDs: The touched Thrift/protobuf definitions were compared with release branches 3.1, 4.0, 4.1 and 4.2; no reused field or enum ID or new required field was found. FILE transport, constant values, cache/spill serialization, and version gating were traced for rolling upgrades.
  • Parallel paths and conditions: Legacy coordinator, Nereids, and stream-load fragment paths all forward S3 resources. FE DDL and SQL key/function gates, nullable/constant casts, nested pruning, BE format readers, OUTFILE restrictions, and S3/Azure listing paths were checked; no distinct missed branch was substantiated.
  • Test coverage and results: Inspected positive, negative, nullable, raw-key, pagination, authorization, cache, spill, format, and persistence cases plus their expected-output files. The test outcomes and generated files were not runtime-validated in this review; no build or test was run.
  • Observability: New remote and conversion failures propagate contextual Status errors; existing query diagnostics are sufficient for the reviewed paths. No missing critical metric or excessive new INFO logging was identified.
  • Persistence, transactions, and writes: FE FILE type/literal persistence registration and replay were reviewed. FILE storage and unsupported write/format routes are gated; this PR adds no transactional FILE write path or EditLog mutation.
  • FE/BE state and performance: The resource map and FILE expression/type descriptors reach all reviewed FE/BE send paths. Listing is paginated, advances empty pages, and honors LIMIT before another fetch; no concrete CPU or memory regression was found.
  • Other issues and focus: The supplied focus file contained no extra focus. All five review scans returned NO_NEW_VALUABLE_FINDINGS; the one apparent nested-cast pruning concern was refuted by recursive type-change checking. Final changed-path and candidate sweep is complete with no unresolved point.

@linrrzqqq linrrzqqq changed the title [temp] [Feature](File) Support FILE type Oct 12, 2026
@linrrzqqq
linrrzqqq marked this pull request as ready for review October 12, 2026 06:02
@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 28840 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit afcc2850b3f7ab7a21412d1b9193ecca93d501ea, data reload: false

------ Round 1 ----------------------------------
============================================
q1	16426	5190	5074	5074
q2	2159	312	243	243
q3	9753	1378	825	825
q4	4480	517	339	339
q5	7152	824	528	528
q6	188	189	157	157
q7	756	823	607	607
q8	9193	1354	1125	1125
q9	5495	4254	4226	4226
q10	6829	1295	1024	1024
q11	433	242	224	224
q12	643	401	278	278
q13	18121	3577	2996	2996
q14	281	266	249	249
q15	q16	743	719	651	651
q17	1212	758	591	591
q18	6935	6202	6103	6103
q19	1121	972	595	595
q20	390	326	226	226
q21	5000	2489	2663	2489
q22	385	345	290	290
Total cold run time: 97695 ms
Total hot run time: 28840 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	6014	5945	5965	5945
q2	861	619	577	577
q3	5628	5836	5392	5392
q4	2033	2166	1560	1560
q5	5740	5771	5739	5739
q6	242	188	149	149
q7	2237	2068	1780	1780
q8	3027	2695	2730	2695
q9	7998	7490	7473	7473
q10	3664	3570	3160	3160
q11	587	408	382	382
q12	672	707	522	522
q13	3384	3724	3056	3056
q14	288	290	260	260
q15	q16	669	692	612	612
q17	7825	7209	6901	6901
q18	13024	12197	12859	12197
q19	916	802	800	800
q20	2134	2168	1909	1909
q21	5785	4776	4945	4776
q22	511	456	434	434
Total cold run time: 73239 ms
Total hot run time: 66319 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 151200 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit afcc2850b3f7ab7a21412d1b9193ecca93d501ea, data reload: false

query5	4321	574	448	448
query6	433	203	189	189
query7	4799	449	237	237
query8	312	164	148	148
query9	8769	3185	3181	3181
query10	471	334	254	254
query11	5969	3860	3571	3571
query12	152	98	90	90
query13	1242	449	309	309
query14	6083	3907	3646	3646
query14_1	3470	3390	3471	3390
query15	212	204	187	187
query16	942	446	478	446
query17	878	655	560	560
query18	2396	399	294	294
query19	192	160	135	135
query20	84	82	79	79
query21	206	139	111	111
query22	13015	13109	12805	12805
query23	13422	12820	12493	12493
query23_1	12510	12502	12412	12412
query24	7122	835	465	465
query24_1	476	475	472	472
query25	514	405	344	344
query26	1278	254	136	136
query27	2776	455	270	270
query28	4502	2061	2059	2059
query29	1520	599	429	429
query30	297	224	183	183
query31	1011	921	811	811
query32	148	89	89	89
query33	512	288	231	231
query34	947	856	500	500
query35	728	738	631	631
query36	823	807	729	729
query37	131	95	82	82
query38	1774	1755	1670	1670
query39	788	784	744	744
query39_1	731	737	747	737
query40	230	113	93	93
query41	69	75	62	62
query42	86	92	84	84
query43	344	353	313	313
query44	1302	707	713	707
query45	177	183	170	170
query46	849	987	577	577
query47	2792	3070	2543	2543
query48	306	323	231	231
query49	582	417	300	300
query50	711	290	217	217
query51	10561	10463	10194	10194
query52	84	83	72	72
query53	191	211	163	163
query54	259	229	193	193
query55	71	69	66	66
query56	247	224	214	214
query57	1676	1634	1606	1606
query58	285	270	261	261
query59	2114	2146	2013	2013
query60	303	249	235	235
query61	162	168	167	167
query62	386	335	292	292
query63	194	161	164	161
query64	2787	1079	955	955
query65	3327	3293	3299	3293
query66	1767	425	297	297
query67	20338	20101	20200	20101
query68	3274	1027	615	615
query69	401	289	242	242
query70	830	786	773	773
query71	295	235	214	214
query72	2904	2612	2340	2340
query73	541	538	297	297
query74	4657	4524	4355	4355
query75	2378	2282	1911	1911
query76	2154	1013	584	584
query77	369	375	275	275
query78	9945	10034	9191	9191
query79	1009	859	554	554
query80	1030	421	353	353
query81	585	320	275	275
query82	552	134	105	105
query83	278	198	176	176
query84	313	122	98	98
query85	1077	427	381	381
query86	372	241	231	231
query87	1994	1947	1816	1816
query88	3806	2796	2763	2763
query89	334	283	242	242
query90	1767	175	157	157
query91	169	155	130	130
query92	117	91	80	80
query93	1061	1034	576	576
query94	557	331	256	256
query95	578	378	307	307
query96	688	499	246	246
query97	2431	2430	2340	2340
query98	165	151	148	148
query99	774	783	651	651
Total cold run time: 235259 ms
Total hot run time: 151200 ms

@hello-stephen

Copy link
Copy Markdown
Contributor

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 76.65% (2101/2741)
Line Coverage 65.90% (38767/58824)
Region Coverage 53.71% (36390/67756)
Branch Coverage 57.20% (11860/20734)

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 24.34 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit afcc2850b3f7ab7a21412d1b9193ecca93d501ea, data reload: false

query1	0.00	0.00	0.00
query2	0.09	0.05	0.05
query3	0.26	0.09	0.08
query4	1.61	0.10	0.10
query5	0.24	0.24	0.24
query6	1.16	0.68	0.68
query7	0.04	0.01	0.00
query8	0.06	0.04	0.04
query9	0.40	0.35	0.34
query10	0.62	0.57	0.57
query11	0.19	0.15	0.15
query12	0.18	0.16	0.15
query13	0.50	0.51	0.49
query14	1.01	1.04	1.01
query15	0.63	0.60	0.60
query16	0.36	0.36	0.34
query17	1.14	1.20	1.10
query18	0.19	0.21	0.19
query19	2.05	1.97	1.97
query20	0.02	0.01	0.01
query21	15.51	0.20	0.13
query22	4.89	0.05	0.05
query23	16.27	0.33	0.12
query24	3.07	0.56	0.46
query25	0.11	0.05	0.05
query26	1.26	0.21	0.15
query27	0.05	0.04	0.04
query28	3.58	0.73	0.38
query29	12.51	4.12	3.27
query30	0.30	0.13	0.10
query31	2.77	0.56	0.32
query32	3.22	0.60	0.50
query33	3.11	3.18	3.21
query34	15.33	3.99	3.35
query35	3.37	3.34	3.33
query36	0.56	0.48	0.44
query37	0.09	0.06	0.07
query38	0.06	0.04	0.04
query39	0.04	0.03	0.03
query40	0.17	0.16	0.15
query41	0.08	0.03	0.02
query42	0.04	0.03	0.03
query43	0.04	0.03	0.04
Total cold run time: 97.18 s
Total hot run time: 24.34 s

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: Selected model is at capacity. Please try a different model.
Workflow run: https://github.com/apache/doris/actions/runs/41947775809

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 84.46% (250/296) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 93.53% (159/170) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 67.53% (32360/47917)
Line Coverage 52.40% (340550/649945)
Region Coverage 47.88% (276702/577966)
Branch Coverage 49.77% (130769/262725)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 94.05% (158/168) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.26% (35870/46429)
Line Coverage 62.54% (402032/642856)
Region Coverage 59.17% (340430/575310)
Branch Coverage 60.29% (157846/261819)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 94.05% (158/168) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.26% (35869/46429)
Line Coverage 62.53% (402008/642856)
Region Coverage 59.17% (340417/575310)
Branch Coverage 60.28% (157831/261819)

@linrrzqqq

Copy link
Copy Markdown
Collaborator Author

/review

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 94.05% (158/168) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.26% (35869/46429)
Line Coverage 62.53% (402008/642856)
Region Coverage 59.17% (340417/575310)
Branch Coverage 60.28% (157831/261819)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review status

Completed static review of PR #68853 at head afcc2850b3f7ab7a21412d1b9193ecca93d501ea against base 380912cc7344e92375c3de58ec37c99602cad013. No new inline finding is reported. The full changed-file set, authoritative diff, existing review threads, five risk focuses, and delegated review sections were rechecked. The review converged in round 1.

Critical checkpoints

  • Scope and goal: The FILE feature was traced across the six-child BE column/value/SerDe implementation, FE and Nereids types, TO_FILE and FL_GET_BINARY, LIST_FILES/EXPLODE_FILE, resource propagation, object-storage metadata, query cache/spill, and FE/BE wire descriptors. The changes remain feature-scoped.
  • Correctness: Parent and child null handling, filtering, constants, validation, JSON/PB transport, aggregate state, cache/spill paths, and result serialization were inspected. The regular JSON partial-object behavior is intentional and covered by FormatInputMatchesNamesAndFillsMissingOptionalFields; the JSONB six-field requirement is a separate strict cast contract.
  • Analysis and operator guards: FILE casts, element access, grouping/order/set/window/distinct restrictions, nested pruning, Arrow/OUTFILE boundaries, and comparison coercion were checked. The proposed join/filter comparison concern is dismissed because supportCompare(..., false) rejects FILE before legacy translation.
  • Resources and lifecycle: TO_FILE resource snapshots, prepared/routine/broker handoffs, filesystem bucket switching, cancellation, LIST_FILES pagination, output slot mapping, and Azure/S3 provider paths were reviewed. Existing resource, raw-key, MIME, Azure metadata, and aggregate-state P2 threads cover the remaining known issues; no distinct new race or lifecycle defect was found.
  • Compatibility: Thrift/protobuf ids, FILE six-child descriptors, optional fragment/list fields, FE/BE factories, and release snapshots (3.1, 4.0, 4.1, 4.2, master) were compared. No reused id, changed meaning, or new blocking protocol incompatibility was substantiated.
  • Existing blockers: Existing P1 4242705286 targets the removed legacy be/src/format/json/new_json_reader.cpp path, and existing P1 4282867982 is fixed by the current TYPE_FILE VCase dispatcher arm. Neither remains applicable, so no blocking ids are carried forward.
  • Tests and validation: Added BE/FE unit tests, regression suites, expected outputs, and fixtures were inspected statically. Builds, tests, benchmarks, formatters, and runtime validation were not run under this review contract.
  • User focus: review_focus.txt contains no additional focus. No unresolved candidate or coverage gap remains after the final changed-file and risk sweep.

Review converged after 1 round(s).

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 94.05% (158/168) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.25% (35868/46429)
Line Coverage 62.53% (402009/642856)
Region Coverage 59.20% (340563/575310)
Branch Coverage 60.28% (157836/261819)

1 similar comment
@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 94.05% (158/168) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.25% (35868/46429)
Line Coverage 62.53% (402009/642856)
Region Coverage 59.20% (340563/575310)
Branch Coverage 60.28% (157836/261819)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 94.05% (158/168) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.26% (35869/46429)
Line Coverage 62.54% (402042/642856)
Region Coverage 59.22% (340682/575310)
Branch Coverage 60.29% (157852/261819)

Comment on lines +142 to +144
public int hashCode() {
return FileType.class.hashCode();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of having different hashcodes for two FileType instances?

@linrrzqqq
linrrzqqq requested a review from Mryange as a code owner November 10, 2026 03:58
### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: FILE adds persistence hooks, scalar type guards and analysis
branches that are unnecessary for supported usage or duplicate shared checks.
Remove these guards, redundant column-schema validation and the associated tests.
Handle unsupported FILE output in Arrow type mapping, use shared DISTINCT and
generator alias checks, and align FILE DDL error messages with other types.

### Release note

EXPLODE_FILE uses the standard generator alias rules. Unsupported FILE Arrow
output is rejected during Arrow schema mapping.

### Check List (For Author)

- Test: Manual test: reviewed staged changes; git diff --cached --check,
  Checkstyle 9.3 with repository rules on the staged Java files, and
  build-support/check-build-hygiene.sh passed. Unit and regression tests were not
  rerun for this commit-grouping task. Full Maven validate was blocked by missing
  local SNAPSHOT artifacts; BE format checking requires unavailable clang-format 16.
- Behavior changed: Yes; remove unsupported-metadata guards, use common alias and
  DISTINCT validation, and report FILE Arrow rejection at the mapping boundary.
- Does this need documentation: No
### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: FILE uses bounded VARCHAR fields for uri, content_type and
checksum, introducing arbitrary limits and extra BE compatibility handling when
block metadata represents them as STRING. Use STRING consistently in FE and BE,
validate descriptors against that canonical schema, and update MySQL display
metadata. Update type tests and cover serialization of a URI longer than 65533 bytes.

### Release note

FILE uri, content_type and checksum fields use STRING instead of bounded VARCHAR.

### Check List (For Author)

- Test: Manual test: reviewed staged changes; git diff --cached --check,
  Checkstyle 9.3 with repository rules on modified Java files, and
  build-support/check-build-hygiene.sh passed. Unit and regression tests were not
  rerun for this commit-grouping task. Full Maven validate was blocked by missing
  local SNAPSHOT artifacts; BE format checking requires unavailable clang-format 16.
- Behavior changed: Yes; FILE text fields use STRING and expose updated type and
  MySQL display metadata.
- Does this need documentation: No
### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: Query-local FILE S3 resource snapshots are stored in
ConnectContext and manually cleared when an execution starts. Move registration
and snapshot ownership into PlanTranslatorContext, share that snapshot between
TO_FILE and LIST_FILES scans, and pass resources through NereidsPlanner and
CoordinatorContext to pipeline parameters. Remove unused stream-load plumbing and
replace connection-scoped tests with plan-scoped snapshot and translation tests.

### Release note

None

### Check List (For Author)

- Test: Manual test: reviewed staged changes; git diff --cached --check and
  Checkstyle 9.3 with repository rules on modified Java files passed. Unit and
  regression tests were not rerun for this commit-grouping task. Full Maven
  validate was blocked by missing local SNAPSHOT artifacts.
- Behavior changed: No; preserve shared snapshots within a plan and refresh them
  for the next plan while removing connection-scoped resource state.
- Does this need documentation: No
linrrzqqq added a commit to linrrzqqq/doris that referenced this pull request Nov 11, 2026
### What problem does this PR solve?

Related PR: apache#68853

Problem Summary: Keep FILE column restrictions in ColumnDefinition, with column and type context in errors. Reuse the existing table and asynchronous MV column validation paths, remove FILE-specific MV and distribution guards, and let IN use its existing complex-type legality checks. Remove the FILE-specific AGG_STATE restriction from general data type validation so query types remain separate from column storage restrictions.

### Release note

FILE column validation errors include the column name, actual type, and storage restriction.

### Check List (For Author)

- Test: Checkstyle and git diff --check passed. Compilation and tests were not run at the user's request.
- Behavior changed: Yes, column errors include context and general type validation no longer rejects FILE-containing aggregate-state types.
- Does this need documentation: No
linrrzqqq and others added 4 commits November 12, 2026 12:03
### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: Explicit FILE casts still accept NULL and identical types,
including nested FILE containers, despite FILE casts being unsupported. Reject
these casts in CheckCast so CAST and TRY_CAST cannot bypass the restriction.
Construct FILE-valued test fixtures with TO_FILE(resource, NULL). Update
expression, constant-folding, DDL and
regression coverage to exercise the intended boundaries. Create test resources
through the existing SQL test helper instead of calling protected setters.

### Release note

CAST and TRY_CAST involving FILE or containers containing FILE reject NULL and
identity casts. TO_FILE(resource, NULL) remains supported.

### Check List (For Author)

- Test: Validated the combined branch with an FE build, 42 passing tests in
  FileTypeExpressionTest and FileTypeDdlTest, and passing regression suites
  test_file_type_internal_disabled and test_modify_struct. git diff --check passed.
- Behavior changed: Yes; reject every explicit FILE cast, including NULL,
  identity casts and nested containers.
- Does this need documentation: No
### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: Expression.checkInputDataTypes invokes a FILE-specific
post-check whose dispatcher enumerates InSubquery and WindowExpression. This
couples generic expression validation to individual FILE cases. Restore the
ordinary validation flow and move the existing checks into each expression's
checkInputDataTypesInternal override. Reuse checkFileKey and remove the special
instanceof dispatcher while preserving recursive validation, error order and
messages. Add coverage for both IN operands, nested FILE types, window partition
and order keys, recursive aliases and valid FILE-valued window results.

### Release note

None

### Check List (For Author)

- Test: Checkstyle 9.3 with repository rules on all five changed Java files and
  git diff --cached --check passed. FE production and test compilation completed.
  Ran run-fe-ut.sh --run
  FileKeyInputTypeTest,FileTypeExpressionTest,ExtractAndNormalizeWindowExpressionTest:
  FileKeyInputTypeTest passed 4 tests and ExtractAndNormalizeWindowExpressionTest
  passed 3 tests. FileTypeExpressionTest failed during TestWithFeService.beforeAll
  because HTTP server port allocation failed, before its test cases ran; the
  overall test command therefore exited with a failure. Regression suites were
  not run.
- Behavior changed: No; preserve FILE key restrictions and existing diagnostics
  through the expression-specific validation hooks.
- Does this need documentation: No
### What problem does this PR solve?

Related PR: apache#68853

Problem Summary: Keep FILE column restrictions in ColumnDefinition, with column and type context in errors. Reuse the existing table and asynchronous MV column validation paths, remove FILE-specific MV and distribution guards, and let IN use its existing complex-type legality checks. Remove the FILE-specific AGG_STATE restriction from general data type validation so query types remain separate from column storage restrictions.

### Release note

FILE column validation errors include the column name, actual type, and storage restriction.

### Check List (For Author)

- Test: FE build, 42 tests in FileTypeExpressionTest and FileTypeDdlTest, and
  regression suites test_file_type_internal_disabled and test_modify_struct
  passed on the combined branch. git diff --check passed.
- Behavior changed: Yes, column errors include context and general type validation no longer rejects FILE-containing aggregate-state types.
- Does this need documentation: No
@linrrzqqq

Copy link
Copy Markdown
Collaborator Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of head 003ed3a: two new verified findings, P1 FILE descriptor incompatibility during upgrades and P2 missing S3 resources on first stream/routine-load execution. The P1 needs correction before merge. Findings are supported by static producer/consumer traces; no builds, tests, benchmarks, or runtime provider/upgrade checks were executed.

The affected load flow is an ordinary scalar projection, so the FILE table-column prohibition does not prevent it:

OlapTableSink(file_size BIGINT)
  LoadProject(file_size := ELEMENT_AT(TO_FILE('res', uri), 'size'))
    LoadScan(uri STRING)

Critical checkpoint conclusions:

  1. Goal and behavior: independent six-field query FILE values, metadata producers, JSON results, and nested value transport are integrated; the two inline findings identify incomplete load and upgrade behavior. Current explicit FILE casts are deliberately rejected.
  2. Scope and reuse: the cross-module scope follows the type integration; fixed-schema helpers, shared field projection, and shared metadata/ETag conversion provide reuse. No further scope defect was established.
  3. Concurrency and locks: resource copying uses the resource read lock; shared TO_FILE client/bucket changes use a mutex, with each remote stat outside it while retaining a shared filesystem. No additional race or lock inversion was found.
  4. Lifecycle and static initialization: query-map alias ownership, RuntimeState/FunctionContext clone lifetime, column COW, and explode input cleanup were traced. New constant tables do not introduce a cross-TU initialization dependency.
  5. Configuration: no new operator configuration item; normal SQL captures current resource properties during translation. Lazy client creation preserves NULL-URI behavior.
  6. Incompatible changes: P1 changes already-supported branch-4.1 FILE child descriptors from VARCHAR to STRING without compatible readers/writers or a capability gate; both upgrade orders fail.
  7. Thrift/protobuf allocation: all touched definitions were compared with branches 3.1, 4.0, 4.1, and 4.2. New numbers are unused or identical and existing structs gain optional members; matching ids do not cure the P1 child-schema mismatch.
  8. Parallel paths: normal SQL, point-query fallback, prepared execution, S3/Azure, direct/recursive listing, and load entry points were checked. P2 is confined to the new first-execution stream/routine omission; the existing broker handoff issue is suppressed.
  9. Conditional checks and errors: canonical child schemas, constant selectors, locator/range/metadata validation, cancellation, and output-format rejection have concrete failure paths. Deliberate unsupported direct-aggregate/Python/Arrow boundaries are not new findings.
  10. Test coverage: inspected all changed BE/FE unit tests and regression suites, including null/empty/binary, malformed input, nested/constant/COW, metadata, pagination/LIMIT, cancellation, and concurrency cases. The load-map and mixed-version descriptor cases need coverage with their fixes.
  11. Expected results: inspected changed outputs against suite SQL and ordering/count expectations; no additional incorrect result was established. Test execution and output-generation provenance were not verified.
  12. Observability: metadata requests retain existing latency/rate-limit instrumentation and provider/path errors; no additional observability defect was established.
  13. Persistence and transactions: both Gson registries include FILE. This change adds no transaction journal transition; table FILE storage is prohibited. No new visible-version/delete-bitmap mechanism is involved.
  14. Writes and atomicity: new remote operations read metadata; expression errors avoid publishing partial results. Existing scalar transactional loads are affected by the P2 setup failure.
  15. FE/BE variable passing: normal SQL carries resources through pipeline parameters to QueryContext; direct stream/routine planning drops its collector-local map. This is the P2 finding.
  16. Performance: listing retains one provider page and the current batch; metadata getters share selected storage. Previously reported getter/constant-concat copy concerns are suppressed.
  17. Further issues and coverage limits: all 158 changed paths and initial risk items received complete-review and integration coverage; candidates were accepted, dismissed with evidence, or deduplicated. No unresolved static-review question remains after the final round. Runtime correctness, mixed-version execution, and test success remain unexecuted validation limits.

Existing context: all 60 current inline comments and replies were checked. The old CASE P1 is fixed by the TYPE_FILE dispatcher arm; the old strict FILE JSON-input P1 path is absent and native FILE table input is disabled. Neither is independently confirmed as an existing blocker. Known P2 issues, including broker resource handoff, escaped aggregate-state metadata and mixed-inline copying, are not reposted. The new load finding requires neither credential rotation nor cached-plan reuse; the new compatibility finding concerns actual descriptor interpretation, beyond the earlier VARCHAR/STRING design question. No additional user focus was supplied.

Review converged after 3 round(s).

}
if (node.type == TTypeNodeType::FILE) {
constexpr TPrimitiveType::type child_types[] = {
TPrimitiveType::STRING, TPrimitiveType::BIGINT, TPrimitiveType::BIGINT,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Preserve the FILE child schema during rolling upgrades

branch-4.1 already supports these FILE ids, but its FileType.canonicalFields() emits VARCHAR(65533) for uri and VARCHAR(1024) for content_type/checksum. This validation and its protobuf counterpart require STRING, so a 4.1 FE's TO_FILE/list_files plan fails on an upgraded BE with FILE requires its canonical scalar children. Upgrading FE first also fails because current FileType emits STRING while the 4.1 BE requires VARCHAR. Retain a compatible writer schema or capability-gate the change, normalize both representations on read, and cover both upgrade orders.


// Only used for AI Functions
params.setAiResources(collectAiResources(connectContext));
params.setS3Resources(coordinatorContext.s3Resources);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Forward the S3 snapshot to stream and routine loads

A load mapping such as file_size=ELEMENT_AT(TO_FILE('res', uri), 'size') is accepted for a BIGINT destination. NereidsLoadPlanInfoCollector translates it with a local PlanTranslatorContext, but drops that context's s3Resources; NereidsStreamLoadPlanner builds fragment parameters directly and never calls this setter. FunctionToFile::open therefore fails with missing query resources on the first load/task, even for NULL URI input. Carry the collector snapshot into the direct load parameters. This is a separate stream/routine instance from the known broker handoff and stale-snapshot-after-rotation threads: no credential change or plan reuse is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants