shiftright | teradatamlspk | pyspark2teradataml - shiftright - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Function shiftright supports only integer values.

If you are using float values, you need to convert the value.

See how it works differently in PySpark and in teradatamlspk.

PySpark

df.withColumn("new_column", shiftright(df.col, 2)).show()

teradatamlspk

df1 = df.withColumn("col", floor(df.col))
df1.withColumn("new_column", shiftright(df1.col.cast(IntegerType()), 2)).show()