bit_length function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

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