SPRKPY1021
pyspark.sql.functions.last
This issue code has been deprecated
Message: pyspark.sql.functions.last has a workaround, see documentation for more info
Category: Warning
Description
This issue appears when the SMA detects a use of the pyspark.sql.functions.last function, which has a workaround.
Scenario
Input
Below is an example of a use of the pyspark.sql.functions.last
function that generates this EWI. In this example, the last
function is used to get the last value for each name.
Output
The SMA adds the EWI SPRKPY1021
to the output code to let you know that this function is not directly supported by Snowpark, but it has a workaround.
Recommended fix
As a workaround, you can use the Snowflake LAST_VALUE function. To invoke this function from Snowpark, use the snowflake.snowpark.functions.call_builtin function and pass the string last_value
as the first argument and the corresponding column as the second argument. If you were using the name of the column in the last
function, you should convert it into a column when calling the call_builtin
function.
Additional recommendations
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
Last updated