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

[PR] [feature](nereids) Support dereference expression [doris]

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

   ### What problem does this PR solve?
   
   Support dereference expression
   
   ```sql
   MySQL root@127.0.0.1:a> select named_struct('c', named_struct('c', 100)).c.c, map('a', 10, 'b', 20).size, map('a', 10, 'b', 20).keys, map('a', 10, 'b', 20).values, array(1,2,3).size;
   +-----------------------------------------------+----------------------------+----------------------------+------------------------------+-------------------+
   | named_struct('c', named_struct('c', 100)).c.c | map('a', 10, 'b', 20).size | map('a', 10, 'b', 20).keys | map('a', 10, 'b', 20).values | array(1,2,3).size |
   +-----------------------------------------------+----------------------------+----------------------------+------------------------------+-------------------+
   | 100                                           | 2                          | ["a", "b"]                 | [10, 20]                     | 3                 |
   +-----------------------------------------------+----------------------------+----------------------------+------------------------------+-------------------+
   ```
   
   - Test <!-- At least one of them must be included. -->
       - [ ] 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 <!-- Add your reason?  -->
   
   - Behavior changed:
       - [ ] No.
       - [ ] Yes. <!-- Explain the behavior change -->
   
   - Does this need documentation?
       - [ ] No.
       - [ ] Yes. <!-- Add document PR link here. eg: https://github.com/apache/doris-website/pull/1214 -->
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
   
   


-- 
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] [feature](nereids) Support dereference expression [doris]

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

   
   <details>
   <summary>ClickBench: <b>Total hot run time: 27.68 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 6d906878a3a6341f6dc43913034f9366d72197bc, data reload: false
   
   query1	0.06	0.05	0.04
   query2	0.08	0.04	0.05
   query3	0.25	0.09	0.08
   query4	1.60	0.12	0.12
   query5	0.28	0.28	0.25
   query6	1.18	0.66	0.64
   query7	0.03	0.03	0.03
   query8	0.05	0.04	0.05
   query9	0.62	0.53	0.54
   query10	0.58	0.58	0.58
   query11	0.16	0.11	0.12
   query12	0.16	0.12	0.13
   query13	0.61	0.60	0.60
   query14	1.01	0.99	1.03
   query15	0.85	0.83	0.84
   query16	0.39	0.39	0.39
   query17	1.01	1.02	1.06
   query18	0.21	0.22	0.21
   query19	1.89	1.81	1.82
   query20	0.02	0.01	0.02
   query21	15.44	0.21	0.13
   query22	5.01	0.07	0.05
   query23	15.65	0.27	0.10
   query24	2.62	0.52	0.40
   query25	0.08	0.06	0.07
   query26	0.13	0.14	0.13
   query27	0.08	0.06	0.05
   query28	4.09	1.17	0.94
   query29	12.63	4.01	3.30
   query30	0.28	0.13	0.12
   query31	2.83	0.59	0.39
   query32	3.23	0.55	0.47
   query33	3.09	3.10	3.05
   query34	15.90	5.18	4.67
   query35	4.58	4.53	4.59
   query36	0.68	0.51	0.48
   query37	0.11	0.07	0.07
   query38	0.07	0.04	0.04
   query39	0.04	0.03	0.03
   query40	0.18	0.14	0.14
   query41	0.08	0.03	0.04
   query42	0.04	0.04	0.03
   query43	0.04	0.04	0.03
   Total cold run time: 97.92 s
   Total hot run time: 27.68 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] [feature](nereids) Support dereference expression [doris]

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

   
   <details>
   <summary>TPC-DS: <b>Total hot run time: 181500 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 7aea61efa4254e3d0ab4567d92f999a26e581199, data reload: false
   
   query1	1038	403	428	403
   query2	6557	1563	1547	1547
   query3	6754	228	220	220
   query4	25207	23283	22990	22990
   query5	5281	656	464	464
   query6	328	243	225	225
   query7	4642	511	306	306
   query8	312	247	233	233
   query9	8731	2568	2593	2568
   query10	553	358	298	298
   query11	15075	15065	14934	14934
   query12	192	122	117	117
   query13	1685	554	448	448
   query14	9329	5545	5449	5449
   query15	211	200	185	185
   query16	7689	689	520	520
   query17	1207	759	630	630
   query18	2042	448	336	336
   query19	209	210	179	179
   query20	135	124	125	124
   query21	215	135	115	115
   query22	3883	4043	3935	3935
   query23	32660	31838	31894	31838
   query24	8566	2438	2396	2396
   query25	633	563	462	462
   query26	1254	323	169	169
   query27	2664	483	342	342
   query28	4317	2129	2109	2109
   query29	771	609	489	489
   query30	304	237	208	208
   query31	806	702	615	615
   query32	85	73	73	73
   query33	579	374	317	317
   query34	808	857	538	538
   query35	810	825	744	744
   query36	858	928	831	831
   query37	118	106	92	92
   query38	3786	3810	3724	3724
   query39	1446	1414	1420	1414
   query40	226	131	120	120
   query41	68	61	61	61
   query42	123	113	111	111
   query43	441	446	419	419
   query44	1269	766	747	747
   query45	194	192	185	185
   query46	856	983	634	634
   query47	1690	1727	1652	1652
   query48	406	408	321	321
   query49	770	516	407	407
   query50	649	684	418	418
   query51	4040	3891	3972	3891
   query52	111	108	104	104
   query53	244	264	196	196
   query54	296	305	277	277
   query55	99	94	94	94
   query56	339	329	315	315
   query57	1122	1151	1099	1099
   query58	291	263	274	263
   query59	2332	2335	2301	2301
   query60	342	346	335	335
   query61	158	159	160	159
   query62	774	721	672	672
   query63	225	186	196	186
   query64	4493	1189	889	889
   query65	4034	3970	3975	3970
   query66	1060	446	330	330
   query67	15144	14871	14839	14839
   query68	8322	928	618	618
   query69	520	343	311	311
   query70	1089	1044	979	979
   query71	445	335	309	309
   query72	6049	4849	4787	4787
   query73	665	590	343	343
   query74	8464	8759	8690	8690
   query75	3210	3066	2559	2559
   query76	3405	1120	735	735
   query77	687	400	308	308
   query78	9407	9722	8923	8923
   query79	1496	801	608	608
   query80	663	595	507	507
   query81	515	267	255	255
   query82	233	139	109	109
   query83	266	261	251	251
   query84	263	119	104	104
   query85	883	467	437	437
   query86	361	321	302	302
   query87	4003	4042	3996	3996
   query88	2850	2300	2317	2300
   query89	390	342	307	307
   query90	1937	225	221	221
   query91	196	164	142	142
   query92	83	72	67	67
   query93	1196	976	661	661
   query94	722	435	330	330
   query95	493	407	401	401
   query96	513	532	291	291
   query97	2583	2692	2583	2583
   query98	236	217	218	217
   query99	1314	1413	1267	1267
   Total cold run time: 266995 ms
   Total hot run time: 181500 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] [feature](nereids) Support dereference expression [doris]

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

   PR approved by anyone and no changes requested.


-- 
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] [feature](nereids) Support dereference expression [doris]

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

   
   <details>
   <summary>ClickBench: <b>Total hot run time: 29.12 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 bd87a8d0559a6b1b42c3f36f9eb86f09c824117e, data reload: false
   
   query1	0.07	0.06	0.06
   query2	0.10	0.06	0.06
   query3	0.27	0.09	0.10
   query4	1.61	0.14	0.12
   query5	0.30	0.28	0.27
   query6	1.18	0.70	0.68
   query7	0.04	0.04	0.03
   query8	0.07	0.06	0.05
   query9	0.67	0.57	0.56
   query10	0.63	0.64	0.63
   query11	0.19	0.13	0.13
   query12	0.18	0.13	0.14
   query13	0.65	0.64	0.61
   query14	1.07	1.03	1.04
   query15	0.91	0.89	0.90
   query16	0.43	0.42	0.44
   query17	1.08	1.21	1.11
   query18	0.24	0.23	0.22
   query19	2.07	1.93	2.00
   query20	0.02	0.01	0.01
   query21	15.39	0.20	0.15
   query22	5.14	0.07	0.05
   query23	15.66	0.29	0.12
   query24	2.56	1.41	0.32
   query25	0.08	0.07	0.06
   query26	0.16	0.16	0.16
   query27	0.08	0.07	0.06
   query28	4.44	1.20	0.97
   query29	12.59	4.66	3.82
   query30	0.30	0.16	0.13
   query31	2.85	0.67	0.43
   query32	3.24	0.59	0.49
   query33	3.28	3.07	3.09
   query34	15.79	5.31	4.65
   query35	4.62	4.70	4.69
   query36	0.70	0.53	0.52
   query37	0.11	0.08	0.07
   query38	0.07	0.05	0.04
   query39	0.04	0.04	0.04
   query40	0.19	0.16	0.15
   query41	0.09	0.03	0.04
   query42	0.04	0.03	0.04
   query43	0.04	0.04	0.04
   Total cold run time: 99.24 s
   Total hot run time: 29.12 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] [feature](nereids) Support dereference expression [doris]

Posted by "starocean999 (via GitHub)" <gi...@apache.org>.
starocean999 commented on code in PR #57532:
URL: https://github.com/apache/doris/pull/57532#discussion_r2485248586


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/ExpressionAnalyzer.java:
##########
@@ -962,33 +1002,153 @@ private List<Slot> addSqlIndexInfo(List<Slot> slots, Optional<Pair<Integer, Inte
     }
 
     /** bindSlotByScope */
-    public List<Slot> bindSlotByScope(UnboundSlot unboundSlot, Scope scope) {
+    public List<Expression> bindSlotByScope(UnboundSlot unboundSlot, Scope scope) {
         List<String> nameParts = unboundSlot.getNameParts();
         Optional<Pair<Integer, Integer>> idxInSql = unboundSlot.getIndexInSqlString();
         int namePartSize = nameParts.size();
         switch (namePartSize) {
             // column
             case 1: {
-                return addSqlIndexInfo(bindSingleSlotByName(nameParts.get(0), scope), idxInSql);
+                return (List<Expression>) bindExpressionByColumn(unboundSlot, nameParts, idxInSql, scope);
             }
             // table.column
             case 2: {
-                return addSqlIndexInfo(bindSingleSlotByTable(nameParts.get(0), nameParts.get(1), scope), idxInSql);
+                return (List<Expression>) bindExpressionByTableColumn(unboundSlot, nameParts, idxInSql, scope);
             }
             // db.table.column
             case 3: {
-                return addSqlIndexInfo(bindSingleSlotByDb(nameParts.get(0), nameParts.get(1), nameParts.get(2), scope),
-                        idxInSql);
+                return (List<Expression>) bindExpressionByDbTableColumn(unboundSlot, nameParts, idxInSql, scope);
             }
             // catalog.db.table.column
-            case 4: {
-                return addSqlIndexInfo(bindSingleSlotByCatalog(
-                        nameParts.get(0), nameParts.get(1), nameParts.get(2), nameParts.get(3), scope), idxInSql);
-            }
             default: {
-                throw new AnalysisException("Not supported name: " + StringUtils.join(nameParts, "."));
+                return (List<Expression>) bindExpressionByCatalogDbTableColumn(unboundSlot, nameParts, idxInSql, scope);
+            }
+        }
+    }
+
+    private List<? extends Expression> bindExpressionByCatalogDbTableColumn(

Review Comment:
   add some fe ut for the new binding priority?



-- 
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] [feature](nereids) Support dereference expression [doris]

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


-- 
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] [feature](nereids) Support some syntax sugar [doris]

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

   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] [feature](nereids) Support dereference expression [doris]

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

   # FE Regression Coverage Report
   Increment line coverage `  58.65% (61/104)` :tada:
   [Increment coverage report](http://coverage.selectdb-in.cc/coverage/57532_7aea61efa4254e3d0ab4567d92f999a26e581199_merge_fe/increment_report/index.html)
   [Complete coverage report](http://coverage.selectdb-in.cc/coverage/57532_7aea61efa4254e3d0ab4567d92f999a26e581199_merge_fe/report/index.html)
   


-- 
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] [feature](nereids) Support dereference expression [doris]

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

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


-- 
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] [feature](nereids) Support dereference expression [doris]

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

   # FE Regression Coverage Report
   Increment line coverage `  56.56% (69/122)` :tada:
   [Increment coverage report](http://coverage.selectdb-in.cc/coverage/57532_bd87a8d0559a6b1b42c3f36f9eb86f09c824117e_merge_fe/increment_report/index.html)
   [Complete coverage report](http://coverage.selectdb-in.cc/coverage/57532_bd87a8d0559a6b1b42c3f36f9eb86f09c824117e_merge_fe/report/index.html)
   


-- 
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] [feature](nereids) Support dereference expression [doris]

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

   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] [feature](nereids) Support dereference expression [doris]

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

   
   <details>
   <summary>ClickBench: <b>Total hot run time: 27.33 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 7aea61efa4254e3d0ab4567d92f999a26e581199, data reload: false
   
   query1	0.06	0.05	0.05
   query2	0.10	0.05	0.05
   query3	0.26	0.09	0.09
   query4	1.61	0.12	0.11
   query5	0.29	0.26	0.25
   query6	1.17	0.64	0.63
   query7	0.03	0.02	0.02
   query8	0.05	0.04	0.05
   query9	0.57	0.51	0.50
   query10	0.55	0.55	0.55
   query11	0.16	0.10	0.11
   query12	0.15	0.12	0.11
   query13	0.63	0.60	0.60
   query14	0.99	0.97	0.99
   query15	0.83	0.81	0.80
   query16	0.40	0.42	0.41
   query17	0.96	1.02	0.98
   query18	0.24	0.21	0.21
   query19	1.84	1.86	1.79
   query20	0.02	0.02	0.01
   query21	15.44	0.26	0.14
   query22	4.83	0.05	0.04
   query23	16.06	0.27	0.10
   query24	1.76	0.28	0.93
   query25	0.11	0.06	0.17
   query26	0.13	0.14	0.12
   query27	0.07	0.05	0.06
   query28	5.25	1.20	1.02
   query29	12.64	3.92	3.24
   query30	0.28	0.14	0.11
   query31	2.82	0.61	0.40
   query32	3.23	0.54	0.46
   query33	3.08	3.06	3.06
   query34	16.89	5.17	4.57
   query35	4.59	4.59	4.59
   query36	0.66	0.49	0.48
   query37	0.10	0.06	0.06
   query38	0.07	0.04	0.04
   query39	0.04	0.02	0.02
   query40	0.17	0.15	0.14
   query41	0.09	0.03	0.03
   query42	0.04	0.02	0.02
   query43	0.04	0.03	0.03
   Total cold run time: 99.3 s
   Total hot run time: 27.33 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] [feature](nereids) Support dereference expression [doris]

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

   # FE Regression Coverage Report
   Increment line coverage `  58.65% (61/104)` :tada:
   [Increment coverage report](http://coverage.selectdb-in.cc/coverage/57532_7aea61efa4254e3d0ab4567d92f999a26e581199_merge_fe/increment_report/index.html)
   [Complete coverage report](http://coverage.selectdb-in.cc/coverage/57532_7aea61efa4254e3d0ab4567d92f999a26e581199_merge_fe/report/index.html)
   


-- 
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] [feature](nereids) Support dereference expression [doris]

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

   # FE Regression Coverage Report
   Increment line coverage `  58.27% (74/127)` :tada:
   [Increment coverage report](http://coverage.selectdb-in.cc/coverage/57532_6d906878a3a6341f6dc43913034f9366d72197bc_merge_fe/increment_report/index.html)
   [Complete coverage report](http://coverage.selectdb-in.cc/coverage/57532_6d906878a3a6341f6dc43913034f9366d72197bc_merge_fe/report/index.html)
   


-- 
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] [feature](nereids) Support dereference expression [doris]

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

   # FE Regression Coverage Report
   Increment line coverage `  58.27% (74/127)` :tada:
   [Increment coverage report](http://coverage.selectdb-in.cc/coverage/57532_6d906878a3a6341f6dc43913034f9366d72197bc_merge_fe/increment_report/index.html)
   [Complete coverage report](http://coverage.selectdb-in.cc/coverage/57532_6d906878a3a6341f6dc43913034f9366d72197bc_merge_fe/report/index.html)
   


-- 
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] [feature](nereids) Support dereference expression [doris]

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

   
   Thank you for your contribution to Apache Doris.
   Don't know what should be done next? See [How to process your PR](https://cwiki.apache.org/confluence/display/DORIS/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?
       


-- 
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] [feature](nereids) Support dereference expression [doris]

Posted by "924060929 (via GitHub)" <gi...@apache.org>.
924060929 commented on code in PR #57532:
URL: https://github.com/apache/doris/pull/57532#discussion_r2485262396


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/ExpressionAnalyzer.java:
##########
@@ -962,33 +1002,153 @@ private List<Slot> addSqlIndexInfo(List<Slot> slots, Optional<Pair<Integer, Inte
     }
 
     /** bindSlotByScope */
-    public List<Slot> bindSlotByScope(UnboundSlot unboundSlot, Scope scope) {
+    public List<Expression> bindSlotByScope(UnboundSlot unboundSlot, Scope scope) {
         List<String> nameParts = unboundSlot.getNameParts();
         Optional<Pair<Integer, Integer>> idxInSql = unboundSlot.getIndexInSqlString();
         int namePartSize = nameParts.size();
         switch (namePartSize) {
             // column
             case 1: {
-                return addSqlIndexInfo(bindSingleSlotByName(nameParts.get(0), scope), idxInSql);
+                return (List<Expression>) bindExpressionByColumn(unboundSlot, nameParts, idxInSql, scope);
             }
             // table.column
             case 2: {
-                return addSqlIndexInfo(bindSingleSlotByTable(nameParts.get(0), nameParts.get(1), scope), idxInSql);
+                return (List<Expression>) bindExpressionByTableColumn(unboundSlot, nameParts, idxInSql, scope);
             }
             // db.table.column
             case 3: {
-                return addSqlIndexInfo(bindSingleSlotByDb(nameParts.get(0), nameParts.get(1), nameParts.get(2), scope),
-                        idxInSql);
+                return (List<Expression>) bindExpressionByDbTableColumn(unboundSlot, nameParts, idxInSql, scope);
             }
             // catalog.db.table.column
-            case 4: {
-                return addSqlIndexInfo(bindSingleSlotByCatalog(
-                        nameParts.get(0), nameParts.get(1), nameParts.get(2), nameParts.get(3), scope), idxInSql);
-            }
             default: {
-                throw new AnalysisException("Not supported name: " + StringUtils.join(nameParts, "."));
+                return (List<Expression>) bindExpressionByCatalogDbTableColumn(unboundSlot, nameParts, idxInSql, scope);
+            }
+        }
+    }
+
+    private List<? extends Expression> bindExpressionByCatalogDbTableColumn(

Review Comment:
   this binding priority compatible with original binding logic, test by `test_db_name_ignore_cluster.groovy`, and new binding logic test by  `test_dereference.groovy`



-- 
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] [feature](nereids) Support dereference expression [doris]

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

   
   <details>
   <summary>TPC-H: <b>Total hot run time: 34057 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 7aea61efa4254e3d0ab4567d92f999a26e581199, data reload: false
   
   ------ Round 1 ----------------------------------
   q1	17651	5103	4885	4885
   q2	2002	345	205	205
   q3	10250	1272	726	726
   q4	10230	891	354	354
   q5	7535	2487	2200	2200
   q6	186	171	142	142
   q7	952	785	631	631
   q8	9348	1302	954	954
   q9	6950	5291	5286	5286
   q10	6852	2241	1810	1810
   q11	507	313	283	283
   q12	335	366	221	221
   q13	17843	3656	3014	3014
   q14	237	249	220	220
   q15	622	536	557	536
   q16	909	865	821	821
   q17	574	800	486	486
   q18	7664	7271	7243	7243
   q19	1274	954	578	578
   q20	362	348	231	231
   q21	3646	3173	2275	2275
   q22	1018	972	956	956
   Total cold run time: 106947 ms
   Total hot run time: 34057 ms
   
   ----- Round 2, with runtime_filter_mode=off -----
   q1	4976	4903	4876	4876
   q2	329	389	308	308
   q3	2129	2619	2292	2292
   q4	1319	1723	1290	1290
   q5	4178	4349	4457	4349
   q6	220	181	136	136
   q7	2119	1946	1821	1821
   q8	2674	2499	2503	2499
   q9	7376	7473	7320	7320
   q10	3088	3261	2819	2819
   q11	594	529	485	485
   q12	708	732	596	596
   q13	3581	4014	3293	3293
   q14	304	321	272	272
   q15	564	511	500	500
   q16	883	947	879	879
   q17	1133	1470	1464	1464
   q18	7872	7529	7551	7529
   q19	768	734	735	734
   q20	1866	1960	1815	1815
   q21	4602	4410	4225	4225
   q22	1102	994	980	980
   Total cold run time: 52385 ms
   Total hot run time: 50482 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] [feature](nereids) Support dereference expression [doris]

Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow commented on code in PR #57532:
URL: https://github.com/apache/doris/pull/57532#discussion_r2485552790


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/ExpressionAnalyzer.java:
##########
@@ -256,6 +265,37 @@ public Expression visitUnboundAlias(UnboundAlias unboundAlias, ExpressionRewrite
         }
     }
 
+    @Override
+    public Expression visitDereferenceExpression(DereferenceExpression dereferenceExpression,
+            ExpressionRewriteContext context) {
+        Expression expression = dereferenceExpression.child(0).accept(this, context);
+        DataType dataType = expression.getDataType();
+        if (dataType.isStructType()) {
+            StructType structType = (StructType) dataType;
+            StructField field = structType.getField(dereferenceExpression.fieldName);
+            if (field != null) {
+                return new StructElement(expression, dereferenceExpression.child(1));
+            }
+        } else if (dataType.isArrayType()) {
+            if (dereferenceExpression.fieldName.equalsIgnoreCase("size")) {
+                return new Cardinality(expression);
+            }

Review Comment:
   so, maybe wo should remove array.size too. because this make dereference has two different behavior on different types



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/ExpressionAnalyzer.java:
##########
@@ -256,6 +265,37 @@ public Expression visitUnboundAlias(UnboundAlias unboundAlias, ExpressionRewrite
         }
     }
 
+    @Override
+    public Expression visitDereferenceExpression(DereferenceExpression dereferenceExpression,
+            ExpressionRewriteContext context) {
+        Expression expression = dereferenceExpression.child(0).accept(this, context);

Review Comment:
   better to add ut for it



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/ExpressionAnalyzer.java:
##########
@@ -256,6 +265,37 @@ public Expression visitUnboundAlias(UnboundAlias unboundAlias, ExpressionRewrite
         }
     }
 
+    @Override
+    public Expression visitDereferenceExpression(DereferenceExpression dereferenceExpression,
+            ExpressionRewriteContext context) {
+        Expression expression = dereferenceExpression.child(0).accept(this, context);
+        DataType dataType = expression.getDataType();
+        if (dataType.isStructType()) {
+            StructType structType = (StructType) dataType;
+            StructField field = structType.getField(dereferenceExpression.fieldName);
+            if (field != null) {
+                return new StructElement(expression, dereferenceExpression.child(1));
+            }
+        } else if (dataType.isArrayType()) {
+            if (dereferenceExpression.fieldName.equalsIgnoreCase("size")) {
+                return new Cardinality(expression);
+            }
+        } else if (dataType.isMapType()) {
+            if (dereferenceExpression.fieldName.equalsIgnoreCase("size")) {
+                return new MapSize(expression);
+            } else if (dereferenceExpression.fieldName.equalsIgnoreCase("keys")) {

Review Comment:
   map.keys should return map['keys'], not map's key set



-- 
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] [feature](nereids) Support dereference expression [doris]

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

   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] [feature](nereids) Support dereference expression [doris]

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

   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] [feature](nereids) Support dereference expression [doris]

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

   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] [feature](nereids) Support dereference expression [doris]

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

   # FE Regression Coverage Report
   Increment line coverage `  58.27% (74/127)` :tada:
   [Increment coverage report](http://coverage.selectdb-in.cc/coverage/57532_6d906878a3a6341f6dc43913034f9366d72197bc_merge_fe/increment_report/index.html)
   [Complete coverage report](http://coverage.selectdb-in.cc/coverage/57532_6d906878a3a6341f6dc43913034f9366d72197bc_merge_fe/report/index.html)
   


-- 
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