Gandiva-based Execution
This topic describes Gandiva, supported functions, and limitations.
The Gandiva feature supports efficient evaluation of arbitrary SQL expressions on Arrow buffers using runtime code generation in LLVM. It uses LLVM tools to generate and compile code that makes optimal use of underlying CPU architecture. By combining LLVM with Apache Arrow libraries, Gandiva can perform low-level operations on Arrow in-memory buffers that are highly optimized for specific runtime environments, thus:
- Improving resource utilization
- Providing faster, lower-cost operations of analytical workloads
LLVM tools are a set of modular compiler tools that deal with code generation. They are used to compile and execute arbitrary expressions efficiently (instead of interpreting them). In the Dremio context, this is useful for generating code at runtime for two SQL operators that deal with arbitrary user expressions such as Project and Filter.
Supported Functions
If you use a combination of supported and non-supported functions, the code generation uses both Java and Gandiva splits.
Function Type | Supported Functions |
---|---|
Operators | Arithmetic : +, -, *, /, Relational : <, >, <=, >=, == |
Misc | isnull isnotnull hash32 hash64 is_distinct_from Is_not_distinct_from not sha1 sha256 |
Math | cbrt exp log Log10 power round |
Trigonometry | sin cos asin acos tan atan sinh cosh tanh cotg radians degrees |
Date/Time | date_add date_diff date_sub date_trunc_Century date_trunc_Day date_trunc_Decade date_trunc_Hour date_trunc_Millennium date_trunc_Minute date_trunc_Month date_trunc_Quarter date_trunc_Second date_trunc_Week date_trunc_Year date_add date_diff date_sub extractCentury extractDay extractDecade extractDow extractDoy extractEpoch extractHour extractMillennium extractMinute extractMonth extractQuarter extractSecond extractWeek last_day timestampaddDay timestampaddHour timestampaddMinute timestampaddMonth timestampaddQuarter timestampaddSecond timestampaddWeek timestampaddYear timestampdiffDay timestampdiffHour timestampdiffMinute timestampdiffMonth timestampdiffQuarter timestampdiffSecond timestampdiffWeek timestampdiffYear todate |
String | btrim concat length like ltrim octet_length rtrim split_part |
Boolean | AND, OR |
Conversion | CONVERT_FROM(expression, 'UTF8', replacement char) |
Cast | binary_string castBIGINT castDATE castFLOAT4 castFLOAT8 castTIME(timestamp) castVARCHAR(numeric_types) |
Boolean | AND, OR |
Limitations
Gandiva does not support Windows.