On this page

    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

    note:

    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

    note:

    If you use a combination of supported and non-supported functions, the code generation uses both Java and Gandiva splits.

    Function TypeSupported Functions
    OperatorsArithmetic : +, -, *, /,
    Relational : <, >, <=, >=, ==
    Miscisnull
    isnotnull
    hash32
    hash64
    is_distinct_from
    Is_not_distinct_from
    not
    sha1
    sha256
    Mathcbrt
    exp
    log
    Log10
    power
    round
    Trigonometrysin
    cos
    asin
    acos
    tan
    atan
    sinh
    cosh
    tanh
    cotg
    radians
    degrees
    Date/Timedate_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
    Stringbtrim
    concat
    length
    like
    ltrim
    octet_length
    rtrim
    split_part
    BooleanAND, OR
    ConversionCONVERT_FROM(expression, 'UTF8', replacement char)
    Castbinary_string
    castBIGINT
    castDATE
    castFLOAT4
    castFLOAT8
    castTIME(timestamp)
    castVARCHAR(numeric_types)
    BooleanAND, OR

    Limitations

    Gandiva does not support Windows.