SIGN

This page describes the SIGN function in Lenses SQL.

SIGN(numExpr)

Returns +1 if a value is positive or -1 if a value is negative.

Available in:

ProcessorsSQL Studio

Sample code:

USE `kafka`;
SELECT 
    SIGN(integer) AS positive, 
    SIGN(NEG(integer)) AS negative 
FROM numbers-data
LIMIT 1;

Output:

{
  "value": {
    "positive": 1,
    "negative": -1
  }
}

We use the NEG function to emulate a negative value in this function.

Last updated

Logo

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