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](Planner) fix escape character when used in create view #45187

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

Conversation

LiBinfeng-01
Copy link
Collaborator

@LiBinfeng-01 LiBinfeng-01 commented Dec 9, 2024

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:
when using escape character '' in create view as select statement, it would failed because SelectStmt toSql implementation remove first escape character

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

@doris-robot
Copy link

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?

@LiBinfeng-01
Copy link
Collaborator Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17633	7432	7310	7310
q2	2047	177	175	175
q3	10544	1129	1099	1099
q4	10214	768	757	757
q5	7579	2714	2677	2677
q6	238	149	150	149
q7	1001	622	615	615
q8	9255	1829	1926	1829
q9	6696	6522	6489	6489
q10	7047	2286	2326	2286
q11	463	277	253	253
q12	409	221	214	214
q13	17765	3018	2998	2998
q14	258	216	210	210
q15	567	525	526	525
q16	668	585	588	585
q17	980	495	535	495
q18	7422	6723	6735	6723
q19	1326	979	893	893
q20	462	181	185	181
q21	4001	3218	3122	3122
q22	377	313	326	313
Total cold run time: 106952 ms
Total hot run time: 39898 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7229	7251	7245	7245
q2	339	234	238	234
q3	2927	2790	3022	2790
q4	2083	1826	1796	1796
q5	5552	5667	5595	5595
q6	220	133	134	133
q7	2191	1778	1825	1778
q8	3376	3549	3490	3490
q9	9020	9034	8955	8955
q10	3630	3600	3567	3567
q11	605	506	512	506
q12	820	633	635	633
q13	11006	3190	3160	3160
q14	297	271	269	269
q15	565	539	528	528
q16	673	642	626	626
q17	1830	1579	1546	1546
q18	7964	7346	7527	7346
q19	1650	1576	1553	1553
q20	2058	1819	1800	1800
q21	5513	5406	5360	5360
q22	643	546	561	546
Total cold run time: 70191 ms
Total hot run time: 59456 ms

Comment on lines +138 to 141
if (value.equals("\\")) {
value = "\\\\";
}
return "'" + value.replaceAll("'", "''") + "'";
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we need a util to process string escape.
mysql doc: https://dev.mysql.com/doc/refman/8.4/en/string-literals.html

@doris-robot
Copy link

TPC-DS: Total hot run time: 191137 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 1c14cc65b087c44c209be87bcc75a2e5b743151d, data reload: false

query1	999	385	394	385
query2	6532	2115	2080	2080
query3	6713	237	217	217
query4	34003	23495	23703	23495
query5	4396	475	450	450
query6	297	182	175	175
query7	4623	306	305	305
query8	300	235	228	228
query9	9656	2703	2712	2703
query10	481	264	265	264
query11	18193	15354	15201	15201
query12	161	105	105	105
query13	1650	410	404	404
query14	9630	7494	7227	7227
query15	297	190	182	182
query16	7975	452	482	452
query17	1808	605	563	563
query18	2091	307	306	306
query19	368	156	149	149
query20	157	110	114	110
query21	212	99	106	99
query22	4567	4355	4282	4282
query23	34927	34659	34036	34036
query24	11632	2490	2381	2381
query25	663	373	390	373
query26	1795	154	151	151
query27	2792	283	269	269
query28	7898	2436	2431	2431
query29	1005	410	401	401
query30	299	150	164	150
query31	1032	801	830	801
query32	97	57	54	54
query33	763	292	288	288
query34	1002	515	518	515
query35	874	735	751	735
query36	1111	971	956	956
query37	268	76	78	76
query38	4313	4244	4161	4161
query39	1464	1415	1442	1415
query40	275	98	101	98
query41	46	44	41	41
query42	110	95	96	95
query43	534	495	487	487
query44	1254	798	789	789
query45	179	168	164	164
query46	1163	697	700	697
query47	1989	1890	1855	1855
query48	404	299	317	299
query49	1236	389	393	389
query50	810	380	370	370
query51	7287	7145	7096	7096
query52	101	91	85	85
query53	253	191	174	174
query54	1095	397	384	384
query55	79	79	75	75
query56	261	234	229	229
query57	1266	1131	1096	1096
query58	232	207	214	207
query59	3387	3127	3054	3054
query60	269	244	268	244
query61	108	106	105	105
query62	847	681	662	662
query63	212	179	180	179
query64	5113	651	615	615
query65	3270	3162	3214	3162
query66	1221	309	325	309
query67	16145	15813	15637	15637
query68	4609	554	552	552
query69	417	256	248	248
query70	1177	1075	1105	1075
query71	315	248	242	242
query72	6328	4070	4062	4062
query73	776	355	362	355
query74	10361	9021	8949	8949
query75	3384	2626	2684	2626
query76	2802	1098	1160	1098
query77	509	356	268	268
query78	10634	9450	9534	9450
query79	1096	589	591	589
query80	859	437	420	420
query81	532	228	233	228
query82	335	120	127	120
query83	257	147	145	145
query84	232	73	68	68
query85	1151	303	292	292
query86	415	306	298	298
query87	4714	4646	4540	4540
query88	4085	2181	2179	2179
query89	403	295	298	295
query90	2104	186	183	183
query91	136	101	104	101
query92	63	49	49	49
query93	1470	529	524	524
query94	782	308	297	297
query95	345	246	241	241
query96	607	273	275	273
query97	2839	2681	2736	2681
query98	215	196	203	196
query99	1583	1327	1321	1321
Total cold run time: 301725 ms
Total hot run time: 191137 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.04
query2	0.07	0.04	0.04
query3	0.23	0.07	0.07
query4	1.61	0.10	0.10
query5	0.41	0.43	0.42
query6	1.14	0.66	0.66
query7	0.02	0.01	0.01
query8	0.04	0.04	0.03
query9	0.57	0.52	0.50
query10	0.56	0.56	0.57
query11	0.15	0.10	0.11
query12	0.14	0.11	0.11
query13	0.63	0.60	0.60
query14	2.81	2.84	2.77
query15	0.91	0.82	0.82
query16	0.39	0.38	0.38
query17	1.02	1.04	1.01
query18	0.22	0.22	0.22
query19	1.93	1.86	2.02
query20	0.01	0.01	0.01
query21	15.36	0.60	0.56
query22	2.49	2.64	2.42
query23	16.83	1.02	0.76
query24	3.30	0.98	1.10
query25	0.22	0.14	0.13
query26	0.53	0.15	0.14
query27	0.05	0.04	0.04
query28	10.68	1.11	1.07
query29	12.55	3.22	3.27
query30	0.25	0.07	0.07
query31	2.84	0.39	0.38
query32	3.25	0.46	0.47
query33	3.05	2.99	3.03
query34	17.15	4.49	4.55
query35	4.54	4.52	4.62
query36	0.67	0.48	0.48
query37	0.09	0.07	0.06
query38	0.05	0.04	0.03
query39	0.04	0.02	0.02
query40	0.17	0.13	0.13
query41	0.08	0.03	0.02
query42	0.03	0.02	0.02
query43	0.04	0.03	0.02
Total cold run time: 107.16 s
Total hot run time: 33.31 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.

3 participants