drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] kkhatua opened a new pull request #1483: DRILL-3988: Expose Drill built-in functions & UDFs in a system table
Date Fri, 28 Sep 2018 17:49:30 GMT
kkhatua opened a new pull request #1483: DRILL-3988: Expose Drill built-in functions &
UDFs  in a system table
URL: https://github.com/apache/drill/pull/1483
 
 
   This commit exposes available SQL functions in Drill and also detects UDFs that have been
dynamically loaded into Drill. 
   An example is shown below for 2 UDFs dynamically loaded into the cluster, along side the
existing built-in functions that come with Drill.
   
   ```
   0: jdbc:drill:schema=sys>  select source, count(*) as functionCount from sys.functions
group by source;
   +-----------------------------------------+----------------+
   |                 source                  | functionCount  |
   +-----------------------------------------+----------------+
   | built-in                                | 2704           |
   | simple-drill-function-1.0-SNAPSHOT.jar  | 12             |
   | drill-url-tools-1.0.jar                 | 1              |
   +-----------------------------------------+----------------+
   1 row selected (0.211 seconds)
   ```
   
   The system table exposes information as shown. Since UDFs are lazily initialized (i.e.
only when a SQL query needs it), the `returnType` is not available and listed as `n/a`.
   Once the UDF is initialized, the `returnType` is also available.
   The `random(FLOAT8-REQUIRED,FLOAT8-REQUIRED)` function is an example of a lazily loaded
UDF (see `returnType`).
   The `url_parse(VARCHAR-REQUIRED)` function is an example of an initialized UDF (see `returnType`).
   Rest are built-in functions that meet the query's filter criteria.
   
   ```
   0: jdbc:drill:schema=sys>select * from sys.functions where name like 'random' or `name`
like '%url%';
   +-------------+----------------------------------+-------------+-----------------------------------------+
   |    name     |            signature             | returnType  |                  source
                |
   +-------------+----------------------------------+-------------+-----------------------------------------+
   | parse_url   | VARCHAR-REQUIRED                 | LATE        | built-in             
                  |
   | random      |                                  | FLOAT8      | built-in             
                  |
   | random      | FLOAT8-REQUIRED,FLOAT8-REQUIRED  | n/a         | simple-drill-function-1.0-SNAPSHOT.jar
 |
   | url_decode  | VARCHAR-REQUIRED                 | VARCHAR     | built-in             
                  |
   | url_encode  | VARCHAR-REQUIRED                 | VARCHAR     | built-in             
                  |
   | url_parse   | VARCHAR-REQUIRED                 | LATE        | drill-url-tools-1.0.jar
                |
   +-------------+----------------------------------+-------------+-----------------------------------------+
   6 rows selected (0.221 seconds)
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message