Skip to content

[test](iceberg) Cover required columns on empty tables, writes and SHOW FULL COLUMNS - #69351

Merged
morningman merged 1 commit into
apache:masterfrom
morningman:b2m-t34-iceberg-show-nullable-tests
Oct 21, 2026
Merged

morningman merged 1 commit into
apache:masterfrom
morningman:b2m-t34-iceberg-show-nullable-tests

Conversation

@morningman

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: None

Related PR: #67856, #68640

Problem Summary:

In short. Tests only. #68640 shows required Iceberg columns as NOT NULL on master, as #67856 does on branch-4.1 and branch-4.2. The two implementations behave the same (master also covers the HTTP schema APIs and the MySQL protocol column metadata), but master's tests miss several cases that the 4.x tests check. This PR adds them; it changes no production code.

Original author: @hubgeter (the 4.x tests these cases come from)

Background. An Iceberg column declared NOT NULL (required) is read by Doris as nullable, so scans and expressions keep their nullable semantics, while DESC, SHOW CREATE TABLE, SHOW [FULL] COLUMNS and information_schema show the declared constraint. On master, ConnectorColumn.sourceNullable carries the declared nullability, and PluginDrivenExternalTable projects a display view next to the read schema in the same schema-cache entry.

The problem, and what it cost. These behaviors had no test on master, so a regression in any of them would go unnoticed:

Case 4.x test master before this PR
A table without any snapshot shows its required columns yes no (the table was written before the first DESC)
Writing NULL into a required column is still rejected yes no
Relaxing a column creates no snapshot; information_schema, SHOW CREATE TABLE and later writes follow it yes DESC only
SHOW FULL COLUMNS with the column comment, SHOW COLUMNS LIKE, WHERE Null = 'YES', information_schema filtered by IS_NULLABLE yes no
A hidden column keeps its declared nullability and is listed only in the full view yes no (only the visible view)

How this PR fixes it.

  • test_iceberg_show_nullable (REST catalog): checks the empty table (0 snapshots) before the first write; adds SHOW FULL COLUMNS, SHOW COLUMNS LIKE, SHOW FULL COLUMNS ... WHERE Null = 'YES' and information_schema filtered by IS_NULLABLE; checks the column comment in SHOW CREATE TABLE; writes NULL into id and value and expects "Column 'id' is declared non-nullable but contains nulls" (the message the 4.x test expects too); relaxes value, checks that the snapshot count stays 1 and that information_schema and SHOW CREATE TABLE follow, then writes NULL into value and still expects the rejection for id.
  • PluginDrivenExternalTableTest: a new test with a hidden required column checks that getBaseSchemaForDisplay(full) lists exactly the columns of getBaseSchema(full), in the same order, for both values of full, and that the hidden column is NOT NULL only in the display view. The setup of the existing display test moves into a helper both tests use.

Results. Both pass locally. The blocks already in test_iceberg_show_nullable.out are unchanged; 11 blocks are added. The new unit test fails if the display view ignores full, or if a copied display column loses its visibility.

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

…OW FULL COLUMNS

### What problem does this PR solve?

Issue Number: None

Related PR: apache#67856, apache#68640

Problem Summary: apache#68640 shows required Iceberg columns as NOT NULL in DESC,
SHOW CREATE TABLE, SHOW COLUMNS and information_schema on master, as apache#67856
does on branch-4.1 and branch-4.2. The implementation is equivalent and covers
more statements, but master's tests miss cases that the 4.x tests check:

- a table without any snapshot already shows its required columns as NOT NULL;
- only the metadata view is NOT NULL: writing NULL into a required column is
  still rejected ("Column 'id' is declared non-nullable but contains nulls"),
  and once a column is relaxed it accepts NULL while id still rejects it;
- relaxing a column creates no snapshot, and information_schema and SHOW
  CREATE TABLE follow it;
- SHOW FULL COLUMNS with the column comment, SHOW COLUMNS LIKE, SHOW FULL
  COLUMNS ... WHERE `Null` = 'YES', and information_schema filtered by
  IS_NULLABLE;
- a hidden column keeps its declared nullability and is listed only in the
  full display view.

This adds them to test_iceberg_show_nullable and PluginDrivenExternalTableTest.
No production code changes.

### Release note

None

### Check List (For Author)

- Test: Regression test / Unit Test
    - Regression test: test_iceberg_show_nullable against the iceberg docker
      REST catalog; the blocks already in its .out are unchanged
    - Unit Test: PluginDrivenExternalTableTest, which fails if the display
      view ignores `full` or a copied display column loses its visibility
- Behavior changed: No
- Does this need documentation: No

Co-authored-by: daidai <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@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?

@morningman

Copy link
Copy Markdown
Contributor Author

run buildall

@morningman

Copy link
Copy Markdown
Contributor 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.

No actionable defects found in all three changed files at head df697f2. The test-only change adds meaningful coverage for Iceberg's declared nullability while preserving nullable read semantics.

Critical checkpoint conclusions:

  • Goal and proof: the unit test exercises real schema conversion/display projection for visible and hidden columns; the regression checks empty-table metadata, required writes, and relaxed constraints. Static inspection supports the intended coverage.
  • Scope and reuse: changes stay within the existing unit test, regression suite, and expected output. The shared setup helper preserves every prior display-schema assertion.
  • Concurrency and locking: no threads, shared production state, lock ordering, or blocking behavior changes; test statements run sequentially.
  • Lifecycle and initialization: mocks/cache entries are local to each unit test, ConnectContext cleanup remains in place, and regression setup drops its catalog/database before reuse while retaining final state for debugging.
  • Configuration: no configuration additions or dynamic-setting changes.
  • Compatibility: no production API, storage format, plugin SPI, or rolling-upgrade changes.
  • Thrift/protobuf: no definition changes; cross-branch field-ID checks are inapplicable.
  • Parallel paths: visible/full display schemas, direct SHOW/FULL/LIKE, rewritten WHERE, information_schema, and SHOW CREATE are covered. Read-schema nullability remains independently asserted.
  • Conditions: the existing external-environment gate and the full/visible test loop are appropriate; no new production conditional behavior.
  • Test coverage and errors: the new cases check id and value rejection independently, successful NULL after relaxing value, and continued id rejection. Expected errors use the test/exception DSL and agree with the pinned Arrow 24 required-field check.
  • Expected results: all 17 SQL tags match the output blocks and column counts. Added values agree with the producing code, including different direct-SHOW versus information_schema type/collation representations. Rowset queries are sorted; schema order and scalar counts are stable.
  • Observability: existing assertion messages, exception checks, and golden comparisons identify failures; no new runtime path warrants logs or metrics.
  • Transactions and persistence: the snapshot assertions agree with one initial append and schema-only ALTER; failed writes do not reach commit. No journal, replay, or failover implementation changes.
  • Data writes and atomicity: added writes are controlled test data; subsequent snapshot/data checks cover accidental publication and retained committed rows. Crash handling itself is unchanged.
  • FE/BE passing: no transmitted variables or protocol changes. The existing Iceberg schema reaches Arrow with source-required fields while FE reads remain nullable.
  • Performance and memory: bounded test inputs and metadata queries add no production hot-path allocations or complexity; the existing one-cache-read assertion remains intact.
  • Other concerns and user focus: no additional user focus was supplied. No existing inline threads or confirmed P0/P1 blockers exist. All three initial risk focuses were dismissed with implementation evidence.

Both assigned reviewers returned NO_NEW_VALUABLE_FINDINGS on the same empty finding set in round 1, and the main agent independently verified their conclusions. Review converged; no unresolved candidate or uncovered changed path remains.

Validation limit: this was a static-only review. No builds, tests, cluster execution, source edits, or output regeneration were performed. Live REST/MinIO behavior and the expected-output file's generation provenance were not independently established.

Review converged after 1 round(s).

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17581	5142	5080	5080
q2	2116	324	267	267
q3	10231	1408	831	831
q4	4681	477	338	338
q5	7435	802	539	539
q6	178	180	151	151
q7	736	813	609	609
q8	9259	1320	1100	1100
q9	5540	4228	4210	4210
q10	6827	1293	1033	1033
q11	433	243	222	222
q12	638	399	284	284
q13	18084	3581	3003	3003
q14	277	274	255	255
q15	q16	741	718	645	645
q17	1189	768	589	589
q18	7036	6211	6117	6117
q19	1103	962	610	610
q20	381	343	228	228
q21	4793	2141	2350	2141
q22	360	301	250	250
Total cold run time: 99619 ms
Total hot run time: 28502 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5647	5567	5609	5567
q2	677	598	516	516
q3	5181	5415	4868	4868
q4	2019	2143	1537	1537
q5	5275	5152	5583	5152
q6	266	201	160	160
q7	2353	2113	1928	1928
q8	3158	2897	2741	2741
q9	7939	8078	8097	8078
q10	3750	3672	3196	3196
q11	613	436	429	429
q12	710	697	522	522
q13	3526	3997	3215	3215
q14	328	305	287	287
q15	q16	705	716	645	645
q17	8229	7586	7350	7350
q18	12904	12215	12820	12215
q19	947	833	822	822
q20	2125	2138	1919	1919
q21	5667	4804	4713	4713
q22	494	468	418	418
Total cold run time: 72513 ms
Total hot run time: 66278 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 150287 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 df697f2d5a8af5cd1fcbbd87acdb8a1176a9f4d0, data reload: false

query5	4309	577	443	443
query6	423	198	208	198
query7	4808	438	227	227
query8	312	170	148	148
query9	8785	3094	3115	3094
query10	475	308	255	255
query11	6038	3854	3570	3570
query12	151	90	87	87
query13	1256	430	297	297
query14	6123	3930	3680	3680
query14_1	3440	3424	3402	3402
query15	205	192	178	178
query16	959	451	391	391
query17	864	630	514	514
query18	2406	411	294	294
query19	197	161	132	132
query20	83	81	82	81
query21	206	125	109	109
query22	12980	13123	12801	12801
query23	13550	12777	12468	12468
query23_1	12638	12533	12477	12477
query24	7356	836	463	463
query24_1	453	454	467	454
query25	505	392	334	334
query26	1257	255	133	133
query27	2767	438	271	271
query28	4638	1947	1946	1946
query29	1560	597	445	445
query30	299	228	185	185
query31	1018	928	819	819
query32	167	93	94	93
query33	522	316	283	283
query34	906	855	496	496
query35	744	760	647	647
query36	811	837	723	723
query37	126	101	90	90
query38	1777	1723	1679	1679
query39	805	797	738	738
query39_1	736	731	750	731
query40	220	117	98	98
query41	72	68	68	68
query42	87	85	88	85
query43	353	369	324	324
query44	1347	674	710	674
query45	181	182	166	166
query46	841	967	562	562
query47	3037	3034	2943	2943
query48	307	326	230	230
query49	590	410	295	295
query50	696	278	220	220
query51	10518	10262	10217	10217
query52	82	80	72	72
query53	193	213	152	152
query54	251	208	200	200
query55	80	68	69	68
query56	239	219	210	210
query57	1695	1630	1590	1590
query58	293	271	265	265
query59	2093	2136	1913	1913
query60	293	254	234	234
query61	199	134	141	134
query62	389	334	285	285
query63	191	162	163	162
query64	2743	929	761	761
query65	3333	3270	3253	3253
query66	1775	409	293	293
query67	20129	20232	19890	19890
query68	2981	1024	594	594
query69	381	289	247	247
query70	803	761	757	757
query71	293	232	218	218
query72	2731	2618	2046	2046
query73	524	535	295	295
query74	4620	4495	4325	4325
query75	2347	2285	1900	1900
query76	2319	1008	607	607
query77	351	378	271	271
query78	9832	9754	9209	9209
query79	970	905	524	524
query80	577	423	345	345
query81	527	316	277	277
query82	905	133	106	106
query83	310	199	180	180
query84	313	159	103	103
query85	853	433	362	362
query86	316	240	223	223
query87	1987	1933	1799	1799
query88	3710	2675	2671	2671
query89	323	282	244	244
query90	1854	168	159	159
query91	156	153	128	128
query92	98	87	95	87
query93	1067	1031	567	567
query94	460	310	282	282
query95	566	384	303	303
query96	673	488	234	234
query97	2459	2439	2321	2321
query98	158	153	147	147
query99	773	762	647	647
Total cold run time: 234835 ms
Total hot run time: 150287 ms

@hello-stephen

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

query1	0.01	0.00	0.01
query2	0.09	0.05	0.05
query3	0.26	0.09	0.09
query4	1.61	0.12	0.10
query5	0.23	0.24	0.24
query6	1.17	0.72	0.67
query7	0.04	0.01	0.01
query8	0.06	0.04	0.03
query9	0.40	0.36	0.35
query10	0.58	0.58	0.59
query11	0.20	0.15	0.15
query12	0.18	0.14	0.14
query13	0.49	0.48	0.48
query14	1.02	1.00	1.03
query15	0.63	0.61	0.61
query16	0.35	0.35	0.34
query17	1.13	1.08	1.14
query18	0.22	0.22	0.21
query19	2.12	2.02	1.94
query20	0.02	0.01	0.01
query21	15.49	0.20	0.14
query22	4.77	0.05	0.06
query23	16.29	0.31	0.11
query24	2.86	0.52	0.31
query25	0.10	0.09	0.05
query26	1.11	0.21	0.16
query27	0.05	0.05	0.04
query28	3.82	0.86	0.40
query29	12.51	4.19	3.33
query30	0.27	0.12	0.10
query31	2.78	0.57	0.32
query32	3.22	0.60	0.49
query33	3.24	3.12	3.31
query34	15.36	4.01	3.40
query35	3.34	3.33	3.34
query36	0.55	0.43	0.43
query37	0.09	0.06	0.06
query38	0.05	0.04	0.04
query39	0.04	0.03	0.03
query40	0.16	0.15	0.14
query41	0.09	0.03	0.03
query42	0.04	0.03	0.03
query43	0.05	0.04	0.03
Total cold run time: 97.09 s
Total hot run time: 24.22 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage `` 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 100% (0/0) 🎉
Increment coverage report
Complete coverage report

@924060929 924060929 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.

Reviewed the FE test changes at df697f2. The shared fixture preserves the existing display/read-schema assertions, and the new test covers hidden required columns in both full and visible views. Regression inputs and expected output cover empty tables, SHOW filtering, NULL rejection and constraint relaxation. No blocking issue found. Source review only; no local test execution.

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 0.00% (0/1702) 🎉
Increment coverage report
Complete coverage report

@morningman
morningman merged commit b549b6c into apache:master Oct 21, 2026
39 checks passed
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.

3 participants