chucheng92 commented on code in PR #3475:
URL: https://github.com/apache/calcite/pull/3475#discussion_r1365190806


##########
core/src/test/resources/sql/sub-query.iq:
##########
@@ -3685,4 +3685,15 @@ FROM dept d1;
 
 !ok
 
+# [CALCITE-6041] MAP sub-query gives NullPointerException
+SELECT map(SELECT empno, deptno from emp where deptno < 20);

Review Comment:
   thanks for reviewing.
   
   q1: Map SubQuery use `LeafQueryOrExpr` which not allow `LIMIT`, `OrderBy`. 
   
   see: 
https://github.com/apache/calcite/blob/23b7931c3e516bdb6cfedda956213f7fe06c6b24/core/src/main/codegen/templates/Parser.jj#L4892
   
   the ARRAY/MULTISET sub-query has same behavior. but maybe we can support it 
in the future. the context/background I replied in the Jira page.
   
   q2: the default implemented map is a LinkedHashMap, so the order of kv pair 
in map is deterministic unless the input rows from table is nondeterministic.
   
   Considering that we collect data from a unchanged/fixed data set, this could 
be deterministic to some degree. (It seems that there are many similar usages 
in `iq` without specifying `orderby`.)
   
   I'm ok if we need to remove this case. I have added 1 row and 0 row cases. 
what do you think?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to