div
operator
Applies to: Databricks SQL Databricks Runtime
Returns the integral part of the division of dividend
by divisor
.
Arguments
dividend
: An expression that evaluates to a numeric or interval.divisor
: A matching interval type ifdividend
is an interval, a numeric otherwise.
Interval is supported since: Databricks Runtime 10.1
Returns
A BIGINT
If divisor
is 0
, INTERVAL '0' SECOND
or INTERVAL '0' MONTH
the operator raises a DIVIDE_BY_ZERO error.
Note
In Databricks Runtime, if spark.sql.ansi.enabled is false
, the function returns NULL
instead of a DIVIDE_BY_ZERO error.