Links

SPRKPY1039

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

Description

This issue appears when the tool detects the usage of pyspark.sql.column.Column.getItem which has a workaround.
Input code:
myColumn.getItem(0)
myColumn.getItem("fieldName")
Output code:
#EWI: SPRKPY1039 => pyspark.sql.column.Column.getItem has a workaround, see documentation for more info
myColumn.getItem(0)
myColumn.getItem("fieldName")

Scenario

getItem(key: Any) -> pyspark.sql.column.Column
Action: you can use the snowpark Column indexer operator with the name of the field or the position of the field as the index. Example:
myColumn[0]
myColumn["fieldName"]

Recommendation