Skip to content

[fix](nereids) Make role-mapping keywords RULE/CEL/MAPPING non-reserved#64104

Merged
CalvinKirs merged 1 commit into
apache:masterfrom
CalvinKirs:rolemapping-keyword
Jun 5, 2026
Merged

[fix](nereids) Make role-mapping keywords RULE/CEL/MAPPING non-reserved#64104
CalvinKirs merged 1 commit into
apache:masterfrom
CalvinKirs:rolemapping-keyword

Conversation

@CalvinKirs

@CalvinKirs CalvinKirs commented Jun 4, 2026

Copy link
Copy Markdown
Member

#61819

The role-mapping DDL added the keywords RULE, CEL and MAPPING to the lexer but did not add them to the nonReserved rule, so they became reserved words. Common SQL that uses them as identifiers, e.g. INSERT INTO t(..., RULE, ...), started failing with "mismatched input 'RULE'".

Add the three keywords to nonReserved. They only appear in fixed, non-ambiguous positions (RULE (, USING CEL, CREATE/DROP ROLE MAPPING), so the grammar stays unambiguous: verified with ANTLR LL_EXACT_AMBIG_DETECTION reporting zero ambiguities and correct routing of CREATE ROLE MAPPING ... vs CREATE ROLE <name>.

Add unit tests in RoleMappingParserTest and an end-to-end regression case test_role_mapping_keyword.

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

@CalvinKirs

Copy link
Copy Markdown
Member Author

run buildall

morrySnow
morrySnow previously approved these changes Jun 4, 2026
@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Jun 4, 2026
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

The role-mapping DDL added the keywords RULE, CEL and MAPPING to the lexer
but did not add them to the `nonReserved` rule, so they became reserved
words. Common SQL that uses them as identifiers, e.g.
`INSERT INTO t(..., RULE, ...)`, started failing with
"mismatched input 'RULE'".

Add the three keywords to `nonReserved`. They only appear in fixed,
non-ambiguous positions (`RULE (`, `USING CEL`, `CREATE/DROP ROLE MAPPING`),
so the grammar stays unambiguous: verified with ANTLR
LL_EXACT_AMBIG_DETECTION reporting zero ambiguities and correct routing of
`CREATE ROLE MAPPING ...` vs `CREATE ROLE <name>`.

Add unit tests in RoleMappingParserTest and an end-to-end regression case
test_role_mapping_keyword.
@CalvinKirs CalvinKirs force-pushed the rolemapping-keyword branch from 5e04d29 to 808ef4a Compare June 4, 2026 06:39
@CalvinKirs

Copy link
Copy Markdown
Member Author

run buildall

@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 0.00% (0/27) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17641	4105	4112	4105
q2	q3	10748	1444	845	845
q4	4684	480	346	346
q5	7693	903	594	594
q6	190	174	139	139
q7	800	855	630	630
q8	9368	1639	1727	1639
q9	5812	4546	4544	4544
q10	6772	1812	1512	1512
q11	432	280	254	254
q12	643	434	309	309
q13	18117	3465	2724	2724
q14	265	261	239	239
q15	q16	830	774	709	709
q17	963	909	974	909
q18	6815	5735	5607	5607
q19	1299	1288	1145	1145
q20	529	423	265	265
q21	6237	2844	2792	2792
q22	456	380	322	322
Total cold run time: 100294 ms
Total hot run time: 29629 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	5252	4975	4893	4893
q2	q3	4863	5294	4747	4747
q4	2155	2277	1387	1387
q5	4881	4845	4755	4755
q6	234	184	133	133
q7	1838	1810	1692	1692
q8	2471	2224	2171	2171
q9	8064	7777	7433	7433
q10	4751	4697	4226	4226
q11	552	427	385	385
q12	735	746	538	538
q13	3028	3513	2806	2806
q14	288	284	254	254
q15	q16	690	713	638	638
q17	1319	1279	1282	1279
q18	7546	7101	6748	6748
q19	1097	1103	1102	1102
q20	2252	2224	1956	1956
q21	5377	4746	4623	4623
q22	531	457	405	405
Total cold run time: 57924 ms
Total hot run time: 52171 ms

@hello-stephen

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

query5	4320	626	480	480
query6	462	199	184	184
query7	4839	566	315	315
query8	366	224	204	204
query9	8794	4108	4096	4096
query10	443	322	266	266
query11	5960	2373	2156	2156
query12	164	106	100	100
query13	1308	634	428	428
query14	6419	5432	5100	5100
query14_1	4458	4446	4424	4424
query15	209	198	175	175
query16	1003	471	442	442
query17	1150	722	611	611
query18	2470	491	375	375
query19	213	191	145	145
query20	114	109	109	109
query21	219	150	127	127
query22	13730	13548	13327	13327
query23	17314	16407	16206	16206
query23_1	16204	16344	16382	16344
query24	7660	1786	1345	1345
query24_1	1339	1314	1330	1314
query25	581	499	467	467
query26	1294	319	164	164
query27	2671	549	346	346
query28	4425	2067	2054	2054
query29	1070	602	472	472
query30	322	232	201	201
query31	1134	1065	950	950
query32	100	59	59	59
query33	538	313	260	260
query34	1180	1153	650	650
query35	756	783	668	668
query36	1392	1394	1211	1211
query37	166	105	94	94
query38	3199	3166	3074	3074
query39	947	929	909	909
query39_1	871	866	878	866
query40	220	127	103	103
query41	67	64	62	62
query42	103	98	94	94
query43	337	333	288	288
query44	
query45	199	184	174	174
query46	1079	1200	757	757
query47	2353	2362	2213	2213
query48	408	397	300	300
query49	627	485	349	349
query50	981	385	275	275
query51	4336	4278	4271	4271
query52	88	88	76	76
query53	250	269	197	197
query54	272	225	197	197
query55	83	80	69	69
query56	248	231	219	219
query57	1445	1393	1338	1338
query58	239	209	218	209
query59	1578	1706	1466	1466
query60	286	249	235	235
query61	155	154	164	154
query62	691	659	590	590
query63	231	193	192	192
query64	2560	810	630	630
query65	
query66	1786	470	348	348
query67	29781	29734	29547	29547
query68	
query69	437	311	259	259
query70	1014	990	906	906
query71	299	224	216	216
query72	2986	2708	2484	2484
query73	839	754	435	435
query74	5122	4973	4802	4802
query75	2677	2596	2265	2265
query76	2350	1228	820	820
query77	374	392	302	302
query78	12546	12410	11913	11913
query79	1478	1035	765	765
query80	766	519	429	429
query81	521	276	253	253
query82	606	167	123	123
query83	360	278	248	248
query84	273	135	110	110
query85	936	534	435	435
query86	414	298	281	281
query87	3402	3332	3211	3211
query88	3716	2782	2765	2765
query89	441	382	329	329
query90	1820	186	188	186
query91	177	171	139	139
query92	64	65	58	58
query93	1459	1439	852	852
query94	601	355	335	335
query95	705	374	431	374
query96	1051	832	354	354
query97	2712	2678	2557	2557
query98	219	205	232	205
query99	1150	1168	1047	1047
Total cold run time: 252121 ms
Total hot run time: 169805 ms

@CalvinKirs

Copy link
Copy Markdown
Member Author

run nonConcurrent

@CalvinKirs

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

I found regression-test standard issues that should be fixed before merge. The grammar change itself is small and focused, and the FE parser unit coverage exercises both identifier usage and role-mapping DDL ambiguity. No additional user-provided focus points were specified.

Critical checkpoint conclusions:

  • Goal/test: The goal appears to be making RULE/CEL/MAPPING non-reserved in Nereids. The grammar change accomplishes that, and FE parser coverage is present. The new regression test needs to follow repository regression-test output standards.
  • Scope: The parser change is minimal and focused.
  • Concurrency/lifecycle/config/compatibility: No concurrency, lifecycle, new config, persistence, FE-BE protocol, or storage-format compatibility concerns found.
  • Parallel paths: This PR updates Nereids grammar; I did not find another changed parser path in the actual GitHub PR diff.
  • Testing: Coverage targets the right behavior, but the regression case uses inline asserts for deterministic query results and drops the table after the test, both contrary to AGENTS.md regression-test rules.
  • Observability/performance/data correctness: No new runtime observability, performance, transaction, or data-visibility concerns found for this parser-only change.

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Jun 5, 2026
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

yiguolei pushed a commit that referenced this pull request Jun 5, 2026
@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

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

@CalvinKirs CalvinKirs merged commit da0cb3b into apache:master Jun 5, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. dev/4.1.2-merged reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants