This issue appears when the tool detects the usage of pyspark.sql.functions.datediff which has a workaround.
Note: This workaround is deprecated because a later tool version supports the daydiff snowpark function as a helper.
Input code:
contacts = (contacts#days since last event.withColumn('daysSinceLastEvent', datediff(lit(today),'lastEvent'))#days since deployment.withColumn('daysSinceLastDeployment', datediff(lit(today),'lastDeploymentEnd'))#days since online training.withColumn('daysSinceLastTraining', datediff(lit(today),'lastTraining'))#days since last RC login.withColumn('daysSinceLastRollCallLogin', datediff(lit(today),'adx_identity_lastsuccessfullogin'))#days since last EMS login.withColumn('daysSinceLastEMSLogin', datediff(lit(today),'vms_lastuserlogin')) )
Output code:
#EWI: SPRKPY1019 => pyspark.sql.functions.datediff has a workaround, see documentation for more infocontacts = (contacts#days since last event.withColumn('daysSinceLastEvent', datediff(lit(today),'lastEvent'))#days since deployment.withColumn('daysSinceLastDeployment', datediff(lit(today),'lastDeploymentEnd'))#days since online training.withColumn('daysSinceLastTraining', datediff(lit(today),'lastTraining'))#days since last RC login.withColumn('daysSinceLastRollCallLogin', datediff(lit(today),'adx_identity_lastsuccessfullogin'))#days since last EMS login.withColumn('daysSinceLastEMSLogin', datediff(lit(today),'vms_lastuserlogin')) )
Scenario:
datediff(end: ColumnOrName, start: ColumnOrName)
Action: Import snowpark_extensions package, which contains a helper for datediff function.
import snowpark_extensionscontacts = (contacts#days since last event.withColumn('daysSinceLastEvent', datediff(lit(today),'lastEvent'))#days since deployment.withColumn('daysSinceLastDeployment', datediff(lit(today),'lastDeploymentEnd'))#days since online training.withColumn('daysSinceLastTraining', datediff(lit(today),'lastTraining'))#days since last RC login.withColumn('daysSinceLastRollCallLogin', datediff(lit(today),'adx_identity_lastsuccessfullogin'))#days since last EMS login.withColumn('daysSinceLastEMSLogin', datediff(lit(today),'vms_lastuserlogin')) )
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.