xy720 opened a new pull request, #17985: URL: https://github.com/apache/doris/pull/17985
# Proposed changes In pr #17344, we already support template type in SQL function. e.g. ``` [['map_keys'], 'ARRAY<K>', ['MAP<K, V>'], '', ['K', 'V']] ``` Then it raises a new issue, as some functions require variable length template types. e.g. ``` [['struct'], 'STRUCT<T1, T2, T3, T4....>', ['T1', 'T2', 'T3', 'T4', '....'], '', ['T1', 'T2', 'T3', 'T4', '....']] ``` Inspired by c++ function std::vector::emplace_back(), we can use variadic template for this issue. You can know more about emplace_back function and variadic template in [C++雾中风景9:emplace_back与可变长模板](https://www.jianshu.com/p/7523154678dc). e.g. ``` [['struct'], 'STRUCT<TYPES>', ['TYPES...'], 'ALWAYS_NOT_NULLABLE', ['...TYPES']] ``` `...TYPES` in template_types defines a variadic template `TYPE`. And the variadic template will be expanded to multiple normal templates based on actual input arguments at runtime in FE. But make sure `...TYPES` is placed on the last position in all template types. BTW, the origin template function logic is not affected. ## Problem summary Describe your changes. ## Checklist(Required) * [ ] Does it affect the original behavior * [ ] Has unit tests been added * [ ] Has document been added or modified * [ ] Does it need to update dependencies * [ ] Is this PR support rollback (If NO, please explain WHY) ## Further comments If this is a relatively large or complex change, kick off the discussion at [d...@doris.apache.org](mailto:d...@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc... -- 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-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org