SPRKPY1034

pyspark.sql.functions.desc has a workaround

Category

Warning.

Description

This issue appears when the tool detects the usage of pyspark.sql.functions.desc which has a workaround.

Note: This workaround is deprecated because a later tool version supports the desc snowflake function as direct.

Input code:

df.orderBy(desc(col))
df.orderBy(desc("colName"))

Output code:

#EWI: SPRKPY1034 => pyspark.sql.functions.desc has a workaround, see documentation for more info
df.orderBy(desc(col))
#EWI: SPRKPY1034 => pyspark.sql.functions.desc has a workaround, see documentation for more info
df.orderBy(desc("colName"))

Scenarios

This function has two overloads:

1. desc(col: Column)

Action: use instead com.snowflake.snowpark.Column.desc function, by applying it to the column parameter. For example:

df.orderBy(col.asc())

2. desc(colName: str)

Action: use instead com.snowflake.snowpark.Column.desc function, by converting the parameter string into a column (by using col function) and then applying desc to it. For example:

df.orderBy(col("colName").desc())

Recommendation

  • For more support, you can email us at snowconvert-info@snowflake.com. If you have a contract for support with Snowflake, reach out to your sales engineer and they can direct your support needs.

Last updated