SPRKPY1031

pyspark.sql.column.Column.contains has a workaround

Description

This issue appears when the tool detects the usage of pyspark.sql.column.Column.contains which has a workaround.

Input code:

booleanColumn = df.col.contains('o')

Output code:

#EWI: SPRKPY1030 => pyspark.sql.column.Column.contains has a workaround, see documentation for more info
booleanColumn = df.col.contains('o')

Scenario

Column.contains(self, item: Any)

Action: use the 'contains' function from 'snowflake.snowpark.functions', and add the column as the first parameter.

from snowflake.snowpark import functions as f
booleanColumn = f.contains(df.col, 'o')

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.