unaryMinus
Unary minus, i.e. negate the expression.
// Scala: select the amount column and negates all values.
df.select( -df("amount") )
// Kotlin:
import org.jetbrains.kotlinx.spark.api.*
df.select( -df("amount") )
// Java:
import static org.apache.spark.sql.functions.*;
df.select( negate(col("amount") );
Content copied to clipboard