You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "csun5285 (via GitHub)" <gi...@apache.org> on 2026/10/15 07:22:23 UTC

[PR] [fix](be) Preserve NULL semantics for complex IN predicates [doris]

csun5285 opened a new pull request, #69122:
URL: https://github.com/apache/doris/pull/69122

   ## Proposed changes
   
   - Preserve the outer NULL map of the left operand in complex `IN`/`NOT IN` predicates.
   - Return NULL for both operators when the left STRUCT value is NULL instead of probing its masked payload.
   - Use the const-aware row index for complex predicate lookups.
   - Add regression coverage for constant and non-constant NULL STRUCT operands.
   
   ## Test
   
   - `git diff --check`
   - `clang-format-16 --dry-run --Werror --style=file be/src/exprs/function/function_collection_in.h`
   - Compiled `be/src/exprs/function/function_collection_in.cpp` with the existing master Release compile command (without the stale PCH).
   - Reproduced DORIS-28926 before the fix on a local Doris cluster; the new expected results are covered by the regression suite.
   
   Issue: DORIS-28926
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](fe) Reject complex types in IN predicates [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #69122:
URL: https://github.com/apache/doris/pull/69122#issuecomment-6206728172

   
   <details>
   <summary>TPC-H: <b>Total hot run time: 29563 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
   Tpch sf100 test result on commit 16227f2b768b0454ef6fafb42e8b72ebe7ff687e, data reload: false
   
   ------ Round 1 ----------------------------------
   ============================================
   q1	17597	5632	5548	5548
   q2	2092	325	260	260
   q3	10244	1381	839	839
   q4	4679	462	339	339
   q5	7438	797	530	530
   q6	188	183	153	153
   q7	751	792	605	605
   q8	9241	1327	1094	1094
   q9	5549	4305	4270	4270
   q10	6802	1281	1027	1027
   q11	438	249	232	232
   q12	636	395	289	289
   q13	18098	3525	3025	3025
   q14	283	275	248	248
   q15	q16	729	721	687	687
   q17	1177	741	586	586
   q18	7021	6186	6172	6172
   q19	1101	965	612	612
   q20	381	338	222	222
   q21	4995	2582	2521	2521
   q22	415	331	304	304
   Total cold run time: 99855 ms
   Total hot run time: 29563 ms
   
   ----- Round 2, with runtime_filter_mode=off -----
   ============================================
   q1	6472	6429	6401	6401
   q2	738	597	561	561
   q3	5472	5715	5243	5243
   q4	2049	2667	1634	1634
   q5	5929	5732	5642	5642
   q6	260	191	151	151
   q7	2395	2166	1943	1943
   q8	3230	2766	2816	2766
   q9	8070	8002	7555	7555
   q10	3648	3592	3241	3241
   q11	605	408	395	395
   q12	657	692	491	491
   q13	3278	3580	3038	3038
   q14	287	285	271	271
   q15	q16	693	687	626	626
   q17	7833	7039	6854	6854
   q18	13233	12287	13033	12287
   q19	937	826	841	826
   q20	2211	2172	1950	1950
   q21	5900	4698	4881	4698
   q22	514	459	388	388
   Total cold run time: 74411 ms
   Total hot run time: 66961 ms
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](fe) Reject complex types in IN predicates [doris]

Posted by "csun5285 (via GitHub)" <gi...@apache.org>.
csun5285 merged PR #69122:
URL: https://github.com/apache/doris/pull/69122


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](fe) Reject complex types in IN predicates [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #69122:
URL: https://github.com/apache/doris/pull/69122#discussion_r4282049992


##########
regression-test/suites/nereids_syntax_p0/inpredicate_with_struct.groovy:
##########
@@ -15,27 +15,33 @@
 // specific language governing permissions and limitations
 // under the License.
 
-suite("inpredicate_with_struct") {
+suite("inpredicate_with_complex_type") {
     sql """ set enable_nereids_planner = true;"""
     sql """ set enable_fallback_to_original_planner=false;"""
-    // support struct type
-    order_qt_in_predicate_11 """
-         select struct(1,"2")  in (struct(1,3), null);
-    """
-    order_qt_in_predicate_12 """
-         select struct(1,"2")  not in (struct(1,3), null);
-    """
-    order_qt_in_predicate_13 """
-         select struct(1,"2")  in (struct(1,3), struct(1,2));
-    """
-    order_qt_in_predicate_14 """
-         select struct(1,"2")  not in (struct(1,3), struct(1,2));
-    """
-    order_qt_in_predicate_15 """
-         select struct(1,"2")  in (struct(1,3), struct(1,"2"), struct(1,1));
-    """
-    order_qt_in_predicate_16 """
-         select struct(1,"2")  not in (struct(1,3), struct(1,"2"), struct(1,1));
-    """
+
+    test {
+        sql """ select struct(1, "2") in (struct(1, 2)); """
+        exception "in predicate could not contains complex type"
+    }
+
+    test {
+        sql """ select struct(1, "2") not in (struct(1, 2)); """
+        exception "in predicate could not contains complex type"
+    }
+
+    test {
+        sql """ select [1, 2] in ([1, 2]); """

Review Comment:
   [P2] Update the remaining complex-IN test expectations
   
   The new ARRAY error case leaves `inpredicate_with_list.groovy:36-54` expecting six ARRAY IN queries to succeed with fallback disabled; its first `c_array in ([1,2], [1,3])` now throws the complex-type error. FE tests also retain the old contract: `TypeCoercionUtilsTest.testInPredicateStructCastKeepsNullableCastResult` expects STRUCT IN coercion to succeed, and `VarBinarySqlSupportTest.testBinaryInPredicatesFailDuringAnalysis` requires the VARBINARY diagnostic for ARRAY/STRUCT operands, which the complex guard now preempts. Please update these existing expectations along with the new negative cases; otherwise both regression and FE unit suites fail under the intended behavior.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](be) Preserve NULL semantics for complex IN predicates [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #69122:
URL: https://github.com/apache/doris/pull/69122#issuecomment-6186782748

   
   Thank you for your contribution to Apache Doris.
   Don't know what should be done next? See [How to process your PR](https://doris.apache.org/community/how-to-contribute/review-and-ci).
   
   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?
       


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](fe) Reject complex types in IN predicates [doris]

Posted by "csun5285 (via GitHub)" <gi...@apache.org>.
csun5285 commented on PR #69122:
URL: https://github.com/apache/doris/pull/69122#issuecomment-6206153843

   /review


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](fe) Reject complex types in IN predicates [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #69122:
URL: https://github.com/apache/doris/pull/69122#issuecomment-6206896821

   
   <details>
   <summary>ClickBench: <b>Total hot run time: 24.99 s</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
   ClickBench test result on commit 16227f2b768b0454ef6fafb42e8b72ebe7ff687e, data reload: false
   
   query1	0.01	0.01	0.00
   query2	0.10	0.06	0.05
   query3	0.26	0.12	0.12
   query4	1.61	0.12	0.12
   query5	0.24	0.25	0.24
   query6	1.17	0.68	0.69
   query7	0.04	0.01	0.01
   query8	0.06	0.04	0.04
   query9	0.41	0.35	0.37
   query10	0.58	0.57	0.58
   query11	0.20	0.15	0.13
   query12	0.19	0.15	0.14
   query13	0.48	0.49	0.49
   query14	1.03	1.01	1.01
   query15	0.63	0.60	0.61
   query16	0.35	0.34	0.35
   query17	1.15	1.15	1.12
   query18	0.23	0.21	0.21
   query19	2.09	1.98	2.03
   query20	0.02	0.01	0.02
   query21	15.43	0.30	0.14
   query22	4.36	0.06	0.05
   query23	16.25	0.31	0.12
   query24	2.85	0.76	0.79
   query25	0.09	0.07	0.06
   query26	1.86	0.26	0.16
   query27	0.04	0.06	0.03
   query28	2.50	0.60	0.40
   query29	12.51	4.27	3.36
   query30	0.29	0.15	0.13
   query31	2.77	0.60	0.34
   query32	3.22	0.62	0.52
   query33	3.16	3.32	3.16
   query34	15.41	4.03	3.40
   query35	3.35	3.36	3.33
   query36	0.56	0.45	0.47
   query37	0.09	0.07	0.06
   query38	0.05	0.04	0.04
   query39	0.04	0.03	0.03
   query40	0.18	0.15	0.15
   query41	0.09	0.03	0.03
   query42	0.03	0.03	0.03
   query43	0.04	0.03	0.03
   Total cold run time: 96.02 s
   Total hot run time: 24.99 s
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](fe) Reject complex types in IN predicates [doris]

Posted by "csun5285 (via GitHub)" <gi...@apache.org>.
csun5285 commented on PR #69122:
URL: https://github.com/apache/doris/pull/69122#issuecomment-6206393095

   run buildall


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](fe) Reject complex types in IN predicates [doris]

Posted by "csun5285 (via GitHub)" <gi...@apache.org>.
csun5285 commented on PR #69122:
URL: https://github.com/apache/doris/pull/69122#issuecomment-6190119978

   /review


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](fe) Reject complex types in IN predicates [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #69122:
URL: https://github.com/apache/doris/pull/69122#discussion_r4282302460


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/InPredicate.java:
##########
@@ -136,28 +136,6 @@ public boolean nullable() throws UnboundException {
     @Override
     public void checkLegalityBeforeTypeCoercion() {
         List<Expression> arguments = getArguments();
-        if (arguments.get(0).getDataType().isStructType()) {
-            // we should check in value list is all struct type
-            for (int i = 1; i < arguments.size(); i++) {
-                if (!arguments.get(i).getDataType().isStructType() && !arguments.get(i).getDataType().isNullType()) {
-                    throw new AnalysisException("in predicate struct should compare with struct type list, but got : "
-                            + arguments.get(i).getDataType().toSql());
-                }
-            }
-            return;
-        }
-
-        if (arguments.get(0).getDataType().isArrayType()) {
-            // we should check in value list is all list type
-            for (int i = 1; i < arguments.size(); i++) {
-                if (!arguments.get(i).getDataType().isArrayType() && !arguments.get(i).getDataType().isNullType()) {
-                    throw new AnalysisException("in predicate list should compare with struct type list, but got : "
-                            + arguments.get(i).getDataType().toSql());
-                }
-            }
-            return;
-        }
-
         arguments.forEach(c -> {

Review Comment:
   [P2] Update the remaining ARRAY IN (NULL) regression
   
   The separate `query_p0/sql_functions/test_in_expr.groovy:167` case still uses `qt_select` for `select c_array, c_array in (null) from array_in_test`, where `c_array` is `ARRAY<int>`, and its `.out` expects a NULL result. Removing the ARRAY exemption makes `processInPredicate` throw the complex-type error before NULL simplification, so this suite now aborts under the default Nereids planner. Please convert that case to an expected analysis error and update its golden too. This is a different suite from the cases named in the earlier review thread, which this revision has addressed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](fe) Reject complex types in IN predicates [doris]

Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #69122:
URL: https://github.com/apache/doris/pull/69122#issuecomment-6206841576

   
   <details>
   <summary>TPC-DS: <b>Total hot run time: 152731 ms</b></summary>
   
   ```
   machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
   scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
   TPC-DS sf100 test result on commit 16227f2b768b0454ef6fafb42e8b72ebe7ff687e, data reload: false
   
   query5	4308	593	454	454
   query6	418	204	185	185
   query7	4810	441	233	233
   query8	316	163	157	157
   query9	8729	3996	3997	3996
   query10	464	304	262	262
   query11	6024	3822	3501	3501
   query12	144	93	87	87
   query13	1294	470	336	336
   query14	6170	4033	3807	3807
   query14_1	3532	3492	3533	3492
   query15	213	207	186	186
   query16	950	438	397	397
   query17	869	675	539	539
   query18	2421	418	325	325
   query19	205	175	141	141
   query20	85	83	82	82
   query21	206	138	119	119
   query22	13025	13072	12770	12770
   query23	13385	12914	12602	12602
   query23_1	12543	12990	12640	12640
   query24	7123	838	472	472
   query24_1	470	481	478	478
   query25	539	426	370	370
   query26	1320	257	139	139
   query27	2775	444	271	271
   query28	4636	1955	2002	1955
   query29	1623	596	473	473
   query30	303	224	187	187
   query31	1006	939	802	802
   query32	148	94	96	94
   query33	518	324	247	247
   query34	965	852	519	519
   query35	763	765	651	651
   query36	837	800	722	722
   query37	137	102	90	90
   query38	1772	1748	1712	1712
   query39	801	793	747	747
   query39_1	731	741	751	741
   query40	224	127	100	100
   query41	71	69	65	65
   query42	88	85	85	85
   query43	378	396	343	343
   query44	1368	743	732	732
   query45	188	177	166	166
   query46	888	974	596	596
   query47	2932	3034	2981	2981
   query48	304	317	234	234
   query49	569	411	301	301
   query50	729	304	220	220
   query51	10668	10782	10572	10572
   query52	86	84	70	70
   query53	185	216	152	152
   query54	238	212	179	179
   query55	76	71	65	65
   query56	228	225	207	207
   query57	1602	1614	1593	1593
   query58	285	261	252	252
   query59	2180	2178	1962	1962
   query60	277	223	222	222
   query61	146	142	140	140
   query62	390	334	286	286
   query63	196	163	173	163
   query64	2756	894	762	762
   query65	3297	3231	3235	3231
   query66	1787	414	294	294
   query67	20199	20322	19874	19874
   query68	3032	1042	679	679
   query69	374	288	234	234
   query70	848	747	769	747
   query71	291	213	205	205
   query72	2703	2550	2260	2260
   query73	521	550	292	292
   query74	4572	4447	4299	4299
   query75	2336	2283	1950	1950
   query76	2287	1020	631	631
   query77	343	384	280	280
   query78	9970	9789	9168	9168
   query79	998	861	524	524
   query80	722	421	337	337
   query81	567	323	280	280
   query82	576	141	112	112
   query83	294	195	198	195
   query84	306	120	99	99
   query85	840	439	370	370
   query86	348	239	234	234
   query87	2038	1959	1846	1846
   query88	3653	2755	2694	2694
   query89	332	293	256	256
   query90	1841	191	176	176
   query91	159	153	123	123
   query92	96	86	84	84
   query93	1034	1000	587	587
   query94	506	289	264	264
   query95	604	421	320	320
   query96	663	523	235	235
   query97	2445	2422	2304	2304
   query98	164	150	148	148
   query99	778	763	653	653
   Total cold run time: 234961 ms
   Total hot run time: 152731 ms
   ```
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [fix](fe) Reject complex types in IN predicates [doris]

Posted by "csun5285 (via GitHub)" <gi...@apache.org>.
csun5285 commented on PR #69122:
URL: https://github.com/apache/doris/pull/69122#issuecomment-6190638257

   /review


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org