TRIM

This page describes the TRIM function in Lenses SQL.

TRIM(expr)

Removes leading and trailing spaces from the input expression.

Available in:

ProcessorsSQL Studio

Sample code:

USE `kafka`;
SELECT 
    LPAD(product_name, 50, ' '), 
    TRIM(LPAD(product_name, 50, ' ')), 
    product_name 
FROM products-topic
LIMIT 1;

Output:

{
  "value": {
    "LPAD": "                                        Soft Shirt",
    "TRIM": "Soft Shirt",
    "product_name": "Soft Shirt"
  }
}

LPAD function was used to emulate a space this way, using the TRIM function.

To know more about LPAD.

Last updated

Logo

2024 © Lenses.io Ltd. Apache, Apache Kafka, Kafka and associated open source project names are trademarks of the Apache Software Foundation.