bit_length function (Databricks SQL)

Returns the bit length of string data or number of bits of binary data.

Syntax

bit_length(expr)

Arguments

  • expr: An BINARY or STRING expression.

Returns

An INTEGER.

Examples

> SELECT bit_length('Spark SQL');
72
> SELECT bit_length('北京');
48