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] fix the cascadesContext.getMemo()==null #48771

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zhangm365
Copy link
Contributor

What problem does this PR solve?

fix the cascadesContext.getMemo() == null, the error:
Cannot invoke "org.apache.doris.nereids.memo.Memo.toString()" because the return value of "org.apache.doris.nereids.CascadesContext.getMemo()" is null

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:
      • 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 Mar 6, 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?

@zhangm365
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17597	5157	5061	5061
q2	2045	301	171	171
q3	10408	1309	737	737
q4	10299	1033	550	550
q5	7544	2353	2348	2348
q6	185	165	137	137
q7	931	752	618	618
q8	9318	1301	1143	1143
q9	4903	4681	4807	4681
q10	6817	2322	1934	1934
q11	458	282	259	259
q12	346	352	225	225
q13	17789	3691	3089	3089
q14	219	232	200	200
q15	526	481	482	481
q16	619	631	571	571
q17	573	861	349	349
q18	6911	6416	6358	6358
q19	1208	943	555	555
q20	312	322	200	200
q21	2882	2141	1971	1971
q22	1069	995	974	974
Total cold run time: 102959 ms
Total hot run time: 32612 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5119	5097	5130	5097
q2	263	334	239	239
q3	2190	2683	2306	2306
q4	1498	1862	1362	1362
q5	4278	4126	4153	4126
q6	206	161	124	124
q7	1866	1937	1806	1806
q8	2618	2643	2580	2580
q9	7234	7097	7206	7097
q10	2989	3228	2788	2788
q11	581	539	513	513
q12	706	779	635	635
q13	3454	3894	3262	3262
q14	289	293	274	274
q15	516	480	480	480
q16	637	695	624	624
q17	1156	1578	1342	1342
q18	7936	7752	7320	7320
q19	798	869	1012	869
q20	1977	2067	1877	1877
q21	5317	5021	4834	4834
q22	1113	1037	989	989
Total cold run time: 52741 ms
Total hot run time: 50544 ms

@@ -271,8 +271,12 @@ private Plan planWithoutLock(
// print memo before choose plan.
// if chooseNthPlan failed, we could get memo to debug
if (cascadesContext.getConnectContext().getSessionVariable().dumpNereidsMemo) {
String memo = cascadesContext.getMemo().toString();
LOG.info("{}\n{}", ConnectContext.get().getQueryIdentifier(), memo);
Memo memo = cascadesContext.getMemo();
Copy link
Contributor

Choose a reason for hiding this comment

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

why memo could be null? could u add a case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

when I set the SessionVariable().dumpNereidsMemo is true, and I run the case:

create table mytable
(
  id int, 
  name string
)
COMMENT "my first table"
DISTRIBUTED BY HASH(id) BUCKETS 1
PROPERTIES (
    "replication_num" = "1"
);

insert into mytable values(1, 'hello');

the INSERT sql will occur the error.

@doris-robot
Copy link

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

query1	971	390	383	383
query2	6533	1921	1927	1921
query3	6813	221	217	217
query4	26466	23661	23096	23096
query5	4372	666	486	486
query6	303	213	183	183
query7	4599	493	294	294
query8	295	258	237	237
query9	8602	2564	2551	2551
query10	483	321	271	271
query11	15715	15167	14960	14960
query12	151	107	104	104
query13	1648	514	394	394
query14	8995	6026	6281	6026
query15	205	183	169	169
query16	7172	635	469	469
query17	1217	698	557	557
query18	1924	394	290	290
query19	190	169	182	169
query20	117	117	117	117
query21	203	119	103	103
query22	4362	4457	4350	4350
query23	33804	33007	32883	32883
query24	8138	2343	2393	2343
query25	523	458	380	380
query26	1220	268	161	161
query27	2711	495	322	322
query28	4428	2395	2421	2395
query29	749	575	424	424
query30	283	212	193	193
query31	938	859	768	768
query32	73	64	63	63
query33	551	392	309	309
query34	787	860	509	509
query35	785	819	732	732
query36	966	989	896	896
query37	115	97	78	78
query38	4190	4097	4058	4058
query39	1440	1375	1408	1375
query40	208	113	102	102
query41	53	52	53	52
query42	127	109	104	104
query43	512	517	499	499
query44	1266	782	776	776
query45	173	170	164	164
query46	833	1032	619	619
query47	1779	1814	1726	1726
query48	372	418	307	307
query49	805	518	444	444
query50	684	733	402	402
query51	4232	4199	4164	4164
query52	113	105	100	100
query53	227	260	188	188
query54	502	493	434	434
query55	91	88	82	82
query56	298	290	278	278
query57	1135	1154	1094	1094
query58	257	248	243	243
query59	2754	2743	2783	2743
query60	300	279	274	274
query61	150	143	142	142
query62	813	767	682	682
query63	235	182	190	182
query64	4367	1010	714	714
query65	4405	4338	4333	4333
query66	1132	410	310	310
query67	15919	15688	15311	15311
query68	9355	868	499	499
query69	473	317	275	275
query70	1157	1117	1053	1053
query71	444	294	277	277
query72	5281	3477	3721	3477
query73	773	746	404	404
query74	9185	9236	8966	8966
query75	4185	3191	2692	2692
query76	3961	1200	758	758
query77	978	368	282	282
query78	9989	10130	9375	9375
query79	3322	829	586	586
query80	658	516	447	447
query81	468	258	219	219
query82	571	131	95	95
query83	203	180	155	155
query84	288	98	78	78
query85	760	346	300	300
query86	330	315	303	303
query87	4435	4668	4313	4313
query88	2898	2247	2216	2216
query89	449	315	275	275
query90	1926	208	207	207
query91	141	137	110	110
query92	74	62	57	57
query93	2046	1020	578	578
query94	708	412	294	294
query95	354	260	265	260
query96	477	559	270	270
query97	3311	3409	3340	3340
query98	220	200	199	199
query99	1410	1400	1262	1262
Total cold run time: 277609 ms
Total hot run time: 185327 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.03
query2	0.07	0.04	0.04
query3	0.23	0.06	0.06
query4	1.62	0.10	0.11
query5	0.55	0.54	0.54
query6	1.17	0.71	0.70
query7	0.02	0.02	0.01
query8	0.04	0.03	0.03
query9	0.60	0.52	0.51
query10	0.56	0.62	0.59
query11	0.15	0.11	0.11
query12	0.15	0.12	0.11
query13	0.62	0.60	0.59
query14	2.72	2.70	2.69
query15	0.93	0.86	0.84
query16	0.37	0.38	0.39
query17	1.03	1.06	1.04
query18	0.21	0.20	0.19
query19	1.91	1.82	2.00
query20	0.02	0.01	0.02
query21	15.36	0.93	0.57
query22	0.73	1.23	0.81
query23	14.73	1.38	0.68
query24	6.79	2.31	0.96
query25	0.55	0.22	0.08
query26	0.55	0.16	0.14
query27	0.05	0.05	0.05
query28	9.57	0.87	0.43
query29	12.60	4.14	3.44
query30	0.25	0.09	0.06
query31	2.82	0.58	0.39
query32	3.23	0.55	0.46
query33	2.98	3.04	3.13
query34	15.79	5.14	4.48
query35	4.53	4.51	4.51
query36	0.67	0.50	0.48
query37	0.09	0.06	0.06
query38	0.05	0.04	0.03
query39	0.04	0.03	0.02
query40	0.17	0.14	0.13
query41	0.08	0.03	0.03
query42	0.04	0.03	0.02
query43	0.04	0.04	0.03
Total cold run time: 104.72 s
Total hot run time: 31.29 s

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