Hello, I just wanted to ask if you plan to support a "distinct" version of the concat summary function. It's natively supported by LISTAGG in Oracle 19c (which I'm currently using), I don't know how hard would it be for other databases.
Announcement
Collapse
No announcement yet.
X
-
Hi claudiobosticco,
you might be able to trick something with customSelectExpression="distinct myColumn", perhaps even with Velocity to recognize the aggregation-operation binding if the distinct creates problems otherwise.
Best regards
Blama
-
Hi Blama, nice idea the customSelectExpression :) but it doesn't work because in Oracle it produces a sql like:
Code:LISTAGG ( '' || DISTINCT columnName || '', ', ') WITHIN GROUP (ORDER BY DISTINCT columnName)
Code:'' ||
Code:WITHIN GROUP
Last edited by claudiobosticco; 18 Mar 2024, 02:30.
Comment
-
Hello Isomorphic actually I'm looking for the equivalent of:
Code:LISTAGG (DISTINCT columnName, ', ') WITHIN GROUP (ORDER BY columnName)
Code:LISTAGG (columnName, ', ') WITHIN GROUP (ORDER BY columnName)
Comment
-
Hello, actually I already see ordering in the WITHIN GROUP, it seems it's generated by default.
Using the suggestion Blama gave me in post #2, it doesn't work because it puts the DISTINCT also after the ORDER BY, and also because even if the joinPrefix is null, there's always the empty string prefix concatenated in the LISTAGG.
Comment
-
So just to clarify, your using the "concat" summaryFunction with Oracle, and the only issue with the SQL you're seeing generated is that you want DISTINCT added - you've already got the "WITHIN GROUP ( ORDER BY" piece that you want?
If so, we would probably represent this as an additional summaryFunction, "concatDistinct".
Comment
-
Originally posted by Isomorphic View PostSo just to clarify, your using the "concat" summaryFunction with Oracle, and the only issue with the SQL you're seeing generated is that you want DISTINCT added - you've already got the "WITHIN GROUP ( ORDER BY" piece that you want?
Originally posted by Isomorphic View PostIf so, we would probably represent this as an additional summaryFunction, "concatDistinct".
Comment
-
OK - your organization is in the midst of purchasing an unrelated Feature Sponsorship, so you might ask to have this one thrown in.
Note it's not as trivial as it may seem, since for DBs / DataSources that don't support "concat" directly, we implement a Java fallback, and we also support all the aggregation functions client-side in clientOnly DataSources.
Comment
Comment