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

   # Proposed changes
   
   Issue Number: close #xxx
   
   ## Problem summary
   
   Describe your changes.
   
   Current, for ARRAY and MAP functions, sub item datatype need to be 
enumerated in FE function registration. It's tedious and  hard to maintain for 
adding new datatypes.
   
       # map element extract functions
       [['element_at', '%element_extract%'], 'DECIMAL64', ['ARRAY_DECIMAL64', 
'BIGINT'], 'ALWAYS_NULLABLE'],
       [['element_at', '%element_extract%'], 'DECIMAL128', ['ARRAY_DECIMAL128', 
'BIGINT'], 'ALWAYS_NULLABLE'],
       [['element_at', '%element_extract%'], 'VARCHAR', ['ARRAY_VARCHAR', 
'BIGINT'], 'ALWAYS_NULLABLE'],
       [['element_at', '%element_extract%'], 'STRING', ['ARRAY_STRING', 
'BIGINT'], 'ALWAYS_NULLABLE'],
       and many more ...
   
       # map element extract functions
       [['element_at', '%element_extract%'], 'INT', ['MAP_STRING_INT', 
'STRING'], 'ALWAYS_NULLABLE'],
       [['element_at', '%element_extract%'], 'STRING', ['MAP_INT_STRING', 
'INT'], 'ALWAYS_NULLABLE'],
       and many more ...
   
   
   A new way just like c++ template is proposed in this PR. The previous 
functions can be defined much simpler using template function. 
       # map element extract template function
       [['element_at', '%element_extract%'], 'E', ['ARRAY<E>', 'BIGINT'], 
'ALWAYS_NULLABLE', ['E']],
   
       # map element extract template function
       [['element_at', '%element_extract%'], 'V', ['MAP<K, V>', 'K'], 
'ALWAYS_NULLABLE', ['K', 'V']],
   
   
   BTW, the plain type function is not affected and the legacy ARRAY_X MAP_K_V 
is still supported for compatability.
   
   
   
   ## 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 
[[email protected]](mailto:[email protected]) 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: [email protected]

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to