Skip to content

Conversation

@seawinde
Copy link
Contributor

@seawinde seawinde commented Jul 2, 2025

the value in the IntLiteral should be int, but now is long in old planner literalExpr
so need to type coercion to generate right new planner int Literal

such as the example as following:

    CREATE TABLE IF NOT EXISTS orders  (
      o_orderkey       INTEGER NOT NULL,
      o_custkey        INTEGER NOT NULL,
      o_orderstatus    CHAR(1) NOT NULL,
      o_totalprice     DECIMALV3(15,2) NOT NULL,
      o_orderdate      DATE NOT NULL,
      o_orderpriority  CHAR(15) NOT NULL,  
      o_clerk          CHAR(15) NOT NULL, 
      o_shippriority   INTEGER NOT NULL,
      O_COMMENT        VARCHAR(79) NOT NULL
    )
    DUPLICATE KEY(o_orderkey, o_custkey)
    DISTRIBUTED BY HASH(o_orderkey) BUCKETS 3
    PROPERTIES (
      "replication_num" = "1"
    );

    insert into orders values
    (1, 1, 'o', 9.5, '2023-12-08', 'a', 'b', 1, 'yy'),
    (1, 1, 'o', 10.5, '2023-12-08', 'a', 'b', 1, 'yy'),
    (5, 2, 'o', 1.2, '2023-12-12', 'c','d',2, 'mi'); 

if set @ship_no = 1; and run query as following, should not add cast(o_shippriority as bigint) but now add cast(o_shippriority as bigint) worngly, this would cause tablet prune fail ,the pr fix this

explain
select * from orders where o_shippriority = @ship_no;

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #26655

Problem Summary:

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

@hello-stephen
Copy link
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?

@seawinde
Copy link
Contributor Author

seawinde commented Jul 2, 2025

run buildall

2 similar comments
@seawinde
Copy link
Contributor Author

seawinde commented Jul 2, 2025

run buildall

@seawinde
Copy link
Contributor Author

seawinde commented Jul 3, 2025

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17577	5236	5049	5049
q2	1964	280	183	183
q3	10308	1281	790	790
q4	10222	991	502	502
q5	7436	2400	2367	2367
q6	188	161	130	130
q7	903	747	618	618
q8	9327	1296	1094	1094
q9	7070	5179	5135	5135
q10	6893	2399	1952	1952
q11	501	293	279	279
q12	341	350	204	204
q13	17783	3671	3079	3079
q14	234	236	223	223
q15	547	480	479	479
q16	428	420	367	367
q17	625	889	383	383
q18	7462	7263	7143	7143
q19	1219	950	550	550
q20	334	351	225	225
q21	4178	3150	2465	2465
q22	1072	1002	966	966
Total cold run time: 106612 ms
Total hot run time: 34183 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5193	5198	5167	5167
q2	243	317	218	218
q3	2189	2655	2318	2318
q4	1368	1766	1345	1345
q5	4288	4710	4542	4542
q6	222	171	126	126
q7	2015	1946	1832	1832
q8	2664	2652	2577	2577
q9	7304	7295	7329	7295
q10	3121	3307	2833	2833
q11	567	522	482	482
q12	682	774	622	622
q13	3731	4076	3356	3356
q14	304	306	287	287
q15	514	477	518	477
q16	464	515	444	444
q17	1252	1586	1393	1393
q18	7894	7788	7591	7591
q19	856	897	949	897
q20	2136	2091	1893	1893
q21	4994	4596	4690	4596
q22	1125	1087	1001	1001
Total cold run time: 53126 ms
Total hot run time: 51292 ms

@doris-robot
Copy link

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

query1	1039	385	394	385
query2	6533	1705	1747	1705
query3	6747	214	213	213
query4	26298	23299	23184	23184
query5	4341	567	461	461
query6	305	212	197	197
query7	4621	487	283	283
query8	284	220	232	220
query9	8616	2641	2662	2641
query10	464	327	281	281
query11	15756	15076	14863	14863
query12	174	106	103	103
query13	1631	525	391	391
query14	9481	5616	5670	5616
query15	201	183	163	163
query16	7619	604	505	505
query17	1168	695	572	572
query18	2009	407	299	299
query19	189	188	166	166
query20	118	121	114	114
query21	210	121	108	108
query22	4250	4475	4713	4475
query23	34869	33858	33253	33253
query24	8423	2318	2345	2318
query25	534	456	392	392
query26	1216	259	145	145
query27	2787	526	344	344
query28	4299	2143	2112	2112
query29	714	579	426	426
query30	276	219	193	193
query31	929	836	748	748
query32	76	63	62	62
query33	545	367	296	296
query34	801	847	504	504
query35	790	825	711	711
query36	943	1000	881	881
query37	105	98	74	74
query38	4107	4102	4025	4025
query39	1460	1462	1421	1421
query40	212	115	106	106
query41	64	49	47	47
query42	120	101	103	101
query43	497	503	477	477
query44	1345	823	817	817
query45	177	173	171	171
query46	854	1003	624	624
query47	1770	1816	1771	1771
query48	387	417	318	318
query49	725	491	378	378
query50	636	683	398	398
query51	4095	4150	4138	4138
query52	118	107	93	93
query53	217	242	188	188
query54	562	559	488	488
query55	81	79	81	79
query56	296	295	293	293
query57	1218	1214	1126	1126
query58	271	264	260	260
query59	2598	2731	2579	2579
query60	341	322	320	320
query61	154	145	142	142
query62	805	728	669	669
query63	253	184	182	182
query64	4258	988	637	637
query65	4247	4174	4194	4174
query66	1050	400	305	305
query67	16263	15442	15269	15269
query68	7736	905	526	526
query69	466	315	271	271
query70	1197	1113	1057	1057
query71	404	320	286	286
query72	5590	4766	4721	4721
query73	649	609	348	348
query74	8918	9142	9008	9008
query75	3273	3207	2702	2702
query76	3318	1163	729	729
query77	500	392	289	289
query78	9980	10169	9211	9211
query79	2267	831	577	577
query80	587	507	441	441
query81	484	257	223	223
query82	452	124	98	98
query83	243	303	233	233
query84	240	108	84	84
query85	783	348	312	312
query86	368	327	285	285
query87	4508	4442	4407	4407
query88	3692	2249	2242	2242
query89	378	317	278	278
query90	1934	200	202	200
query91	137	140	111	111
query92	75	54	54	54
query93	1814	927	580	580
query94	711	401	306	306
query95	370	280	283	280
query96	495	587	286	286
query97	2738	2778	2623	2623
query98	233	214	213	213
query99	1618	1390	1280	1280
Total cold run time: 274700 ms
Total hot run time: 185261 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.04
query2	0.08	0.04	0.04
query3	0.24	0.09	0.08
query4	1.60	0.11	0.11
query5	0.45	0.43	0.43
query6	1.16	0.65	0.66
query7	0.03	0.02	0.02
query8	0.04	0.04	0.04
query9	0.59	0.52	0.52
query10	0.56	0.57	0.56
query11	0.16	0.11	0.11
query12	0.15	0.11	0.11
query13	0.62	0.61	0.60
query14	0.80	0.82	0.81
query15	0.90	0.87	0.90
query16	0.38	0.38	0.39
query17	1.10	1.07	1.10
query18	0.22	0.20	0.20
query19	1.96	1.87	1.82
query20	0.02	0.01	0.02
query21	15.39	0.88	0.53
query22	0.77	1.36	1.04
query23	14.68	1.39	0.67
query24	6.53	1.28	0.93
query25	0.51	0.20	0.13
query26	0.58	0.19	0.15
query27	0.07	0.07	0.05
query28	9.57	0.95	0.46
query29	12.56	4.07	3.42
query30	0.26	0.09	0.08
query31	2.83	0.60	0.39
query32	3.23	0.57	0.48
query33	3.07	3.09	3.09
query34	16.04	5.41	4.78
query35	4.78	4.84	4.83
query36	0.69	0.53	0.50
query37	0.09	0.07	0.06
query38	0.06	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.03	0.03
Total cold run time: 103.17 s
Total hot run time: 30.32 s

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

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

@github-actions
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 Aug 29, 2025
@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@morrySnow morrySnow closed this Sep 10, 2025
@morrySnow morrySnow reopened this Sep 10, 2025
@seawinde seawinde force-pushed the fix_set_user_var_wrong_int_type branch from e4dff17 to 412a14f Compare September 11, 2025 03:24
@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17606	5235	5070	5070
q2	1976	362	210	210
q3	10210	1309	708	708
q4	10234	1063	521	521
q5	7534	2446	2307	2307
q6	188	170	139	139
q7	949	764	636	636
q8	9351	1340	1108	1108
q9	6871	5121	5220	5121
q10	6956	2405	1963	1963
q11	499	317	277	277
q12	351	369	231	231
q13	17808	3745	3067	3067
q14	243	245	215	215
q15	591	504	505	504
q16	1017	1004	975	975
q17	586	865	358	358
q18	7538	7198	7027	7027
q19	1236	961	571	571
q20	374	345	231	231
q21	3704	3259	2358	2358
q22	1056	994	960	960
Total cold run time: 106878 ms
Total hot run time: 34557 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5127	5066	5047	5047
q2	247	336	228	228
q3	2253	2710	2283	2283
q4	1338	1816	1316	1316
q5	4228	4561	4567	4561
q6	216	177	138	138
q7	2143	2005	1794	1794
q8	2685	2634	2659	2634
q9	7302	7311	7242	7242
q10	3081	3278	2945	2945
q11	576	522	501	501
q12	726	823	634	634
q13	3683	3938	3401	3401
q14	284	305	293	293
q15	523	520	516	516
q16	1109	1145	1070	1070
q17	1198	1575	1412	1412
q18	8210	7771	7937	7771
q19	783	794	862	794
q20	1957	2023	1805	1805
q21	4789	4464	4314	4314
q22	1099	1033	970	970
Total cold run time: 53557 ms
Total hot run time: 51669 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 189149 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 412a14fed52c93f5ac845aa2d051544754b084a4, data reload: false

query1	1059	449	431	431
query2	6549	1629	1729	1629
query3	6749	220	222	220
query4	25899	23455	23427	23427
query5	4557	656	497	497
query6	345	251	239	239
query7	4682	518	304	304
query8	303	277	255	255
query9	8640	2954	2944	2944
query10	519	385	344	344
query11	15737	15685	14874	14874
query12	189	122	117	117
query13	1692	569	443	443
query14	11629	9112	9236	9112
query15	211	197	189	189
query16	7693	687	490	490
query17	1445	788	637	637
query18	2073	449	393	393
query19	203	201	177	177
query20	132	129	120	120
query21	216	132	114	114
query22	4284	4375	4229	4229
query23	34108	32889	32828	32828
query24	8068	2369	2397	2369
query25	598	525	447	447
query26	1240	281	173	173
query27	2692	512	376	376
query28	4357	2253	2247	2247
query29	781	644	500	500
query30	294	240	199	199
query31	927	805	700	700
query32	95	88	84	84
query33	586	404	344	344
query34	826	844	528	528
query35	814	821	763	763
query36	978	1048	918	918
query37	135	114	95	95
query38	3464	3503	3561	3503
query39	1503	1453	1429	1429
query40	231	135	127	127
query41	65	63	60	60
query42	134	123	121	121
query43	508	518	452	452
query44	1324	884	866	866
query45	186	183	175	175
query46	895	1019	649	649
query47	1762	1873	1784	1784
query48	413	426	329	329
query49	753	515	406	406
query50	647	681	412	412
query51	3890	3962	3845	3845
query52	120	114	106	106
query53	249	274	197	197
query54	616	617	545	545
query55	92	87	88	87
query56	351	347	310	310
query57	1218	1224	1134	1134
query58	291	295	281	281
query59	2657	2684	2533	2533
query60	367	354	343	343
query61	168	161	163	161
query62	820	706	660	660
query63	235	198	191	191
query64	4413	1153	848	848
query65	4061	4012	3963	3963
query66	1093	444	356	356
query67	15462	15308	15086	15086
query68	9106	931	576	576
query69	488	388	293	293
query70	1340	1337	1235	1235
query71	598	350	327	327
query72	6033	5028	5195	5028
query73	779	693	367	367
query74	9203	9038	8641	8641
query75	4379	3271	2773	2773
query76	3647	1148	760	760
query77	808	407	329	329
query78	9636	9712	8866	8866
query79	2048	829	604	604
query80	675	591	590	590
query81	492	260	226	226
query82	453	166	131	131
query83	294	275	251	251
query84	303	121	94	94
query85	876	457	421	421
query86	354	314	373	314
query87	3724	3695	3630	3630
query88	2810	2222	2231	2222
query89	389	340	318	318
query90	1924	231	228	228
query91	178	164	139	139
query92	95	83	72	72
query93	1137	997	668	668
query94	702	424	329	329
query95	408	335	329	329
query96	481	600	283	283
query97	2946	2993	2858	2858
query98	250	221	219	219
query99	1456	1397	1313	1313
Total cold run time: 277305 ms
Total hot run time: 189149 ms

@doris-robot
Copy link

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

query1	0.05	0.04	0.05
query2	0.08	0.05	0.05
query3	0.26	0.08	0.08
query4	1.61	0.12	0.12
query5	0.28	0.27	0.25
query6	1.17	0.65	0.65
query7	0.03	0.03	0.03
query8	0.06	0.05	0.05
query9	0.62	0.53	0.52
query10	0.58	0.58	0.58
query11	0.16	0.12	0.11
query12	0.15	0.12	0.12
query13	0.63	0.63	0.62
query14	1.02	1.03	1.03
query15	0.86	0.85	0.85
query16	0.41	0.39	0.40
query17	1.17	1.10	1.03
query18	0.21	0.20	0.21
query19	1.96	1.88	1.86
query20	0.01	0.01	0.02
query21	15.39	0.94	0.60
query22	0.80	1.23	0.82
query23	14.75	1.31	0.61
query24	7.08	1.87	0.51
query25	0.47	0.15	0.15
query26	0.60	0.16	0.14
query27	0.07	0.06	0.05
query28	9.77	0.92	0.42
query29	12.56	3.91	3.24
query30	0.30	0.14	0.11
query31	2.84	0.59	0.39
query32	3.26	0.57	0.47
query33	3.06	3.14	3.06
query34	15.99	5.45	4.84
query35	4.93	4.90	4.92
query36	0.69	0.51	0.51
query37	0.11	0.07	0.08
query38	0.06	0.04	0.05
query39	0.04	0.02	0.02
query40	0.18	0.15	0.14
query41	0.09	0.04	0.03
query42	0.04	0.03	0.03
query43	0.05	0.04	0.03
Total cold run time: 104.45 s
Total hot run time: 29.77 s

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

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

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 100.00% (1/1) 🎉
Increment coverage report
Complete coverage report

2 similar comments
@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 100.00% (1/1) 🎉
Increment coverage report
Complete coverage report

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 100.00% (1/1) 🎉
Increment coverage report
Complete coverage report

@starocean999 starocean999 merged commit 19ba4c6 into apache:master Nov 12, 2025
26 of 27 checks passed
wyxxxcat pushed a commit to wyxxxcat/doris that referenced this pull request Nov 13, 2025
…le user set var (apache#52689)

the value in the IntLiteral should be int, but now is long in old
planner literalExpr
so need to type coercion to generate right new planner int Literal

such as the example as following:
```sql
    CREATE TABLE IF NOT EXISTS orders  (
      o_orderkey       INTEGER NOT NULL,
      o_custkey        INTEGER NOT NULL,
      o_orderstatus    CHAR(1) NOT NULL,
      o_totalprice     DECIMALV3(15,2) NOT NULL,
      o_orderdate      DATE NOT NULL,
      o_orderpriority  CHAR(15) NOT NULL,  
      o_clerk          CHAR(15) NOT NULL, 
      o_shippriority   INTEGER NOT NULL,
      O_COMMENT        VARCHAR(79) NOT NULL
    )
    DUPLICATE KEY(o_orderkey, o_custkey)
    DISTRIBUTED BY HASH(o_orderkey) BUCKETS 3
    PROPERTIES (
      "replication_num" = "1"
    );

    insert into orders values
    (1, 1, 'o', 9.5, '2023-12-08', 'a', 'b', 1, 'yy'),
    (1, 1, 'o', 10.5, '2023-12-08', 'a', 'b', 1, 'yy'),
    (5, 2, 'o', 1.2, '2023-12-12', 'c','d',2, 'mi'); 
```

if ` set @ship_no = 1;` and run query as following, should not add
cast(o_shippriority as bigint) but now add cast(o_shippriority as
bigint) worngly, this would cause tablet prune fail ,the pr fix this
```sql
explain
select * from orders where o_shippriority = @ship_no;
```
wyxxxcat pushed a commit to wyxxxcat/doris that referenced this pull request Nov 18, 2025
…le user set var (apache#52689)

the value in the IntLiteral should be int, but now is long in old
planner literalExpr
so need to type coercion to generate right new planner int Literal

such as the example as following:
```sql
    CREATE TABLE IF NOT EXISTS orders  (
      o_orderkey       INTEGER NOT NULL,
      o_custkey        INTEGER NOT NULL,
      o_orderstatus    CHAR(1) NOT NULL,
      o_totalprice     DECIMALV3(15,2) NOT NULL,
      o_orderdate      DATE NOT NULL,
      o_orderpriority  CHAR(15) NOT NULL,  
      o_clerk          CHAR(15) NOT NULL, 
      o_shippriority   INTEGER NOT NULL,
      O_COMMENT        VARCHAR(79) NOT NULL
    )
    DUPLICATE KEY(o_orderkey, o_custkey)
    DISTRIBUTED BY HASH(o_orderkey) BUCKETS 3
    PROPERTIES (
      "replication_num" = "1"
    );

    insert into orders values
    (1, 1, 'o', 9.5, '2023-12-08', 'a', 'b', 1, 'yy'),
    (1, 1, 'o', 10.5, '2023-12-08', 'a', 'b', 1, 'yy'),
    (5, 2, 'o', 1.2, '2023-12-12', 'c','d',2, 'mi'); 
```

if ` set @ship_no = 1;` and run query as following, should not add
cast(o_shippriority as bigint) but now add cast(o_shippriority as
bigint) worngly, this would cause tablet prune fail ,the pr fix this
```sql
explain
select * from orders where o_shippriority = @ship_no;
```
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.

5 participants