Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](mv) Fix sync mv def sql parse not set the db when create #48162

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

seawinde
Copy link
Contributor

@seawinde seawinde commented Feb 20, 2025

What problem does this PR solve?

Fix sync mv def sql parse not set the db when create

Such as table schema is as following

create database db1;
use db1;
create table d_table(
                k1 int null,
                k2 int not null,
                k3 bigint null,
                k4 varchar(100) null
            )
            duplicate key (k1,k2,k3)
            distributed BY hash(k1) buckets 3
            properties("replication_num" = "1");

create materialized view mv1 as 
select abs(k1)+k2+1,sum(abs(k2+2)+k3+3) from d_table group by abs(k1)+k2+1;

when we create sync mv, this sync mv is on the d_table in db1, when we use anther database such as db2

if we run such query as following,would rewrite fail and the result is wrong

select abs(k1)+k2+1,sum(abs(k2+2)+k3+3) from db1.d_table group by abs(k1)+k2+1;

the pr fix this

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Release note

Fix sync mv def sql parse not set the db when create

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:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • 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

@Thearas
Copy link
Contributor

Thearas commented Feb 20, 2025

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?

@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17607	5491	5135	5135
q2	2038	298	164	164
q3	10418	1313	724	724
q4	10201	1025	553	553
q5	7524	2490	2290	2290
q6	198	172	135	135
q7	900	759	598	598
q8	9325	1353	1213	1213
q9	4914	4623	4676	4623
q10	6801	2321	1917	1917
q11	507	278	267	267
q12	344	349	224	224
q13	17772	3701	3089	3089
q14	233	223	209	209
q15	489	466	437	437
q16	621	616	575	575
q17	597	875	342	342
q18	6771	6245	6229	6229
q19	1207	965	551	551
q20	297	310	185	185
q21	2806	2097	1923	1923
q22	361	323	300	300
Total cold run time: 101931 ms
Total hot run time: 31683 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5197	5179	5513	5179
q2	238	335	236	236
q3	2177	2669	2259	2259
q4	1425	1839	1358	1358
q5	4306	4126	4139	4126
q6	211	165	125	125
q7	1875	1824	1695	1695
q8	2676	2637	2596	2596
q9	7245	7115	7159	7115
q10	3003	3152	2763	2763
q11	576	507	479	479
q12	711	764	619	619
q13	3441	3923	3273	3273
q14	297	290	291	290
q15	498	456	458	456
q16	645	667	636	636
q17	1134	1661	1293	1293
q18	7583	7530	7269	7269
q19	797	802	879	802
q20	1952	2061	1871	1871
q21	5449	4860	4818	4818
q22	600	554	569	554
Total cold run time: 52036 ms
Total hot run time: 49812 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 183935 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 cedf43703ea904aa58103af93f6d22f592925513, data reload: false

query1	997	377	376	376
query2	6546	1921	1856	1856
query3	6787	218	219	218
query4	26156	23550	23236	23236
query5	4594	684	501	501
query6	297	198	209	198
query7	4621	524	292	292
query8	291	243	236	236
query9	8625	2547	2563	2547
query10	472	331	261	261
query11	15684	15044	15040	15040
query12	159	105	104	104
query13	1647	513	381	381
query14	9964	6185	6214	6185
query15	217	192	177	177
query16	7505	600	435	435
query17	1148	703	550	550
query18	1959	385	297	297
query19	193	204	167	167
query20	119	113	106	106
query21	213	125	102	102
query22	4337	4292	4309	4292
query23	34009	32925	32919	32919
query24	7739	2403	2380	2380
query25	541	507	385	385
query26	1232	283	154	154
query27	2416	469	340	340
query28	4187	2410	2399	2399
query29	713	538	419	419
query30	231	226	154	154
query31	931	836	812	812
query32	74	63	63	63
query33	561	355	290	290
query34	771	833	518	518
query35	782	819	743	743
query36	987	967	869	869
query37	119	101	76	76
query38	4129	4225	4066	4066
query39	1459	1382	1486	1382
query40	215	122	106	106
query41	53	56	51	51
query42	124	110	103	103
query43	515	526	495	495
query44	1275	808	803	803
query45	183	165	161	161
query46	892	1059	640	640
query47	1755	1767	1716	1716
query48	384	414	311	311
query49	808	486	411	411
query50	669	744	415	415
query51	4109	4179	4176	4176
query52	109	108	94	94
query53	229	260	186	186
query54	481	495	414	414
query55	83	79	80	79
query56	262	265	251	251
query57	1116	1115	1052	1052
query58	253	227	257	227
query59	2831	2820	2779	2779
query60	283	277	260	260
query61	117	114	117	114
query62	772	725	662	662
query63	245	193	212	193
query64	4279	979	651	651
query65	3292	3150	3122	3122
query66	1087	412	313	313
query67	15858	15513	15479	15479
query68	2309	784	547	547
query69	420	302	262	262
query70	1190	1123	1060	1060
query71	371	287	262	262
query72	5925	3580	3883	3580
query73	668	767	357	357
query74	9220	9175	8936	8936
query75	3114	3148	2680	2680
query76	2287	1179	751	751
query77	343	359	300	300
query78	9951	10095	9229	9229
query79	1111	890	605	605
query80	628	550	476	476
query81	470	278	238	238
query82	1236	128	106	106
query83	181	180	163	163
query84	246	100	82	82
query85	761	410	366	366
query86	314	314	274	274
query87	4445	4535	4422	4422
query88	3000	2240	2218	2218
query89	394	332	283	283
query90	1715	196	190	190
query91	129	137	107	107
query92	62	60	62	60
query93	1076	971	585	585
query94	477	400	307	307
query95	350	270	259	259
query96	513	529	285	285
query97	2748	2854	2692	2692
query98	223	202	201	201
query99	1305	1401	1262	1262
Total cold run time: 262873 ms
Total hot run time: 183935 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.03
query2	0.08	0.03	0.03
query3	0.24	0.07	0.07
query4	1.61	0.10	0.10
query5	0.42	0.41	0.40
query6	1.17	0.69	0.68
query7	0.02	0.02	0.02
query8	0.03	0.03	0.02
query9	0.60	0.51	0.50
query10	0.58	0.59	0.57
query11	0.15	0.10	0.11
query12	0.14	0.11	0.11
query13	0.63	0.60	0.62
query14	2.68	2.68	2.68
query15	0.98	0.88	0.87
query16	0.38	0.39	0.36
query17	1.03	1.01	1.06
query18	0.22	0.20	0.20
query19	1.94	1.82	2.01
query20	0.02	0.01	0.02
query21	15.36	0.91	0.56
query22	0.76	1.09	0.66
query23	15.04	1.41	0.60
query24	7.21	1.35	0.48
query25	0.53	0.21	0.23
query26	0.66	0.16	0.13
query27	0.06	0.05	0.05
query28	9.11	0.93	0.44
query29	12.59	3.98	3.30
query30	0.25	0.10	0.07
query31	2.82	0.61	0.40
query32	3.22	0.57	0.49
query33	3.02	3.06	3.06
query34	15.62	5.21	4.51
query35	4.55	4.55	4.60
query36	0.65	0.51	0.49
query37	0.09	0.06	0.07
query38	0.05	0.04	0.03
query39	0.03	0.02	0.03
query40	0.18	0.14	0.14
query41	0.08	0.03	0.03
query42	0.03	0.03	0.02
query43	0.04	0.04	0.03
Total cold run time: 104.91 s
Total hot run time: 30.51 s

@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17585	5366	5125	5125
q2	2056	308	178	178
q3	10407	1243	750	750
q4	10219	1013	530	530
q5	7531	2449	2303	2303
q6	187	170	141	141
q7	907	755	604	604
q8	9294	1303	1167	1167
q9	4838	4770	4544	4544
q10	6810	2312	1884	1884
q11	497	275	261	261
q12	360	353	228	228
q13	17765	3722	3173	3173
q14	227	230	207	207
q15	517	461	447	447
q16	618	619	572	572
q17	594	891	344	344
q18	6554	6161	6120	6120
q19	1209	977	556	556
q20	306	344	194	194
q21	2858	2241	1991	1991
q22	362	339	305	305
Total cold run time: 101701 ms
Total hot run time: 31624 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5165	5133	5155	5133
q2	244	329	230	230
q3	2101	2730	2350	2350
q4	1448	1839	1400	1400
q5	4221	4120	4160	4120
q6	208	166	124	124
q7	1854	1843	1668	1668
q8	2633	2553	2576	2553
q9	7174	7161	7037	7037
q10	3031	3211	2779	2779
q11	565	525	491	491
q12	691	773	614	614
q13	3516	3851	3329	3329
q14	297	290	276	276
q15	498	478	467	467
q16	627	682	635	635
q17	1145	1669	1291	1291
q18	7612	7308	7244	7244
q19	836	886	979	886
q20	2021	2015	1865	1865
q21	5421	5067	4865	4865
q22	582	580	527	527
Total cold run time: 51890 ms
Total hot run time: 49884 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 191295 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 222b915078da4130de92595a78f6b2c070ade4a1, data reload: false

query1	1304	977	925	925
query2	6211	1897	1895	1895
query3	10937	4392	4426	4392
query4	55256	24162	23419	23419
query5	5067	601	502	502
query6	358	213	195	195
query7	5130	508	316	316
query8	318	248	240	240
query9	6088	2556	2556	2556
query10	439	306	260	260
query11	15160	15297	14905	14905
query12	176	107	106	106
query13	1139	517	414	414
query14	10479	6982	7043	6982
query15	197	193	183	183
query16	6953	650	478	478
query17	1058	748	566	566
query18	1550	395	312	312
query19	208	195	175	175
query20	129	133	128	128
query21	208	138	104	104
query22	4430	4370	4492	4370
query23	33846	33256	33331	33256
query24	5760	2506	2434	2434
query25	456	478	423	423
query26	645	280	161	161
query27	1786	520	340	340
query28	2829	2511	2431	2431
query29	561	549	432	432
query30	215	193	157	157
query31	912	899	839	839
query32	70	64	59	59
query33	445	370	303	303
query34	740	858	523	523
query35	826	830	752	752
query36	961	1035	908	908
query37	121	121	82	82
query38	4228	4338	4252	4252
query39	1491	1443	1431	1431
query40	199	116	110	110
query41	52	50	50	50
query42	126	111	108	108
query43	516	536	500	500
query44	1367	827	824	824
query45	180	180	172	172
query46	880	1054	684	684
query47	1849	1882	1787	1787
query48	392	434	318	318
query49	699	546	424	424
query50	760	747	436	436
query51	4278	4336	4254	4254
query52	104	106	94	94
query53	241	268	192	192
query54	498	483	432	432
query55	86	90	79	79
query56	264	278	239	239
query57	1157	1188	1114	1114
query58	235	243	250	243
query59	2640	2941	2904	2904
query60	317	313	263	263
query61	126	114	120	114
query62	817	774	666	666
query63	236	202	203	202
query64	1404	1037	667	667
query65	3246	3187	3116	3116
query66	711	386	298	298
query67	15625	15533	15384	15384
query68	2360	796	563	563
query69	437	296	279	279
query70	1195	1145	1154	1145
query71	342	303	258	258
query72	6290	3630	3692	3630
query73	633	736	362	362
query74	9175	9135	8999	8999
query75	3130	3139	2680	2680
query76	1491	1154	754	754
query77	492	362	287	287
query78	10151	10156	9301	9301
query79	1892	874	633	633
query80	877	540	454	454
query81	517	270	235	235
query82	406	128	91	91
query83	182	167	155	155
query84	382	105	69	69
query85	771	349	312	312
query86	355	320	304	304
query87	4557	4482	4491	4482
query88	3031	2207	2200	2200
query89	395	326	290	290
query90	1704	197	194	194
query91	134	150	108	108
query92	59	59	55	55
query93	1200	1035	585	585
query94	674	413	296	296
query95	350	272	262	262
query96	503	534	283	283
query97	2766	2827	2696	2696
query98	217	207	195	195
query99	1296	1413	1258	1258
Total cold run time: 285656 ms
Total hot run time: 191295 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.06
query2	0.08	0.03	0.03
query3	0.24	0.06	0.06
query4	1.68	0.11	0.10
query5	0.50	0.42	0.40
query6	1.17	0.65	0.64
query7	0.02	0.02	0.02
query8	0.04	0.04	0.03
query9	0.60	0.51	0.51
query10	0.57	0.58	0.58
query11	0.16	0.10	0.11
query12	0.15	0.11	0.11
query13	0.61	0.59	0.60
query14	2.71	2.69	2.76
query15	0.93	0.85	0.86
query16	0.36	0.36	0.36
query17	1.02	1.03	1.01
query18	0.21	0.19	0.20
query19	1.91	1.76	2.04
query20	0.01	0.01	0.01
query21	15.36	0.92	0.55
query22	0.76	1.22	0.69
query23	14.87	1.40	0.63
query24	6.90	2.39	0.57
query25	0.55	0.18	0.13
query26	0.56	0.17	0.14
query27	0.06	0.05	0.05
query28	9.57	0.87	0.44
query29	12.61	3.99	3.30
query30	0.25	0.09	0.06
query31	2.83	0.59	0.39
query32	3.22	0.54	0.47
query33	2.98	2.99	2.98
query34	16.02	5.15	4.51
query35	4.55	4.62	4.54
query36	0.66	0.49	0.48
query37	0.09	0.07	0.07
query38	0.05	0.04	0.04
query39	0.03	0.02	0.03
query40	0.17	0.14	0.13
query41	0.07	0.02	0.03
query42	0.04	0.03	0.02
query43	0.03	0.03	0.03
Total cold run time: 105.24 s
Total hot run time: 30.34 s

Copy link
Contributor

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

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Feb 21, 2025
Copy link
Contributor

PR approved by anyone and no changes requested.

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. reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants