abhishekrb19 commented on issue #14346:
URL: https://github.com/apache/druid/issues/14346#issuecomment-1572718755

   As a follow-up to the proposed design implementation, we can add a new 
column, `ROUTINE_COMMENT`, to `INFORMATION_SCHEMA.ROUTINES` table. The new 
column allows developers to provide additional information or context about a 
routine/function. A few vendor implementations that do something similar:
   - MySQL's [info schema routine 
table](https://dev.mysql.com/doc/refman/5.7/en/information-schema-routines-table.html)
   - MariaDB's [info schema routine 
table](https://mariadb.com/kb/en/information-schema-routines-table/#:~:text=The%20Information%20Schema%20ROUTINES%20table,stored%20procedures%20and%20stored%20functions.&text=Always%20def%20.&text=Database%20name%20associated%20with%20the%20routine)
   
   `ROUTINE_COMMENT` is optional; some functions may not have a description if 
it's not defined by a developer. This will be useful for generating 
documentation so we have a single source of truth and this feature can be used 
in the Druid web console too.
   
   So with those goals in mind, I think an implementation that will work:
   - Add a default implementation to [SqlAggregator 
interface](https://github.com/apache/druid/blob/master/sql/src/main/java/org/apache/druid/sql/calcite/aggregation/SqlAggregator.java)
 that returns null:
   ```java
     /**
      * @return an optional description about the Sql aggregator.
      */
     @Nullable
     default String functionDescription() {
       return null;
     }
   ```
   - We can override the default implementation for all aggregator functions 
already in Druid (including the ones defined in open-source extensions). We can 
reuse the descriptions from the [Druid 
docs](https://druid.apache.org/docs/latest/querying/sql-functions.html).
    - The default implementation will return null for functions in the wild 
(from custom extensions or so) that are unaware of `functionDescription()`. 
It's entirely up to the developer to override the function.
   
   Comments or feedback is appreciated!


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