Skip to content

[fix](nereids) Fix incorrect isDomain parsing in SET PASSWORD statement#60565

Open
bobhan1 wants to merge 3 commits intoapache:masterfrom
bobhan1:fix-set-password
Open

[fix](nereids) Fix incorrect isDomain parsing in SET PASSWORD statement#60565
bobhan1 wants to merge 3 commits intoapache:masterfrom
bobhan1:fix-set-password

Conversation

@bobhan1
Copy link
Contributor

@bobhan1 bobhan1 commented Feb 6, 2026

What problem does this PR solve?

Issue Number: close #xxx

Problem Summary:

MySQL root@127.1:(none)> create user t1 identified by '12345';
Query OK, 0 rows affected
Time: 0.008s
MySQL root@127.1:(none)> show all grants;
+--------------+---------+----------+----------+----------------------+--------------+-----------------------------------------------------------------------+------------+----------+---------------+-------------------+-----------------+-------------------+--------------------+-------------------+
| UserIdentity | Comment | Password | Roles    | GlobalPrivs          | CatalogPrivs | DatabasePrivs                                                         | TablePrivs | ColPrivs | ResourcePrivs | CloudClusterPrivs | CloudStagePrivs | StorageVaultPrivs | WorkloadGroupPrivs | ComputeGroupPrivs |
+--------------+---------+----------+----------+----------------------+--------------+-----------------------------------------------------------------------+------------+----------+---------------+-------------------+-----------------+-------------------+--------------------+-------------------+
| 'admin'@'%'  | ADMIN   | No       | admin    | Admin_priv           | <null>       | internal.information_schema: Select_priv; internal.mysql: Select_priv | <null>     | <null>   | <null>        | <null>            | <null>          | <null>            | normal: Usage_priv | <null>            |
| 'root'@'%'   | ROOT    | No       | operator | Node_priv,Admin_priv | <null>       | internal.information_schema: Select_priv; internal.mysql: Select_priv | <null>     | <null>   | <null>        | <null>            | <null>          | <null>            | normal: Usage_priv | <null>            |
| 't1'@'%'     |         | Yes      |          | <null>               | <null>       | internal.information_schema: Select_priv; internal.mysql: Select_priv | <null>     | <null>   | <null>        | <null>            | <null>          | <null>            | normal: Usage_priv | <null>            |
+--------------+---------+----------+----------+----------------------+--------------+-----------------------------------------------------------------------+------------+----------+---------------+-------------------+-----------------+-------------------+--------------------+-------------------+
3 rows in set
Time: 0.019s
MySQL root@127.1:(none)> set password for 't1'@'%' = password("123");
(1105, "errCode = 2, detailMessage = user 't1'@['%'] does not exist")

Fix incorrect isDomain flag parsing in SET PASSWORD statement.

When parsing SET PASSWORD FOR 'user'@'host' statement, the isDomain flag was incorrectly set to true because the previous code used ctx.userIdentify().ATSIGN() != null to determine if a user is a domain user. Since the @ symbol always exists in 'user'@'host' format, isDomain was always true, which is wrong.

The correct behavior:

  • 'user'@'host' (single quotes) → isDomain = false (regular user)
  • 'user'@("domain") (parentheses around host) → isDomain = true (domain user)

This PR fixes the issue by reusing the existing visitUserIdentify() method which correctly handles the isDomain flag.

Release note

Fix SET PASSWORD statement incorrectly marking regular users as domain users.

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:

    • Yes. Previously SET PASSWORD FOR 'user'@'%' would fail because the user was incorrectly treated as a domain user. Now it works correctly.
  • Does this need documentation?

    • No.

Check List (For Reviewer who merge this PR)

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

@Thearas
Copy link
Contributor

Thearas commented Feb 6, 2026

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?

@bobhan1
Copy link
Contributor Author

bobhan1 commented Feb 6, 2026

run buildall

@bobhan1
Copy link
Contributor Author

bobhan1 commented Feb 6, 2026

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17584	4528	4275	4275
q2	2012	368	228	228
q3	10163	1262	749	749
q4	10197	786	310	310
q5	7548	2211	1931	1931
q6	197	175	143	143
q7	902	730	614	614
q8	9258	1362	1056	1056
q9	4658	4635	4647	4635
q10	6840	1938	1541	1541
q11	523	302	295	295
q12	341	382	223	223
q13	17792	4069	3218	3218
q14	229	233	218	218
q15	887	799	804	799
q16	680	672	644	644
q17	708	901	440	440
q18	6496	5937	6025	5937
q19	1403	1063	665	665
q20	533	572	421	421
q21	2747	1991	1928	1928
q22	379	348	290	290
Total cold run time: 102077 ms
Total hot run time: 30560 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4521	4511	4536	4511
q2	265	351	266	266
q3	2261	2849	2519	2519
q4	1583	1854	1479	1479
q5	4569	4598	4495	4495
q6	236	193	141	141
q7	2098	1922	1849	1849
q8	2601	2308	2390	2308
q9	7570	7725	7458	7458
q10	2855	3004	2542	2542
q11	543	475	463	463
q12	665	730	573	573
q13	3733	4026	3255	3255
q14	269	295	260	260
q15	819	779	769	769
q16	646	671	638	638
q17	1073	1228	1266	1228
q18	7531	7231	7211	7211
q19	823	818	810	810
q20	1917	2012	1880	1880
q21	4461	4204	4073	4073
q22	556	543	493	493
Total cold run time: 51595 ms
Total hot run time: 49221 ms

@doris-robot
Copy link

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

query1	0.05	0.05	0.05
query2	0.10	0.05	0.05
query3	0.26	0.08	0.09
query4	1.62	0.11	0.11
query5	0.26	0.25	0.24
query6	1.18	0.69	0.67
query7	0.03	0.03	0.03
query8	0.06	0.04	0.04
query9	0.57	0.49	0.52
query10	0.56	0.56	0.53
query11	0.14	0.08	0.09
query12	0.13	0.10	0.10
query13	0.63	0.60	0.62
query14	1.07	1.06	1.05
query15	0.89	0.86	0.87
query16	0.38	0.41	0.40
query17	1.14	1.10	1.14
query18	0.23	0.22	0.20
query19	2.12	2.02	2.06
query20	0.02	0.02	0.01
query21	15.41	0.26	0.15
query22	5.27	0.05	0.05
query23	16.11	0.30	0.10
query24	1.00	0.82	1.02
query25	0.12	0.15	0.13
query26	0.14	0.14	0.13
query27	0.07	0.11	0.07
query28	4.86	1.14	0.97
query29	12.54	3.95	3.20
query30	0.28	0.14	0.11
query31	2.82	0.64	0.40
query32	3.24	0.59	0.52
query33	3.32	3.21	3.22
query34	16.14	5.37	4.78
query35	4.85	4.75	4.80
query36	0.66	0.49	0.48
query37	0.11	0.07	0.07
query38	0.07	0.04	0.03
query39	0.05	0.03	0.03
query40	0.19	0.17	0.16
query41	0.08	0.04	0.03
query42	0.05	0.03	0.03
query43	0.04	0.03	0.03
Total cold run time: 98.86 s
Total hot run time: 28.96 s

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 33.33% (1/3) 🎉
Increment coverage report
Complete coverage report

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants