I want to know whether Apache Drill Supports Stored Procedure and Functions or not.? If Yes Please give some example.
You can use built in functions :
Math and Trig:
functions like ABS(x)
,
CEIL(x)
,
CEILING(x)
,
DEGREES(x)
,
EXP(x)
,
FLOOR(x)
,
LOG(x)
& many more. Check docs.
Example:
SELECT ABS(`integer`) FROM dfs.`/Users/drill/input2.json`;
Data Type Conversion:
functions like CAST
CONVERT_TO
and CONVERT_FROM
, etc. Check docs.
Example:
SELECT CAST('1' as DECIMAL(28, 2)) FROM (VALUES(1));
Date/Time Functions and Arithmetic:
functions like CURRENT_TIME TIME
, CURRENT_TIMESTAMP
, DATE_ADD
, etc. Check docs.
Example:
SELECT DATE_ADD(date '2015-05-15', 2) FROM (VALUES(1));
String Manipulation:
functions like CONCAT
, ILIKE
, INITCAP
, LENGTH
, etc. Check docs.
Example:
SELECT CHAR_LENGTH('Drill rocks') FROM (VALUES(1));
Aggregate and Aggregate Statistical:
functions like AVG(expression)
, MAX(expression)
, COUNT(*)
, etc. Check docs.
Example:
SELECT AVG(ALL salary) FROM cp.`employee.json` WHERE employee_id IN (1139, 1140, 1141);
Functions for Handling Nulls:
COALESCE
& NULLIF
. Check docs.
Example:
SELECT NULLIF(d9, d18) FROM alltypes limit 1;
SQL Window Functions are also supported. Check Details.
Nested Data Functions are there to FLATTEN, Find Repeated counts,etc. Check Details.
Query Directory Functions like MAXDIR
, MINDIR
. Check Details.
Apart from that, you can develop your own function. Check Tutorials.