Snowpark Migration Accelerator : Codes de problème pour Python¶
SPRKPY1000¶
Message : La version spark-core du projet source est xx.xx:xx.x.x, la version spark-core prise en charge par Snowpark est 2.12:3.1.2. Il peut donc y avoir des différences de fonctionnalité entre les mappages existants.
Catégorie : Avertissement
Description¶
Ce problème apparaît lorsque la version Pyspark de votre code source n’est pas prise en charge. Cela signifie qu’il peut y avoir des différences fonctionnelles entre les mappages existants.
Recommandations supplémentaires¶
La version pyspark analysée par SMA pour la compatibilité avec Snowpark est comprise entre 2.12 et 3.1.2. Si vous utilisez une version en dehors de cette plage, l’outil peut produire des résultats incohérents. Vous pourriez modifier la version du code source que vous analysez.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1001¶
Message**:** This code section has parsing errors
Category**:** Parsing error.
Description¶
Une erreur d’analyse est signalée par l’outil Snowpark Migration Accelerator (SMA) lorsqu’il ne peut pas lire ou comprendre correctement le code d’un fichier (il ne peut pas « analyser » correctement le fichier). Ce code de problème apparaît lorsqu’un fichier présente une ou plusieurs erreurs d’analyse.
Scénario¶
Entrée : Le message EWI apparaît lorsque le code présente une syntaxe non valide, par exemple :
Sortie : SMA détecte une erreur d’analyse et commente l’erreur d’analyse en ajoutant le message EWI correspondant :
Recommandations supplémentaires¶
Check that the file contains valid Python code. (You can use the issues.csv file to find all files with this EWI code to determine which file(s) were not processed by the tool due to parsing error(s).) Many parsing errors occur because only part of the code is input into the tool, so it’s bets to ensure that the code will run in the source. If it is valid, report that you encountered a parsing error using the Report an Issue option in the SMA. Include the line of code that was causing a parsing error in the description when you file this issue.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1002¶
Message**:** < element > is not supported,Spark element is not supported.
Category**:** Conversion error.
Description¶
Ce problème apparaît lorsque l’outil détecte l’utilisation d’un élément qui n’est pas pris en charge par Snowpark, et qui n’a pas son propre code d’erreur associé. Il s’agit du code d’erreur générique utilisé par SMA pour un élément non pris en charge.
Recommandations supplémentaires¶
Même si l’option ou l’élément du message n’est pas pris en charge, cela ne signifie pas qu’une solution ne peut être trouvée. Cela signifie seulement que l’outil lui-même ne peut pas trouver la solution.
Si vous avez rencontré un élément non pris en charge d’une bibliothèque pyspark.ml, envisagez une approche alternative. Il existe d’autres guides disponibles pour résoudre les problèmes liés à ML, comme celui de Snowflake.
Vérifiez que la syntaxe du code source est correcte. (Vous pouvez utiliser le fichier issues.csv pour déterminer où se produisent les erreurs de conversion) Si la syntaxe est correcte, signalez que vous avez rencontré une erreur de conversion sur un élément particulier en utilisant l’option Signaler un problème dans SMA. Incluez la ligne de code à l’origine de l’erreur dans la description lorsque vous déclarez ce problème.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1003¶
Message**:** An error occurred when loading the symbol table.
Category**:** Conversion error.
Description¶
Ce problème apparaît en cas d’erreur de traitement des symboles dans la table des symboles. La table des symboles fait partie de l’architecture sous-jacente de l’outil SMA, ce qui permet des conversions plus complexes. Cette erreur peut être due à une instruction inattendue dans le code source.
Recommandations supplémentaires¶
This is unlikely to be an error in the source code itself, but rather is an error in how the tool processes the source code. The best resolution would be to post an issue in the SMA.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1004¶
Message**:** The symbol table could not be loaded.
Category**:** Parsing error.
Description¶
Ce problème apparaît en cas d’erreur inattendue dans le processus d’exécution de l’outil. La table des symboles ne pouvant être chargée, l’outil ne peut pas lancer le processus d’évaluation ou de conversion.
Recommandations supplémentaires¶
This is unlikely to be an error in the source code itself, but rather is an error in how the tool processes the source code. The best resolution would be to reach out to the SMA support team. You can email us at sma-support@snowflake.com.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1005¶
Avertissement
This issue code has been deprecated since Spark Conversion Core Version 4.8.0
Message**:** pyspark.conf.SparkConf is not required
Category**:** Warning.
Description¶
This issue appears when the tool detects the usage of pyspark.conf.SparkConf which is not required.
Scénario¶
Entrée
SparkConf peut être appelé sans paramètres ou avec loadDefaults.
Sortie
For both cases (with or without parameters) SMA creates a Snowpark Session.builder object:
Recommandations supplémentaires¶
Il s’agit de la suppression d’un paramètre inutile et de l’insertion d’un commentaire d’avertissement. L’utilisateur ne doit effectuer aucune action supplémentaire.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1006¶
Avertissement
This issue code has been deprecated since Spark Conversion Core Version 4.8.0
Message**:** pyspark.context.SparkContext is not required
Category**:** Warning.
Description¶
This issue appears when the tool detects the usage of pyspark.context.SparkContext, which is not required in Snowflake.
Scénario¶
Entrée
Dans cet exemple, il y a deux contextes pour créer une connexion à un cluster Spark.
Sortie
Étant donné qu’il n’y a pas de cluster dans Snowflake, le contexte n’est pas nécessaire. Notez que les variables my_sc1 et my_sc2 qui contiennent les propriétés Spark peuvent ne pas être nécessaires ou devront être adaptées pour corriger le code.
Recommandations supplémentaires¶
Il s’agit de la suppression d’un paramètre inutile et de l’insertion d’un commentaire d’avertissement. L’utilisateur ne doit effectuer aucune action.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1007¶
Avertissement
This issue code has been deprecated since Spark Conversion Core Version 4.8.0
Message**:** pyspark.sql.context.SQLContext is not required
Category**:** Warning.
Description¶
This issue appears when the tool detects the usage of pyspark.sql.context.SQLContext, which is not required.
Scénario¶
Entrée
Voici un exemple avec différentes surcharges SparkContext.
Sortie
Le code de sortie a commenté la ligne pour pyspark.SQLContext, et remplace les scénarios par une référence à une configuration. Notez que les variables my_sc1 et my_sc2 qui contiennent les propriétés Spark peuvent ne pas être nécessaires ou devront être adaptées pour corriger le code.
Recommandations supplémentaires¶
Il s’agit d’un paramètre inutile qui est supprimé et pour lequel un commentaire d’avertissement a été inséré dans le code source. L’utilisateur ne doit effectuer aucune action.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1008¶
Message : pyspark.sql.context.HiveContext n’est pas requis
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.context.HiveContext, which is not required.
Scénario¶
Entrée
Dans cet exemple, il s’agit de créer une connexion à un magasin Hive.
Sortie
In Snowflake there are not Hive stores, so the Hive Context is not required, You can still use parquet files on Snowflake please check this tutorial to learn how.
the sc variable refers to a Snow Park Session Object
Correction recommandée
For the output code in the example you should add the Snow Park Session Object similar to this code:
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1009¶
Message**:** pyspark.sql.dataframe.DataFrame.approxQuantile has a workaround
Category**:** Warning.
Description¶
This issue appears when the tool detects the usage of pyspark.sql.dataframe.DataFrame.approxQuantile which has a workaround.
Scénario¶
Entrée
It’s important understand that Pyspark uses two different approxQuantile functions, here we use the DataFrame approxQuantile version
Sortie
SMA renvoie l’EWI SPRKPY1009 sur la ligne où approxQuantile est utilisé, ce qui vous permet d’identifier l’endroit à corriger.
Correction recommandée
Use Snowpark approxQuantile method. Some parameters don’t match so they require some manual adjustments. for the output code’s example a recommended fix could be:
Le paramètre d’erreur relatif à pyspark.sql.dataframe.DataFrame.approxQuantile n’existe pas dans SnowPark.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1010¶
Message : pyspark.sql.dataframe.DataFrame.checkpoint a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.dataframe.DataFrame.checkpoint which has a workaround.
Scénario¶
Entrée
Dans PySpark, les points de contrôle sont utilisés pour tronquer le plan logique d’un dataframe, ceci afin d’éviter le développement d’un plan logique.
Sortie
SMA returns the EWI SPRKPY1010 over the line where approxQuantile is used, so you can use to identify where to fix. Note that also marks the setCheckpointDir as unsupported, but a checpointed directory is not required for the fix.
Correction recommandée
Snowpark élimine le besoin de points de contrôle explicites : en effet, Snowpark travaille avec des opérations basées sur SQL qui sont optimisées par le moteur d’optimisation des requêtes de Snowflake, ce qui élimine le besoin de calculs non requis ou de plans logiques qui deviennent incontrôlables.
However there could be scenarios where you would require persist the result of a computation on a dataframe. In this scenarios you can save materialize the results by writing the dataframe on a Snowflake Table or in a Snowflake Temporary Table.
L’utilisation d’une table permanente ou le résultat du calcul est accessible à tout moment, même après la fin de la session.
Une correction alternative, l’utilisation d’une table temporaire, présente l’avantage que la table est supprimée après la fin de la session :
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1011¶
Message : pyspark.sql.dataframe.DataFrameStatFunctions.approxQuantile a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.dataframe.DataFrameStatFunctions.approxQuantile which has a workaround.
Scénario¶
Entrée
It’s important understand that Pyspark uses two different approxQuantile functions, here we use the DataFrameStatFunctions approxQuantile version.
Sortie
SMA renvoie l’EWI SPRKPY1011 sur la ligne où approxQuantile est utilisé, ce qui vous permet d’identifier l’endroit à corriger.
Correction recommandée
You can use Snowpark approxQuantile method. Some parameters don’t match so they require some manual adjustments. for the output code’s example a recommended fix could be:
Le paramètre d’erreur relatif à pyspark.sql.dataframe.DataFrame.approxQuantile n’existe pas dans SnowPark.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1012¶
Avertissement
Ce code de problème est maintenant obsolète.
Message : pyspark.sql.dataframe.DataFrameStatFunctions.writeTo a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.dataframe.DataFrameStatFunctions.writeTo which has a workaround.
Scénario¶
Entrée
Pour cet exemple, le dataframe df est écrit dans une table Spark « table ».
Sortie
SMA renvoie l’EWI SPRKPY1012 sur la ligne où DataFrameStatFunctions.writeTo est utilisé, ce qui vous permet d’identifier l’endroit à corriger.
Correction recommandée
Au lieu de cela, utilisez df.write.SaveAsTable().
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1013¶
Message : pyspark.sql.functions.acosh a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.functions.acosh which has a workaround.
Scénario¶
Entrée
On this example pyspark calculates the acosh for a dataframe by using pyspark.sql.functions.acosh
Sortie
SMA renvoie l’EWI SPRKPY1013 sur la ligne où acosh est utilisé, ce qui vous permet d’identifier l’endroit à corriger.
Correction recommandée
There is no direct « acosh » implementation but « call_function » can be used instead, using « acosh » as the first parameter, and colName as the second one.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1014¶
Message : pyspark.sql.functions.asinh a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.functions.asinh which has a workaround.
Scénario¶
Entrée
On this example pyspark calculates the asinh for a dataframe by using pyspark.sql.functions.asinh.
Sortie
SMA renvoie l’EWI SPRKPY1014 sur la ligne où asinh est utilisé, ce qui vous permet d’identifier l’endroit à corriger.
Correction recommandée
There is no direct « asinh » implementation but « call_function » can be used instead, using « asinh » as the first parameter, and colName as the second one.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1015¶
Message : pyspark.sql.functions.atanh a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.functions.atanh which has a workaround.
Scénario¶
Entrée
On this example pyspark calculates the atanh for a dataframe by using pyspark.sql.functions.atanh.
Sortie
SMA renvoie l’EWI SPRKPY1015 sur la ligne où atanh est utilisé, ce qui vous permet d’identifier l’endroit à corriger.
Correction recommandée
There is no direct « atanh » implementation but « call_function » can be used instead, using « atanh » as the first parameter, and colName as the second one.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1016¶
Avertissement
This issue code has been deprecated since Spark Conversion Core Version 0.11.7
Message : pyspark.sql.functions.collect_set a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.functions.collect_set which has a workaround.
Scénario¶
Entrée
Using collect*set to get the elements of _colname* without duplicates:
Sortie
SMA renvoie l’EWI SPRKPY1016 sur la ligne où collect_set est utilisé, ce qui vous permet d’identifier l’endroit à corriger.
Correction recommandée
Utilisez la fonction array_agg et ajoutez un deuxième argument avec la valeur True.
Recommandation supplémentaire¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1017¶
Avertissement
This issue code has been deprecated since Spark Conversion Core Version 4.8.0
pyspark.sql.functions.date_add a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.functions.date_add which has a workaround.
Scénario¶
Entrée
Dans cet exemple, nous utilisons date_add pour calculer la date 5 jours après la date actuelle pour le dataframe df.
Sortie
SMA renvoie l’EWI SPRKPY1017 sur la ligne où date_add est utilisé, ce qui vous permet d’identifier l’endroit à corriger.
Correction recommandée
Import snowflake.snowpark.functions, which contains an implementation for date_add (and alias dateAdd) function.
Recommandation supplémentaire¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1018¶
Avertissement
This issue code has been deprecated since Spark Conversion Core Version 4.8.0
Message : pyspark.sql.functions.date_sub a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.functions.date_sub which has a workaround.
Scénario¶
Entrée
Dans cet exemple, nous utilisons date_add pour calculer la date 5 jours avant la date actuelle pour le dataframe df.
Sortie
SMA renvoie l’EWI SPRKPY1018 sur la ligne où date_sub est utilisé, ce qui vous permet d’identifier l’endroit à corriger.
Correction recommandée
Import snowflake.snowpark.functions, which contains an implementation for date_sub function.
Recommandation supplémentaire¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1019¶
Avertissement
This issue code has been deprecated since Spark Conversion Core Version 4.8.0
Message : pyspark.sql.functions.datediff a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.functions.datediff which has a workaround.
Scénario¶
Entrée
Dans cet exemple, nous utilisons datediff pour calculer la différence de jour entre “today” et d’autres dates.
Sortie
SMA renvoie l’EWI SPRKPY1019 sur la ligne où datediff est utilisé, ce qui vous permet d’identifier l’endroit à corriger.
SMA convert pyspark.sql.functions.datediff onto snowflake.snowpark.functions.daydiff that also calculates the diference in days between two dates.
Correction recommandée
datediff(part: string ,end: ColumnOrName, start: ColumnOrName)
Action: Import snowflake.snowpark.functions, which contains an implementation for datediff function that requires an extra parameter for date time part and allows more versatility on calculate differences between dates.
Recommandation¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1020¶
Message : pyspark.sql.functions.instr a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.functions.instr which has a workaround.
Scénario¶
Entrée
Voici un exemple d’utilisation de pyspark instr :
Sortie :
SMA renvoie l’EWI SPRKPY1020 sur la ligne où instr est utilisé, ce qui vous permet d’identifier l’endroit à corriger.
Correction recommandée
Requires a manual change by using the function charindex and changing the order of the first two parameters.
Recommandation supplémentaire¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1021¶
Avertissement
Ce code de problème est maintenant obsolète.
Message : pyspark.sql.functions.last a une solution de contournement. Voir la documentation pour plus d’informations
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.last function, which has a workaround.
Scénario¶
Entrée
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.
Sortie
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.
Correction recommandée
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.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
description: >-
The mode parameter in the methods of CSV, JSON and PARQUET is transformed to
overwrite
SPRKPY1022¶
Message : pyspark.sql.functions.log10 a une solution de contournement. Voir la documentation pour plus d’informations
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.log10 function, which has a workaround.
Scénario¶
Entrée
Below is an example of a use of the pyspark.sql.functions.log10 function that generates this EWI. In this example, the log10 function is used to calculate the base-10 logarithm of the value column.
Sortie
The SMA adds the EWI SPRKPY1022 to the output code to let you know that this function is not directly supported by Snowpark, but it has a workaround.
Correction recommandée
As a workaround, you can use the snowflake.snowpark.functions.log function by passing the literal value 10 as the base.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1023¶
Message : pyspark.sql.functions.log1p a une solution de contournement. Voir la documentation pour plus d’informations
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.log1p function, which has a workaround.
Scénario¶
Entrée
Below is an example of a use of the pyspark.sql.functions.log1p function that generates this EWI. In this example, the log1p function is used to calculate the natural logarithm of the value column.
Sortie
The SMA adds the EWI SPRKPY1023 to the output code to let you know that this function is not directly supported by Snowpark, but it has a workaround.
Correction recommandée
As a workaround, you can use the call_function function by passing the string ln as the first argument and by adding 1 to the second argument.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1024¶
Message : pyspark.sql.functions.log2 a une solution de contournement. Voir la documentation pour plus d’informations
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.log2 function, which has a workaround.
Scénario¶
Entrée
Below is an example of a use of the pyspark.sql.functions.log2 function that generates this EWI. In this example, the log2 function is used to calculate the base-2 logarithm of the value column.
Sortie
The SMA adds the EWI SPRKPY1024 to the output code to let you know that this function is not directly supported by Snowpark, but it has a workaround.
Correction recommandée
As a workaround, you can use the snowflake.snowpark.functions.log function by passing the literal value 2 as the base.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1025¶
Avertissement
Ce code de problème est maintenant obsolète.
Message : pyspark.sql.functions.ntile a une solution de contournement. Voir la documentation pour plus d’informations
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.ntile function, which has a workaround.
Scénario¶
Entrée
Below is an example of a use of the pyspark.sql.functions.ntile function that generates this EWI. In this example, the ntile function is used to divide the rows into 3 buckets.
Sortie
The SMA adds the EWI SPRKPY1025 to the output code to let you know that this function is not directly supported by Snowpark, but it has a workaround.
Correction recommandée
Snowpark has an equivalent ntile function, however, the argument pass to it should be a column. As a workaround, you can convert the literal argument into a column using the snowflake.snowpark.functions.lit function.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1026¶
Avertissement
This issue code has been deprecated since Spark Conversion Core 4.3.2
Message : pyspark.sql.readwriter.DataFrameReader.csv a une solution de contournement. Voir la documentation pour plus d’informations
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects a use of the pyspark.sql.readwriter.DataFrameReader.csv function, which has a workaround.
Scénario¶
Entrée
Below is an example of a use of the pyspark.sql.readwriter.DataFrameReader.csv function that generates this EWI. In this example, the csv function is used to read multiple .csv files with a given schema and uses some extra options such as encoding, header and sep to fine-tune the behavior of reading the files.
Sortie
The SMA adds the EWI SPRKPY1026 to the output code to let you know that this function is not directly supported by Snowpark, but it has a workaround.
Correction recommandée
In this section, we explain how to configure the path parameter, the schema parameter and some options to make them work in Snowpark.
1. Paramètre path
Snowpark requires the path parameter to be a stage location so, as a workaround, you can create a temporary stage and add each .csv file to that stage using the prefix file://.
2. Paramètre schema
Snowpark does not allow defining the schema as a parameter of the csv function. As a workaround, you can use the snowflake.snowpark.DataFrameReader.schema function.
3. Paramètres des options
Snowpark does not allow defining the extra options as parameters of the csv function. As a workaround, for many of them you can use the snowflake.snowpark.DataFrameReader.option function to specify those parameters as options of the DataFrameReader.
Note
Les options suivantes ne sont pas prises en charge par Snowpark :
columnNameOfCorruptRecord
emptyValue
enforceSchema
header
ignoreLeadingWhiteSpace
ignoreTrailingWhiteSpace
inferSchema
locale
maxCharsPerColumn
maxColumns
mode
multiLine
nanValue
negativeInf
nullValue
positiveInf
quoteAll
samplingRatio
timestampNTZFormat
unescapedQuoteHandling
Vous trouverez ci-dessous l’exemple complet de ce à quoi devrait ressembler le code d’entrée après avoir appliqué les suggestions mentionnées ci-dessus pour qu’il fonctionne dans Snowpark :
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1027¶
Avertissement
This issue code has been deprecated since Spark Conversion Core 4.5.2
Message : pyspark.sql.readwriter.DataFrameReader.json a une solution de contournement. Voir la documentation pour plus d’informations
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects a use of the pyspark.sql.readwriter.DataFrameReader.json function, which has a workaround.
Scénario¶
Entrée
Below is an example of a use of the pyspark.sql.readwriter.DataFrameReader.json function that generates this EWI. In this example, the json function is used to read multiple .json files with a given schema and uses some extra options such as primitiveAsString and dateFormat to fine-tune the behavior of reading the files.
Sortie
The SMA adds the EWI SPRKPY1027 to the output code to let you know that this function is not directly supported by Snowpark, but it has a workaround.
Correction recommandée
In this section, we explain how to configure the path parameter, the schema parameter and some options to make them work in Snowpark.
1. Paramètre path
Snowpark requires the path parameter to be a stage location so, as a workaround, you can create a temporary stage and add each .json file to that stage using the prefix file://.
2. Paramètre schema
Snowpark does not allow defining the schema as a parameter of the json function. As a workaround, you can use the snowflake.snowpark.DataFrameReader.schema function.
3. Paramètres des options
Snowpark does not allow defining the extra options as parameters of the json function. As a workaround, for many of them you can use the snowflake.snowpark.DataFrameReader.option function to specify those parameters as options of the DataFrameReader.
Note
Les options suivantes ne sont pas prises en charge par Snowpark :
allowBackslashEscapingAnyCharacter
allowComments
allowNonNumericNumbers
allowNumericLeadingZero
allowSingleQuotes
allowUnquotedControlChars
allowUnquotedFieldNames
columnNameOfCorruptRecord
dropFiledIfAllNull
encoding
ignoreNullFields
ligneSep
locale
mode
multiline
prefersDecimal
primitiveAsString
samplingRatio
timestampNTZFormat
timeZone
Vous trouverez ci-dessous l’exemple complet de ce à quoi devrait ressembler le code d’entrée après avoir appliqué les suggestions mentionnées ci-dessus pour qu’il fonctionne dans Snowpark :
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1028¶
Message : pyspark.sql.readwriter.DataFrameReader.orc a une solution de contournement. Voir la documentation pour plus d’informations
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects a use of the pyspark.sql.readwriter.DataFrameReader.orc function, which has a workaround.
Scénario¶
Entrée
Below is an example of a use of the pyspark.sql.readwriter.DataFrameReader.orc function that generates this EWI. In this example, the orc function is used to read multiple .orc files and uses some extra options such as mergeSchema and recursiveFileLookup to fine-tune the behavior of reading the files.
Sortie
The SMA adds the EWI SPRKPY1028 to the output code to let you know that this function is not directly supported by Snowpark, but it has a workaround.
Correction recommandée
In this section, we explain how to configure the path parameter and the extra options to make them work in Snowpark.
1. Paramètre path
Snowpark requires the path parameter to be a stage location so, as a workaround, you can create a temporary stage and add each .orc file to that stage using the prefix file://.
2. Paramètres des options
Snowpark does not allow defining the extra options as parameters of the orc function. As a workaround, for many of them you can use the snowflake.snowpark.DataFrameReader.option function to specify those parameters as options of the DataFrameReader.
Note
Les options suivantes ne sont pas prises en charge par Snowpark :
compression
mergeSchema
Vous trouverez ci-dessous l’exemple complet de ce à quoi devrait ressembler le code d’entrée après avoir appliqué les suggestions mentionnées ci-dessus pour qu’il fonctionne dans Snowpark :
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1029¶
Message : Ce problème apparaît lorsque l’outil détecte l’utilisation de pyspark.sql.readwriter.DataFrameReader.parquet. Cette fonction est prise en charge, mais certaines différences entre Snowpark et Spark API peuvent nécessiter quelques modifications manuelles.
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects a use of the pyspark.sql.readwriter.DataFrameReader.parquet function. This function is supported by Snowpark, however, there are some differences that would require some manual changes.
Scénario¶
Entrée
Below is an example of a use of the pyspark.sql.readwriter.DataFrameReader.parquet function that generates this EWI.
Sortie
The SMA adds the EWI SPRKPY1029 to the output code to let you know that this function is supported by Snowpark, but it requires some manual adjustments. Please note that the options supported by Snowpark are transformed into option function calls and those that are not supported are removed. This is explained in more detail in the next sections.
Correction recommandée
In this section, we explain how to configure the paths and options parameters to make them work in Snowpark.
1. Paramètre path
In Spark, this parameter can be a local or cloud location. Snowpark only accepts cloud locations using a snowflake stage. So, you can create a temporal stage and add each file into it using the prefix file://.
2. Paramètre des options
Snowpark does not allow defining the different options as parameters of the parquet function. As a workaround, you can use the option or options functions to specify those parameters as extra options of the DataFrameReader.
Veuillez noter que les options Snowpark ne sont pas exactement les mêmes que les options PySpark et que des modifications manuelles peuvent donc être nécessaires. Vous trouverez ci-dessous une explication plus détaillée de la configuration des options PySpark les plus courantes dans Snowpark.
2.1 Option mergeSchema
Parquet supports schema evolution, allowing users to start with a simple schema and gradually add more columns as needed. This can result in multiple parquet files with different but compatible schemas. In Snowflake, thanks to the infer_schema capabilities you don’t need to do that and therefore the mergeSchema option can just be removed.
2.2 Option pathGlobFilter
If you want to load only a subset of files from the stage, you can use the pattern option to specify a regular expression that matches the files you want to load. The SMA already automates this as you can see in the output of this scenario.
2.3 Option recursiveFileLookupstr
This option is not supported by Snowpark. The best recommendation is to use a regular expression like with the pathGlobFilter option to achieve something similar.
2.4 Option modifiedBefore / modifiedAfter
You can achieve the same result in Snowflake by using the metadata columns.
Note
Les options suivantes ne sont pas prises en charge par Snowpark :
compression
datetimeRebaseMode
int96RebaseMode
mergeSchema
Vous trouverez ci-dessous l’exemple complet de la façon dont le code d’entrée doit être transformé pour qu’il fonctionne dans Snowpark :
Recommandations supplémentaires¶
Dans Snowflake, vous pouvez exploiter d’autres approches pour l’ingestion de données parquet, comme les suivantes :
Leveraging native parquet ingestion capabilities. Consider also autoingest with snowpipe.
Parquet external tables which can be pointed directly to cloud file locations.
Using Iceberg tables.
Lors d’une migration, il est conseillé d’utiliser les rapports SMA pour tenter de dresser un inventaire des fichiers et de déterminer, après la modernisation, à quelles zones de préparation/tables les données seront mappées.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1030¶
Avertissement
Ce code de problème est maintenant obsolète.
Message : pyspark.sql.session.SparkSession.Builder.appName a une solution de contournement. Voir la documentation pour plus d’informations.
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects a use of the pyspark.sql.session.SparkSession.Builder.appName function, which has a workaround.
Scénario¶
Entrée
Below is an example of a use of the pyspark.sql.session.SparkSession.Builder.appName function that generates this EWI. In this example, the appName function is used to set MyApp as the name of the application.
Sortie
The SMA adds the EWI SPRKPY1030 to the output code to let you know that this function is not directly supported by Snowpark, but it has a workaround.
Correction recommandée
As a workaround, you can import the snowpark_extensions package which provides an extension for the appName function.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1031¶
Avertissement
This issue code has been deprecated since Spark Conversion Core 2.7.0
Message : pyspark.sql.column.Column.contains a une solution de contournement. Voir la documentation pour plus d’informations
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects a use of the pyspark.sql.column.Column.contains function, which has a workaround.
Scénario¶
Entrée
Below is an example of a use of the pyspark.sql.column.Column.contains function that generates this EWI. In this example, the contains function is used to filter the rows where the “City” column contains the substring “New”.
Sortie
The SMA adds the EWI SPRKPY1031 to the output code to let you know that this function is not directly supported by Snowpark, but it has a workaround.
Correction recommandée
As a workaround, you can use the snowflake.snowpark.functions.contains function by passing the column as the first argument and the element to search as the second argument. If the element to search is a literal value then it should be converted into a column expression using the lit function.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1032¶
Message: *spark element* is not defined
Catégorie : Erreur de conversion
Description¶
Ce problème apparaît lorsque l’outil SMA n’a pas pu déterminer un statut de mappage approprié pour l’élément donné. Cela signifie que SMA ne sait pas encore si cet élément est pris en charge ou non par Snowpark. Veuillez noter qu’il s’agit d’un code d’erreur générique utilisé par SMA pour tout élément non défini.
Scénario¶
Entrée
Below is an example of a function for which the SMA could not determine an appropriate mapping status. In this case, you should assume that not_defined_function() is a valid PySpark function and the code runs.
Sortie
The SMA adds the EWI SPRKPY1032 to the output code to let you know that this element is not defined.
Correction recommandée
Pour tenter d’identifier le problème, vous pouvez effectuer les validations suivantes :
Vérifiez que la syntaxe du code source est correcte et qu’il est correctement orthographié.
Check if you are using a PySpark version supported by the SMA. To know which PySpark version is supported by the SMA at the moment of running the SMA, you can review the first page of the
DetailedReport.docxfile.
If this is a valid PySpark element, please report that you encountered a conversion error on that particular element using the Report an Issue option of the SMA and include any additional information that you think may be helpful.
Please note that if an element is not defined, it does not mean that it is not supported by Snowpark. You should check the Snowpark Documentation to verify if an equivalent element exist.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1033¶
Avertissement
Ce code de problème est maintenant obsolète.
Message : pyspark.sql.functions.asc a une solution de contournement. Voir la documentation pour plus d’informations
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.asc function, which has a workaround.
Scénarios¶
The pyspark.sql.functions.asc function takes either a column object or the name of the column as a string as its parameter. Both scenarios are not supported by Snowpark so this EWI is generated.
Scénario 1¶
Entrée
Below is an example of a use of the pyspark.sql.functions.asc function that takes a column object as parameter.
Sortie
The SMA adds the EWI SPRKPY1033 to the output code to let you know that the asc function with a column object parameter is not directly supported by Snowpark, but it has a workaround.
Correction recommandée
As a workaround, you can call the snowflake.snowpark.Column.asc function from the column parameter.
Scénario 2¶
Entrée
Below is an example of a use of the pyspark.sql.functions.asc function that takes the name of the column as parameter.
Sortie
The SMA adds the EWI SPRKPY1033 to the output code to let you know that the asc function with a column name parameter is not directly supported by Snowpark, but it has a workaround.
Correction recommandée
As a workaround, you can convert the string parameter into a column object using the snowflake.snowpark.functions.col function and then call the snowflake.snowpark.Column.asc function.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1034¶
Avertissement
Ce code de problème est maintenant obsolète.
Message : pyspark.sql.functions.desc a une solution de contournement. Voir la documentation pour plus d’informations
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.desc function, which has a workaround.
Scénarios¶
The pyspark.sql.functions.desc function takes either a column object or the name of the column as a string as its parameter. Both scenarios are not supported by Snowpark so this EWI is generated.
Scénario 1¶
Entrée
Below is an example of a use of the pyspark.sql.functions.desc function that takes a column object as parameter.
Sortie
The SMA adds the EWI SPRKPY1034 to the output code to let you know that the desc function with a column object parameter is not directly supported by Snowpark, but it has a workaround.
Correction recommandée
As a workaround, you can call the snowflake.snowpark.Column.desc function from the column parameter.
Scénario 2¶
Entrée
Below is an example of a use of the pyspark.sql.functions.desc function that takes the name of the column as parameter.
Sortie
The SMA adds the EWI SPRKPY1034 to the output code to let you know that the desc function with a column name parameter is not directly supported by Snowpark, but it has a workaround.
Correction recommandée
As a workaround, you can convert the string parameter into a column object using the snowflake.snowpark.functions.col function and then call the snowflake.snowpark.Column.desc function.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1035¶
Avertissement
Ce code de problème est maintenant obsolète.
Message : pyspark.sql.functions.reverse a une solution de contournement. Voir la documentation pour plus d’informations
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.reverse function, which has a workaround.
Scénario¶
Entrée
Below is an example of a use of the pyspark.sql.functions.reverse function that generates this EWI. In this example, the reverse function is used to reverse each string of the word column.
Sortie
The SMA adds the EWI SPRKPY1035 to the output code to let you know that this function is not directly supported by Snowpark, but it has a workaround.
Correction recommandée
As a workaround, you can import the snowpark_extensions package which provides an extension for the reverse function.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1036¶
Avertissement
Ce code de problème est maintenant obsolète.
Message : pyspark.sql.column.Column.getField a une solution de contournement. Voir la documentation pour plus d’informations
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects a use of the pyspark.sql.column.Column.getField function, which has a workaround.
Scénario¶
Entrée
Below is an example of a use of the pyspark.sql.column.Column.getField function that generates this EWI. In this example, the getField function is used to extract the name from the info column.
Sortie
The SMA adds the EWI SPRKPY1036 to the output code to let you know that this function is not directly supported by Snowpark, but it has a workaround.
Correction recommandée
As a workaround, you can use the Snowpark column indexer operator with the name of the field as the index.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1037¶
Avertissement
Ce code de problème est maintenant obsolète.
Message : pyspark.sql.functions.sort_array a une solution de contournement. Voir la documentation pour plus d’informations
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.sort_array function, which has a workaround.
Scénario¶
Entrée
Below is an example of a use of the pyspark.sql.functions.sort_array function that generates this EWI. In this example, the sort_array function is used to sort the numbers array in ascending and descending order.
Sortie
The SMA adds the EWI SPRKPY1037 to the output code to let you know that this function is not directly supported by Snowpark, but it has a workaround.
Correction recommandée
As a workaround, you can import the snowpark_extensions package which provides an extension for the sort_array function.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1038¶
Message: *spark element* is not yet recognized
Catégorie : Erreur de conversion
Description¶
Ce problème apparaît lorsque votre code source contient un élément PySpark qui n’a pas été reconnu par l’outil SMA. Cela peut se produire pour différentes raisons, comme par exemple :
Un élément qui n’existe pas dans PySpark.
Un élément qui a été ajouté dans une version de PySpark et qui n’est pas encore pris en charge par SMA.
Une erreur interne de l’outil SMA lors du traitement de l’élément.
Il s’agit d’un code d’erreur générique utilisé par SMA pour tout élément non reconnu.
Scénario¶
Entrée
Vous trouverez ci-dessous un exemple d’utilisation d’une fonction qui n’a pas pu être reconnue par l’outil SMA car elle n’existe pas dans PySpark.
Sortie
The SMA adds the EWI SPRKPY1038 to the output code to let you know that this element could not be recognized.
Correction recommandée
Pour tenter d’identifier le problème, vous pouvez effectuer les validations suivantes :
Vérifiez si l’élément existe dans PySpark.
Vérifiez que l’élément est correctement orthographié.
Check if you are using a PySpark version supported by the SMA. To know which PySpark version is supported by the SMA at the moment of running the SMA, you can review the first page of the
DetailedReport.docxfile.
If it is a valid PySpark element, please report that you encountered a conversion error on that particular element using the Report an Issue option of the SMA and include any additional information that you think may be helpful.
Please note that if an element could not be recognized by the SMA, it does not mean that it is not supported by Snowpark. You should check the Snowpark Documentation to verify if an equivalent element exist.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1039¶
Avertissement
Ce code de problème est maintenant obsolète.
Message : pyspark.sql.column.Column.getItem a une solution de contournement. Voir la documentation pour plus d’informations
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects a use of the pyspark.sql.column.Column.getItem function, which has a workaround.
Scénario¶
Entrée
Below is an example of a use of the pyspark.sql.column.Column.getItem function that generates this EWI. In this example, the getItem function is used to get an item by position and by key.
Sortie
The SMA adds the EWI SPRKPY1039 to the output code to let you know that this function is not directly supported by Snowpark, but it has a workaround.
Correction recommandée
Pour contourner ce problème, vous pouvez utiliser l”opérateur d’indexation de colonne de Snowpark avec le nom ou la position du champ comme index.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1040¶
Avertissement
Ce code de problème est maintenant obsolète.
Message : pyspark.sql.functions.explode a une solution de contournement. Voir la documentation pour plus d’informations
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.explode function, which has a workaround.
Scénario¶
Entrée
Below is an example of a use of the pyspark.sql.functions.explode function that generates this EWI. In this example, the explode function is used to generate one row per array item for the numbers column.
Sortie
The SMA adds the EWI SPRKPY1040 to the output code to let you know that this function is not directly supported by Snowpark, but it has a workaround.
Correction recommandée
As a workaround, you can import the snowpark_extensions package which provides an extension for the explode function.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1041¶
Avertissement
This issue code has been deprecated since Spark Conversion Core Version 2.9.0
Message : pyspark.sql.functions.explode_outer a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.functions.explode_outer which has a workaround.
Scénario¶
Entrée
L’exemple montre l’utilisation de la méthode explode_outer dans un appel sélectif.
Sortie
The tool adds the EWI SPRKPY1041 indicating that a workaround can be implemented.
Correction recommandée
As a workaround, you can import the snowpark_extensions package, which contains a helper for the explode_outer function.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1042¶
Message : pyspark.sql.functions.posexplode a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.functions.posexplode which has a workaround.
Scénarios¶
There are a couple of scenarios that this method can handle depending on the type of column it is passed as a parameter, it can be a list of values or a map/directory (keys/values).
Scénario 1¶
Entrée
Below is an example of the usage of posexplode passing as a parameter of a list of values.
Sortie
The tool adds the EWI SPRKPY1042 indicating that a workaround can be implemented.
Correction recommandée
For having the same behavior, use the method functions.flatten, drop extra columns, and rename index and value column names.
Scénario 2¶
Entrée
Below is another example of the usage of posexplode passing as a parameter a map/dictionary (keys/values)
Sortie
The tool adds the EWI SPRKPY1042 indicating that a workaround can be implemented.
Correction recommandée
As a workaround, you can use functions.row_number to get the position and functions.explode with the name of the field to get the value the key/value for dictionaries.
Remarque : l’utilisation de row_number n’est pas totalement équivalent, car il commence par 1 (et non par zéro comme dans la méthode Spark)
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1043¶
Message : pyspark.sql.functions.posexplode_outer a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.functions.posexplode_outer which has a workaround.
Scénarios¶
There are a couple of scenarios that this method can handle depending on the type of column it is passed as a parameter, it can be a list of values or a map/directory (keys/values).
Scénario 1¶
Entrée
Below is an example that shows the usage of posexplode_outer passing a list of values.
Sortie
The tool adds the EWI SPRKPY1043 indicating that a workaround can be implemented.
Correction recommandée
For having the same behavior, use the method functions.flatten sending the outer parameter in True, drop extra columns, and rename index and value column names.
Scénario 2¶
Entrée
Vous trouverez ci-dessous un autre exemple d’utilisation de posexplode_outer en transférant une carte/un dictionnaire (clés/valeurs)
Sortie
The tool adds the EWI SPRKPY1043 indicating that a workaround can be implemented.
Correction recommandée
As a workaround, you can use functions.row_number to get the position and functions.explode_outer with the name of the field to get the value of the key/value for dictionaries.
Remarque : l’utilisation de row_number n’est pas totalement équivalent, car il commence par 1 (et non par zéro comme dans la méthode Spark)
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1044¶
Avertissement
This issue code has been deprecated since Spark Conversion Core Version 2.4.0
Message : pyspark.sql.functions.split a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.functions.split which has a workaround.
Scénarios¶
Il existe plusieurs scénarios en fonction du nombre de paramètres transmis à la méthode.
Scénario 1¶
Entrée
Below is an example when the function split has just the str and pattern parameters
Sortie
The tool shows the EWI SPRKPY1044 indicating there is a workaround.
Correction recommandée
As a workaround, you can call the function snowflake.snowpark.functions.lit with the pattern parameter and send it into the split.
Scénario 2¶
Entrée
Below is another example when the function split has the str, pattern, and limit parameters.
Sortie
The tool shows the EWI SPRKPY1044 indicating there is a workaround.
Correction recommandée
Ce scénario spécifique n’est pas pris en charge.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1045¶
Message : pyspark.sql.functions.map_values a une solution de contournement
Catégorie : Avertissement
Description¶
Cette fonction est utilisée pour extraire la liste des valeurs d’une colonne qui contient une carte/un dictionnaire (clés/valeurs).
The issue appears when the tool detects the usage of pyspark.sql.functions.map_values which has a workaround.
Scénario¶
Entrée
Below is an example of the usage of the method map_values.
Sortie
The tool adds the EWI SPRKPY1045 indicating that a workaround can be implemented.
Correction recommandée
As a workaround, you can create an udf to get the values for a column. The below example shows how to create the udf, then assign it to F.map_values, and then make use of it.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1046¶
Avertissement
This issue code has been deprecated since Spark Conversion Core Version 2.1.22
Message : pyspark.sql.functions.monotonically_increasing_id a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.functions.monotonically_increasing_id which has a workaround.
Scénario¶
Entrée
Below is an example of the usage of the method monotonically_increasing_id.
Sortie
The tool adds the EWI SPRKPY1046 indicating that a workaround can be implemented.
Correction recommandée
Mettez à jour la version de l’outil.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1047¶
Avertissement
This issue code has been deprecated since Spark Conversion Core Version 4.6.0
Description¶
This issue appears when the tool detects the usage of pyspark.context.SparkContext.setLogLevel which has a workaround.
Scénario¶
Entrée
Below is an example of the usage of the method setLogLevel.
Sortie
The tool adds the EWI SPRKPY1047 indicating that a workaround can be implemented.
Correction recommandée
Replace the setLogLevel function usage with logging.basicConfig that provides a set of convenience functions for simple logging usage. In order to use it, we need to import two modules, « logging » and « sys », and the level constant should be replaced using the « Level equivalent table »:
Table d’équivalence des niveaux
Paramètre source du niveau |
Paramètre cibl du niveaue |
|---|---|
« ALL » |
<mark style= »color:red; »>**This has no equivalent**</mark> |
« DEBUG » |
logging.DEBUG |
« ERROR » |
logging.ERROR |
« FATAL » |
logging.CRITICAL |
« INFO » |
logging.INFO |
« OFF » |
logging.NOTSET |
« TRACE » |
<mark style= »color:red; »>**This has no equivalent**</mark> |
« WARN » |
logging.WARNING |
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1048¶
Avertissement
This issue code has been deprecated since Spark Conversion Core Version 2.4.0
Message : pyspark.sql.session.SparkSession.conf a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.session.SparkSession.conf which has a workaround.
Scénario¶
Entrée
Below is an example of how to set a configuration into the property conf .
Sortie
The tool adds the EWI SPRKPY1048 indicating that a workaround can be implemented.
Correction recommandée
SparkSession.conf est utilisé pour transférer certains paramètres spécifiques utilisés uniquement par Pyspark et ne s’applique pas à Snowpark. Vous pouvez supprimer ou commenter le code
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1049¶
Avertissement
This issue code has been deprecated since Spark Conversion Core Version 2.1.9
Message : pyspark.sql.session.SparkSession.sparkContext a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.session.SparkSession.sparkContext which has a workaround.
Scénario¶
Entrée
Below is an example that creates a spark session and then uses the SparkContext property to print the appName.
Sortie
The tool adds the EWI SPRKPY1049 indicating that a workaround can be implemented.
Correction recommandée
SparkContext n’est pas pris en charge par SnowPark, mais vous pouvez accéder aux méthodes et propriétés de SparkContext directement à partir de l’instance de session.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1050¶
Message : pyspark.conf.SparkConf.set a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.conf.SparkConf.set which has a workaround.
Scénario¶
Entrée
Below is an example that sets a variable using conf.set.
Sortie
The tool adds the EWI SPRKPY1050 indicating that a workaround can be implemented.
Correction recommandée
SparkConf.set est utilisé pour définir un paramètre de configuration utilisé uniquement par Pyspark et ne s’applique pas à Snowpark. Vous pouvez supprimer ou commenter le code
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1051¶
Avertissement
This issue code has been deprecated since Spark Conversion Core Version 2.4.0
Message : pyspark.sql.session.SparkSession.Builder.master a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects pyspark.sql.session.SparkSession.Builder.master usage which has a workaround.
Scénario¶
Entrée
Below is an example of the usage of the method builder.master to set the Spark Master URL to connect to local using 1 core.
Sortie
The tool adds the EWI SPRKPY1051 indicating that a workaround can be implemented.
Correction recommandée
pyspark.sql.session.SparkSession.Builder.master is used to set up a Spark Cluster. Snowpark doesn’t use Spark Clusters so you can remove or comment the code.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1052¶
Avertissement
This issue code has been deprecated since Spark Conversion Core Version 2.8.0
Message : pyspark.sql.session.SparkSession.Builder.enableHiveSupport a une solution de contournement
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.session.SparkSession.Builder.enableHiveSupport which has a workaround.
Scénario¶
Entrée
Below is an example that configures the SparkSession and enables the hive support using the method enableHiveSupport.
Sortie
The tool adds the EWI SPRKPY1052 indicating that a workaround can be implemented.
Correction recommandée
Remove the use of enableHiveSupport function because it is not needed in Snowpark.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1053¶
Message : Une erreur s’est produite lors de l’extraction des fichiers dbc.
Catégorie : Avertissement
Description¶
Ce problème apparaît lorsqu’un fichier dbc ne peut pas être extrait. Cet avertissement peut être dû à une ou plusieurs des raisons suivantes : Trop lourd, inaccessible, en lecture seule, etc.
Recommandations supplémentaires¶
En guise de solution de contournement, vous pouvez vérifier la taille du fichier s’il est trop lourd pour être traité. Analysez également si l’outil peut y accéder afin d’éviter tout problème d’accès.
Pour plus d’assistance, vous pouvez nous envoyer un e-mail à l’adresse suivante : snowconvert-info@snowflake.com. Si vous avez un contrat de support avec Snowflake, contactez votre ingénieur commercial, qui pourra répondre à vos besoins en matière d’assistance.
SPRKPY1080¶
Message : La valeur de SparkContext est remplacée par la variable “session”.
Catégorie : Avertissement
Description¶
Le contexte de Spark est stocké dans une variable appelée session qui crée une session Snowpark.
Scénario¶
Entrée
Cet extrait décrit un SparkContext.
Sortie
Dans ce code de sortie, SMA a remplacé PySpark.SparkContext par SparkSession. Notez que l’outil SMA ajoute également un modèle pour remplacer la connexion dans le fichier « connection.json » et charge ensuite cette configuration dans la variable connection_parameter.
Correction recommandée
Le fichier de configuration « connection.json » doit être mis à jour avec les informations de connexion requises :
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1054¶
Messag : pyspark.sql.readwriter.DataFrameReader.format n’est pas pris en charge.
Catégorie : Avertissement
Description¶
This issue appears when the pyspark.sql.readwriter.DataFrameReader.format has an argument that is not supported by Snowpark.
Scénarios¶
There are some scenarios depending on the type of format you are trying to load. It can be a supported , or non-supported format.
Scénario 1¶
Entrée
L’outil analyse le type de format que vous essayez de charger. Les formats pris en charge sont les suivants :
Csv
JSON
Parquet
Orc
The below example shows how the tool transforms the format method when passing a Csv value.
Sortie
The tool transforms the format method into a Csv method call.
Correction recommandée
Dans ce cas, l’outil n’affiche pas l’EWI, ce qui signifie qu’aucune correction n’est nécessaire.
Scénario 2¶
Entrée
The below example shows how the tool transforms the format method when passing a Jdbc value.
Sortie
The tool shows the EWI SPRKPY1054 indicating that the value « jdbc » is not supported.
Correction recommandée
For the not supported scenarios, there is no specific fix since it depends on the files that are trying to be read.
Scénario 3¶
Entrée
The below example shows how the tool transforms the format method when passing a CSV, but using a variable instead.
Sortie
Since the tool can not determine the value of the variable in runtime, shows the EWI SPRKPY1054 indicating that the value « » is not supported.
Correction recommandée
As a workaround, you can check the value of the variable and add it as a string to the format call.
Recommandations supplémentaires¶
The Snowpark location only accepts cloud locations using a snowflake stage.
The documentation of methods supported by Snowpark can be found in the documentation
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1055¶
Message : La valeur de clé pyspark.sql.readwriter.DataFrameReader.option n’est pas prise en charge.
Catégorie : Avertissement
Description¶
This issue appears when the pyspark.sql.readwriter.DataFrameReader.option key value is not supported by SnowFlake.
L’outil analyse les paramètres de l’appel de l’option et, en fonction de la méthode (CSV ou JSON ou PARQUET), la valeur clé peut avoir ou non un équivalent dans Snowpark. Si tous les paramètres ont un équivalent, l’outil n’ajoute pas l’EWI et remplace la valeur clé par son équivalent. Dans le cas contraire, l’outil ajoute l’EWI.
Liste des équivalences :
Équivalences pour CSV :
Clés d’option Spark |
Equivalences Snowpark |
|---|---|
sep |
FIELD_DELIMITER |
header |
PARSE_HEADER |
ligneSep |
RECORD_DELIMITER |
pathGlobFilter |
PATTERN |
quote |
FIELD_OPTIONALLY_ENCLOSED_BY |
nullValue |
NULL_IF |
dateFormat |
DATE_FORMAT |
timestampFormat |
TIMESTAMP_FORMAT |
inferSchema |
INFER_SCHEMA |
delimiter |
FIELD_DELIMITER |
Équivalences pour JSON :
Clés d’option Spark |
Equivalences Snowpark |
|---|---|
dateFormat |
DATE_FORMAT |
timestampFormat |
TIMESTAMP_FORMAT |
pathGlobFilter |
PATTERN |
Équivalences pour PARQUET :
Clés d’option Spark |
Equivalences Snowpark |
|---|---|
pathGlobFilter |
PATTERN |
Toute autre option clé qui ne figure pas dans l’une des tables ci-dessus, n’est pas prise en charge ou n’a pas d’équivalent dans Snowpark. Si c’est le cas, l’outil ajoute l’EWI avec les informations sur les paramètres et le retire de la chaîne.
Scénarios¶
Les scénarios suivants s’appliquent à CSV, JSON et PARQUET.
There are a couple of scenarios depending on the value of the key used in the option method.
Scénario 1¶
Entrée
Below is an example of a option call using a equivalent key.
Sortie
L’outil transforme la clé avec l’équivalent correct.
Correction recommandée
Étant donné que l’outil transforme la valeur de la clé, aucune correction n’est nécessaire.
Scénario 2¶
Entrée
Below is an example of a option call using a non-equivalent key.
Sortie
The tool adds the EWI SPRKPY1055 indicating the key is not supported and removes the option call.
Correction recommandée
Il est recommandé de vérifier le comportement après la transformation.
Recommandations supplémentaires¶
En présence de paramètres non équivalents, il est recommandé de vérifier le comportement après la transformation.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1056¶
Avertissement
Ce code de problème est maintenant obsolète.
Message : pyspark.sql.readwriter.DataFrameReader.option argument _ <argument_name> _ n’est pas un littéral et ne peut pas être évalué
Catégorie : Avertissement
Description¶
This issue appears when the argument’s key or value of the pyspark.sql.readwriter.DataFrameReader.option function is not a literal value (for example a variable). The SMA does a static analysis of your source code, and therefore it is not possible to evaluate the content of the argument.
Scénario¶
Entrée
Below is an example of a use of the pyspark.sql.readwriter.DataFrameReader.option function that generates this EWI.
Sortie
The SMA adds the EWI SPRKPY1056 to the output code to let you know that the argument of this function is not a literal value, and therefore it could not be evaluated by the SMA.
Correction recommandée
Even though the SMA was unable to evaluate the argument, it does not mean that it is not supported by Snowpark. Please make sure that the value of the argument is valid and equivalent in Snowpark by checking the documentation.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1057¶
Avertissement
This Issue Code has been deprecated since Spark Conversion Core Version 4.8.0
Message: PySpark Dataframe Option argument contains a value that is not a literal, therefore cannot be evaluated
Catégorie : Avertissement
Description¶
Ce code de problème est obsolète. Si vous utilisez une version plus ancienne, veuillez la mettre à jour.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1058¶
Message : La clé spécifique à la plateforme < méthode > avec < clé > n’est pas prise en charge.
Catégorie : ConversionError
Description¶
The get and set methods from pyspark.sql.conf.RuntimeConfig are not supported with a Platform specific key.
Scénarios¶
Not all usages of get or set methods are going to have an EWI in the output code. This EWI appears when the tool detects the usage of these methods with a Platform specific key which is not supported.
Scénario 1¶
Entrée
Below is an example of the get or set methods with supported keys in Snowpark.
Sortie
Étant donné que les clés sont prises en charge dans Snowpark, l’outil n’ajoute pas l’EWI au code de sortie.
Correction recommandée
Il n’y a pas de correction recommandée pour ce scénario.
Scénario 2¶
Entrée
Vous trouverez ci-dessous un exemple d’utilisation des clés non prises en charge.
Sortie
The tool adds this EWI SPRKPY1058 on the output code to let you know that these methods are not supported with a Platform specific key.
Correction recommandée
La correction recommandée consiste à supprimer ces méthodes.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1059¶
Avertissement
This issue code has been deprecated since Spark Conversion Core Version 2.45.1
Message: pyspark.storagelevel.StorageLevel has a workaround, see documentation.
Catégorie : Avertissement
Description¶
Currently, the use of StorageLevel is not required in Snowpark since Snowflake controls the storage. For more information, you can refer to the EWI SPRKPY1072
Recommandations supplémentaires¶
Mettez votre application à jour vers la dernière version.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1060¶
Message : Le mécanisme d’authentification est connection.json (modèle fourni).
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.conf.SparkConf.
Scénario¶
Entrée
Comme le mécanisme d’authentification est différent dans Snowpark, l’outil supprime les utilisations et crée un fichier de configuration des connexions (connection.json) à la place.
Sortie
The tool adds the EWI SPRKPY1060 indicating that the authentication mechanism is different.
Correction recommandée
To create a connection it is necessary that you fill in the information in the connection.json file.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1061¶
Message : Snowpark ne prend en charge les fonctions unix_timestamp
Catégorie : Avertissement
Description¶
In Snowpark, the first parameter is mandatory; the issue appears when the tool detects the usage of pyspark.sql.functions.unix_timestamp with no parameters.
Scénario¶
Entrée
Below an example that calls the unix_timestamp method without parameters.
Sortie
The Snowpark signature for this function unix_timestamp(e: ColumnOrName, fmt: Optional["Column"] = None), as you can notice the first parameter it’s required.
The tool adds this EWI SPRKPY1061 to let you know that function unix_timestamp with no parameters it’s not supported in Snowpark.
Correction recommandée
En guise de solution de contournement, vous pouvez ajouter au moins le nom ou la colonne de la chaîne d’horodatage.
Recommandations supplémentaires¶
You also can add the current_timestamp() as the first parameter.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1062¶
Message : Snowpark ne prend pas charge GroupedData.pivot sans le paramètre « values ».
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects the usage of the pyspark.sql.group.GroupedData.pivot function without the « values » parameter (the list of values to pivot on).
Pour l’instant, la fonction pivot de Snowpark Python vous oblige à spécifier explicitement la liste des valeurs distinctes sur lesquelles pivoter.
Scénarios¶
Scénario 1¶
Entrée
The SMA detects an expression that matches the pattern dataFrame.groupBy("columnX").pivot("columnY") and the pivot does not have the values parameter.
Sortie
L’outil SMA ajoute un message EWI indiquant que la fonction pivot sans le paramètre « values » n’est pas prise en charge.
En outre, il ajoutera comme deuxième paramètre de la fonction pivot une compréhension de liste qui calcule la liste des valeurs qui seront traduites en colonnes. Gardez à l’esprit que cette opération n’est pas efficace pour les grands ensembles de données, et qu’il est conseillé d’indiquer les valeurs de manière explicite.
Correction recommandée
Pour ce scénario, l’outil SMA ajoute comme deuxième paramètre de la fonction pivot une compréhension de liste qui calcule la liste des valeurs qui seront traduites en colonnes, mais vous pouvez également utiliser une liste de valeurs distinctes sur lesquelles pivoter, comme suit :
Scénario 2¶
Entrée
The SMA couldn’t detect an expression that matches the pattern dataFrame.groupBy("columnX").pivot("columnY") and the pivot does not have the values parameter.
Sortie
L’outil SMA ajoute un message EWI indiquant que la fonction pivot sans le paramètre « values » n’est pas prise en charge.
Correction recommandée
Ajoutez une liste de valeurs distinctes sur lesquelles pivoter, comme suit :
Recommandations supplémentaires¶
Le calcul de la liste des valeurs distinctes sur lesquelles pivoter n’est pas une opération efficace sur les grands ensembles de données et pourrait se transformer en appel bloquant. Veuillez envisager d’indiquer explicitement la liste des valeurs distinctes sur lesquelles pivoter.
Si vous ne souhaitez pas spécifier explicitement la liste des valeurs distinctes sur lesquelles pivoter (ce qui n’est pas conseillé), vous pouvez ajouter le code suivant comme deuxième argument de la fonction pivot pour déduire les valeurs au moment de l’exécution*
****Replace*** :code:`<df>` with the corresponding DataFrame, with the column to pivot and with the number of rows to select.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1063¶
Message : pyspark.sql.pandas.functions.pandas_udf a une solution de contournement.
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.pandas.functions.pandas_udf which has a workaround.
Scénario¶
Entrée
La fonction pandas_udf est utilisée pour créer une fonction définie par l’utilisateur qui travaille avec de grandes quantités de données.
Sortie
L’outil SMA ajoute un message EWI indiquant que la fonction pandas_udf a une solution de contournement.
Correction recommandée
Specify explicitly the parameters types as a new parameter input_types, and remove functionType parameter if applies. Created function must be called inside a select statement.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1064¶
Message: The *Spark element* does not apply since snowflake uses snowpipe mechanism instead.
Catégorie : Avertissement
Description¶
Ce problème apparaît lorsque l’outil détecte l’utilisation d’un élément de la bibliothèque pyspark.streaming :
pyspark.streaming.listener.StreamingListener.
Scénario¶
Entrée
Vous trouverez ci-dessous un exemple avec l’un des éléments qui déclenchent cet EWI.
Sortie
The SMA adds the EWI SPRKPY1064 on the output code to let you know that this function does not apply.
Correction recommandée
The SMA removes the import statement and adds the issue to the Issues.csv inventory, remove any usages of the Spark element.
Recommandations supplémentaires¶
Check the documentation for Snowpipe to see how it fits to the current scenario.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1065¶
Message : pyspark.context.SparkContext.broadcast ne s’applique pas car Snowflake utilise un mécanisme de clustering des données pour calculer les données.
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of element pyspark.context.SparkContext.broadcast, which is not necessary due to the use of data-clustering of Snowflake.
Code d’entrée
Dans cet exemple, une variable de diffusion est créée. Ces variables permettent de partager les données plus efficacement entre tous les nœuds.
Code de sortie
L’outil SMA ajoute un message EWI indiquant que la diffusion n’est pas nécessaire.
Correction recommandée
Supprimez toute utilisation de pyspark.context.SparkContext.broadcast.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1066¶
Message : L’élément Spark ne s’applique pas car Snowflake utilise le mécanisme de micro-partitionnement qui est créé automatiquement.
Catégorie : Avertissement
Description¶
Ce problème apparaît lorsque l’outil détecte l’utilisation d’éléments liés aux partitions :
Those elements do not apply due the use of micro-partitions of Snowflake.
Code d’entrée
In this example sortWithinPartitions it’s used to create a partition in a DataFrame sorted by the specified column.
Code de sortie
L’outil SMA ajoute un EWI indiquant que l’élément Spark n’est pas requis.
Correction recommandée
Supprimez l’utilisation de l’élément.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1067¶
Message : La fonction pyspark.sql.functions.split a des paramètres qui ne sont pas pris en charge dans Snowpark.
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.functions.split with more than two parameters or a regex pattern as a parameter; both cases are not supported.
Scénarios¶
Scénario 1¶
Code d’entrée
Dans cet exemple, la fonction de fractionnement a plus de deux paramètres.
Code de sortie
L’outil ajoute cet EWI au code de sortie pour vous indiquer que cette fonction n’est pas prise en charge lorsqu’elle comporte plus de deux paramètres.
Correction recommandée
Conservez la fonction de fractionnement avec seulement deux paramètres.
Scénario 2¶
Code d’entrée
Dans cet exemple, la fonction de fractionnement a pour paramètre un modèle regex.
Code de sortie
L’outil ajoute cet EWI au code de sortie pour vous indiquer que cette fonction n’est pas prise en charge lorsqu’elle comporte un modèle regex comme paramètre.
Correction recommandée
The spark signature for this method functions.split(str: ColumnOrName, pattern: str, limit: int = - 1) not exactly match with the method in Snowpark functions.split(str: Union[Column, str], pattern: Union[Column, str]) so for now the scenario using regular expression does not have a recommended fix.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1068¶
Message : toPandas contient des colonnes de type ArrayType qui n’est pas pris en charge et qui dispose d’une solution de contournement.
Catégorie : Avertissement
Description¶
pyspark.sql.DataFrame.toPandas doesn’t work properly If there are columns of type ArrayType. The workaround for these cases is converting those columns into a Python Dictionary by using json.loads method.
Scénario¶
Entrée
ToPandas renvoie les données du DataFrame d’origine sous la forme d’un DataFrame Pandas.
Sortie
L’outil ajoute cet EWI pour vous indiquer que toPandas n’est pas pris en charge en cas de colonnes de type ArrayType, mais qu’il existe une solution de contournement.
Correction recommandée
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1069¶
Message : Si le paramètre partitionBy est une liste, Snowpark générera une erreur.
Catégorie : Avertissement
Description¶
When there is a usage of pyspark.sql.readwriter.DataFrameWriter.parquet method where it comes to the parameter partitionBy, the tool shows the EWI.
This is because in Snowpark the DataFrameWriter.parquet only supports a ColumnOrSqlExpr as a partitionBy parameter.
Scénarios¶
Scénario 1¶
Code d’entrée :
Dans ce scénario, le paramètre partitionBy n’est pas une liste.
Code de sortie :
The tool adds the EWI SPRKPY1069 to let you know that Snowpark throws an error if parameter is a list.
Correction recommandée
There is not a recommended fix for this scenario because the tool always adds this EWI just in case the partitionBy parameter is a list. Remember that in Snowpark, only accepts cloud locations using a snowflake stage.
Scénario 2¶
Code d’entrée :
Pour ce scénario, le paramètre partitionBy est une liste.
Code de sortie :
The tool adds the EWI SPRKPY1069 to let you know that Snowpark throws an error if parameter is a list.
Correction recommandée
If the value of the parameter is a list, then replace it with a ColumnOrSqlExpr.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1070¶
Message: The mode argument is transformed to overwrite, check the variable value and set the corresponding bool value.
Catégorie : Avertissement
Description¶
En cas d’utilisation de :
The tool analyzes the parameter mode to determinate if the value is overwrite.
Scénarios¶
Scénario 1¶
Code d’entrée
Pour ce scénario, l’outil détecte que le paramètre mode peut définir la valeur booléenne correspondante.
Code de sortie :
The SMA tool analyzes the mode parameter, determinate that the value is overwrite and set the corresponding bool value
Correction recommandée
Il n’y a pas de correction recommandée pour ce scénario car l’outil a effectué la transformation correspondante.
Scénario 2 :
Code d’entrée
In this scenario the tool can not validate the value is overwrite.
Code de sortie :
L’outil SMA ajoute un message EWI indiquant que le paramètre mode a été transformé en « overwrite », mais également pour vous indiquer qu’il est préférable de vérifier la valeur de la variable et de définir la valeur boolénne correcte.
Correction recommandée
Check for the value of the parameter mode and add the correct value for the parameter overwrite.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1071¶
Message : La fonction pyspark.rdd.RDD.getNumPartitions n’est pas requise dans Snowpark. Vous devez donc supprimer toutes les références.
Catégorie : Avertissement
Description¶
This issue appears when the tool finds the use of the pyspark.rdd.RDD.getNumPartitions function. Snowflake uses micro-partitioning mechanism, so the use of this function is not required.
Scénario¶
Entrée
getNumPartitions renvoie la quantité de partitions sur un RDD.
Sortie
L’outil ajoute cet EWI pour vous indiquer que getNumPartitions n’est pas requis.
Correction recommandée
Supprimez toutes les utilisations de cette fonction.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1072¶
Message : L’utilisation de StorageLevel n’est pas requise dans Snowpark.
Catégorie : Avertissement
Description¶
This issue appears when the tool finds the use of the StorageLevel class, which works like « flags » to set the storage level. Since Snowflake controls the storage, the use of this function is not required.
Recommandations supplémentaires¶
Supprimez toutes les utilisations de cette fonction.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1073¶
Message : pyspark.sql.functions.udf sans paramètre ou paramètre de type retour n’est pas pris en charge.
Catégorie : Avertissement
Description¶
This issue appears when the tool detects the usage of pyspark.sql.functions.udf as function or decorator and is not supported in two specifics cases, when it has no parameters or return type parameter.
Scénarios¶
Scénario 1¶
Entrée
Dans Pyspark, vous pouvez créer une fonction définie par l’utilisateur sans paramètres de type d’entrée ou de retour :
Sortie
Snowpark exige les types d’entrée et de retour pour la fonction Udf. En effet, ils ne sont pas fournis et SMA ne peut pas définir ces paramètres.
Correction recommandée
To fix this scenario is required to add the import for the returns types of the input and output, and then the parameters of return*type and input_types[] on the udf function _my_udf*.
Scénario 2¶
Dans PySpark, vous pouvez utiliser un décorateur @udf sans paramètres.
Entrée
Sortie
In Snowpark all the parameters of a udf decorator are required.
Correction recommandée
To fix this scenario is required to add the import for the returns types of the input and output, and then the parameters of return_type and input_types[] on the udf @udf decorator.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1074¶
Message : Le fichier a une indentation mixte (espaces et tabulations).
Catégorie : Erreur d’analyse.
Description¶
Ce problème apparaît lorsque l’outil détecte que le fichier a une indentation mixte. Cela signifie que le fichier comporte une combinaison d’espaces et de tabulations pour indenter les lignes de code.
Scénario¶
Entrée
Dans Pyspark, vous pouvez mélanger les espaces et les tabulations pour le niveau d’indentation.
Sortie
SMA ne peut pas gérer les marqueurs d’indentation mixtes. Lorsque cela est détecté sur un fichier de code Python, l’outil SMA ajoute l’EWI SPRKPY1074 sur la première ligne.
Correction recommandée
La solution est de rendre tous les symboles d’indentation identiques.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1075¶
Catégorie
Avertissement.
Description¶
La fonction parse_json n’applique pas de validation de schéma. Si vous avez besoin de filtrer/valider sur la base du schéma, vous devrez peut-être introduire une certaine logique.
Exemple¶
Entrée
Sortie
Pour la fonction from_json, le schéma n’est pas vraiment transmis pour l’inférence, il est utilisé pour la validation. Voir ces exemples :
Exemple 1 : Appliquer les types de données et modifier les noms des colonnes :
Exemple 2 : Sélectionner des colonnes spécifiques :
Recommandations¶
For more support, you can email us at sma-support@snowflake.com. If you have a contract for support with Snowflake, reach out to your sales engineer and they can direct your support needs.
SPRKPY1076¶
Message: Parameters in pyspark.sql.readwriter.DataFrameReader methods are not supported. This applies to CSV, JSON and PARQUET methods.
Catégorie : Avertissement
Description¶
For the CSV, JSON and PARQUET methods on the pyspark.sql.readwriter.DataFrameReader object, the tool will analyze the parameters and add a transformation according to each case:
Tous les paramètres correspondent à leur nom équivalent dans Snowpark : dans ce cas, l’outil transformera le paramètre en un appel .option(). Dans ce cas, le paramètre n’ajoutera pas cet EWI.
Certains paramètres ne correspondent pas à l’équivalent dans Snowpark : dans ce cas, l’outil ajoutera cet EWI avec les informations sur le paramètre et le supprimera de l’appel de la méthode.
Liste des équivalences :
Équivalences pour CSV :
Clés Spark |
Equivalences Snowpark |
|---|---|
sep |
FIELD_DELIMITER |
header |
PARSE_HEADER |
ligneSep |
RECORD_DELIMITER |
pathGlobFilter |
PATTERN |
quote |
FIELD_OPTIONALLY_ENCLOSED_BY |
nullValue |
NULL_IF |
dateFormat |
DATE_FORMAT |
timestampFormat |
TIMESTAMP_FORMAT |
inferSchema |
INFER_SCHEMA |
delimiter |
FIELD_DELIMITER |
Équivalences pour JSON :
Clés Spark |
Equivalences Snowpark |
|---|---|
dateFormat |
DATE_FORMAT |
timestampFormat |
TIMESTAMP_FORMAT |
pathGlobFilter |
PATTERN |
Équivalences pour PARQUET :
Clés Spark |
Equivalences Snowpark |
|---|---|
pathGlobFilter |
PATTERN |
Scénarios¶
Scénario 1¶
Entrée
Pour CVS, voici quelques exemples :
Sortie
Dans le code converti, les paramètres sont ajoutés en tant qu’options individuelles à la fonction cvs
Scénario 2¶
Entrée
Pour JSON, voici quelques exemples :
Sortie
Dans le code converti, les paramètres sont ajoutés en tant qu’options individuelles à la fonction json
Scénario 3¶
Entrée
Pour PARQUET, voici quelques exemples :
Sortie
Dans le code converti, les paramètres sont ajoutés en tant qu’options individuelles à la fonction Parquet
Recommandations supplémentaires¶
En présence de paramètres non équivalents, il est recommandé de vérifier le comportement après la transformation.
La documentation pourrait également être utile pour trouver une meilleure solution :
Options documentation for CSV: - PySpark CSV Options. - Snowpark CSV Options.
Options documentation for JSON: - PySpark JSON Options. - Snowpark JSON Options.
Options documentation for PARQUET: - Pyspark PARQUET options. - SnowPark PARQUET options..
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1077¶
Message : Le code intégré SQL ne peut pas être traité.
Catégorie : Avertissement
Description¶
Ce problème apparaît lorsque l’outil détecte un code intégré SQL qui ne peut pas être converti en Snowpark.
Pour plus d’informations, consultez la section Code intégré SQL.
Scénario¶
Entrée
Dans cet exemple, le code SQL est intégré à une variable appelée requête qui est utilisée comme paramètre de la méthode Pyspark.sql.
Sortie
SMA détecte que le paramètre PySpark.sql est une variable et non un code SQL, de sorte que le message EWI SPRKPY1077 est ajouté à la ligne PySpark.sql.
Recommandations supplémentaires¶
Pour la transformation de SQL, ce code doit être directement intégré en tant que paramètre de la méthode, uniquement sous forme de valeurs de chaîne et sans interpolation. Veuillez vérifier l’envoi de SQL à la fonction PySpark.SQL pour valider sa fonctionnalité sur Snowflake.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1078¶
Message : L’argument de la fonction pyspark.context.SparkContext.setLogLevel n’est pas une valeur littérale et n’a donc pas pu être évalué.
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects the use of the pyspark.context.SparkContext.setLogLevel function with an argument that is not a literal value, for example, when the argument is a variable.
L’outil SMA effectue une analyse statique de votre code source et il n’est donc pas possible d’évaluer le contenu de cet argument et de déterminer un équivalent dans Snowpark.
Scénario¶
Entrée
Dans cet exemple, le niveau de journalisation est défini dans la variable my_log_level, puis my_log_level est utilisé comme paramètre par la méthode setLogLevel.
Sortie
SMA n’est pas en mesure d’évaluer l’argument du paramètre du niveau de journalisation, de sorte que l’EWI SPRKPY1078 est ajouté par-dessus la ligne de la journalisation transformée :
Correction recommandée
Even though the SMA was unable to evaluate the argument, it will transform the pyspark.context.SparkContext.setLogLevel function into the Snowpark equivalent. Please make sure the value of the level argument in the generated output code is a valid and equivalent log level in Snowpark according to the table below:
Niveau de journalisation PySpark |
Équivalent Snowpark du niveau de journalisation |
|---|---|
ALL |
logging.NOTSET |
DEBUG |
logging.DEBUG |
ERROR |
logging.ERROR |
FATAL |
logging.CRITICAL |
INFO |
logging.INFO |
OFF |
logging.WARNING |
TRACE |
logging.NOTSET |
WARN |
logging.WARNING |
La correction recommandée se présente donc comme suit :
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1079¶
Message : L’argument de la fonction pyspark.context.SparkContext.setLogLevel n’est pas un niveau de journalisation PySpark valide.
Catégorie : Avertissement
Description¶
This issue appears when the SMA detects the use of the pyspark.context.SparkContext.setLogLevel function with an argument that is not a valid log level in PySpark, and therefore an equivalent could not be determined in Snowpark.
Scénario¶
Entrée
Ici le niveau de journalisation utilise « INVALID_LOG_LEVEL » qui n’est pas un niveau de journalisation Pyspark valide.
Sortie
SMA ne peut pas reconnaître le niveau de journalisation « INVALID_LOG_LEVEL ». Même si SMA effectue la conversion, l’EWI SPRKPY1079 est ajouté pour indiquer un éventuel problème.
Correction recommandée
Make sure that the log level used in the pyspark.context.SparkContext.setLogLevel function is a valid log level in PySpark or in Snowpark and try again.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1081¶
This issue code has been deprecated since Spark Conversion Core 4.12.0
Message : pyspark.sql.readwriter.DataFrameWriter.partitionBy a une solution de contournement.
Catégorie : Avertissement
Description¶
The Pyspark.sql.readwriter.DataFrameWriter.partitionBy function is not supported. The workaround is to use Snowpark’s copy_into_location instead. See the documentation for more info.
Scénario¶
Entrée
This code will create a separate directories for each unique value in the FIRST_NAME column. The data is the same, but it’s going to be stored in different directories based on the column.
This code will create a separate directories for each unique value in the FIRST_NAME column. The data is the same, but it’s going to be stored in different directories based on the column.
Code de sortie
Correction recommandée
In Snowpark, copy_into_location has a partition_by parameter that you can use instead of the partitionBy function, but it’s going to require some manual adjustments, as shown in the following example:
Code Spark :
Code Snowpark ajusté manuellement :
copy_into_location a les paramètres suivants.
location: The Snowpark location only accepts cloud locations using an snowflake stage.
partition_by : Il peut s’agir d’un nom de colonne ou d’une expression SQL. Vous devez donc effectuer une conversion en colonne ou en expression SQL en utilisant col ou sql_expr.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1082¶
Message : La fonction pyspark.sql.readwriter.DataFrameReader.load n’est pas prise en charge. La solution consiste à utiliser la méthode Snowpark DataFrameReader.format à la place (avro csv, json, orc, parquet). Le paramètre path doit être un emplacement de zone de préparation.
Catégorie : Avertissement
Description¶
The pyspark.sql.readwriter.DataFrameReader.load function is not supported. The workaround is to use Snowpark DataFrameReader methods instead.
Scénarios¶
The spark signature for this method DataFrameReader.load(path, format, schema, **options) does not exist in Snowpark. Therefore, any usage of the load function is going to have an EWI in the output code.
Scénario 1¶
Entrée
Below is an example that tries to load data from a CSV source.
Sortie
The SMA adds the EWI SPRKPY1082 to let you know that this function is not supported by Snowpark, but it has a workaround.
Correction recommandée
As a workaround, you can use Snowpark DataFrameReader methods instead.
Fixing
pathandformatparameters:Replace the
loadmethod withcsvmethod.The first parameter
pathmust be in a stage to make an equivalence with Snowpark.
Below is an example that creates a temporal stage and puts the file into it, then calls the CSV method.
Fixing
schemaparameter:The schema can be set by using the schema function as follows:
Fixing
optionsparameter:
The options between spark and snowpark are not the same, in this case lineSep and dateFormat are replaced with RECORD_DELIMITER and DATE_FORMAT, the Additional recommendations section has a table with all the Equivalences.
Below is an example that creates a dictionary with RECORD_DELIMITER and DATE_FORMAT, and calls the options method with that dictionary.
Scénario 2¶
Entrée
Below is an example that tries to load data from a JSON source.
Sortie
The SMA adds the EWI SPRKPY1082 to let you know that this function is not supported by Snowpark, but it has a workaround.
Correction recommandée
As a workaround, you can use Snowpark DataFrameReader methods instead.
Fixing
pathandformatparameters:Replace the
loadmethod withjsonmethodThe first parameter
pathmust be in a stage to make an equivalence with Snowpark.
Below is an example that creates a temporal stage and puts the file into it, then calls the JSON method.
Fixing
schemaparameter:The schema can be set by using the schema function as follows:
Fixing
optionsparameter:
The options between Spark and snowpark are not the same, in this case dateFormat and timestampFormat are replaced with DATE_FORMAT and TIMESTAMP_FORMAT, the Additional recommendations section has a table with all the Equivalences.
Below is an example that creates a dictionary with DATE_FORMAT and TIMESTAMP_FORMAT, and calls the options method with that dictionary.
Scénario 3¶
Entrée
Below is an example that tries to load data from a PARQUET source.
Sortie
The SMA adds the EWI SPRKPY1082 to let you know that this function is not supported by Snowpark, but it has a workaround.
Correction recommandée
As a workaround, you can use Snowpark DataFrameReader methods instead.
Fixing
pathandformatparameters:Replace the
loadmethod withparquetmethodThe first parameter
pathmust be in a stage to make an equivalence with Snowpark.
Below is an example that creates a temporal stage and puts the file into it, then calls the PARQUET method.
Fixing
schemaparameter:The schema can be set by using the schema function as follows:
Fixing
optionsparameter:
The options between Spark and snowpark are not the same, in this case pathGlobFilter is replaced with PATTERN, the Additional recommendations section has a table with all the Equivalences.
Below is an example that creates a dictionary with PATTERN, and calls the options method with that dictionary.
Recommandations supplémentaires¶
Tenez compte du fait que les options entre Spark et Snowpark ne sont pas les mêmes, mais qu’elles peuvent être mappées :
Options Spark |
Valeur possible |
Équivalent Snowpark |
Description |
|---|---|---|---|
header |
Vrai ou faux |
SKIP_HEADER = 1 / SKIP_HEADER = 0 |
Pour utiliser la première ligne d’un fichier comme nom de colonne. |
delimiter |
Tout séparateur de champ à un ou plusieurs caractères |
FIELD_DELIMITER |
Pour spécifier un ou plusieurs caractères comme séparateur pour chaque colonne/champ. |
sep |
Tout séparateur de champ à un caractère |
FIELD_DELIMITER |
Pour spécifier un seul caractère comme séparateur pour chaque colonne/champ. |
encoding |
UTF-8, UTF-16, etc… |
ENCODING |
Pour décoder les fichiers CSV selon le type d’encodage donné. L’encodage par défaut est UTF-8 |
ligneSep |
Tout séparateur de lignes à un caractère |
RECORD_DELIMITER |
Pour définir le séparateur de lignes à utiliser pour l’analyse du fichier. |
pathGlobFilter |
Modèle de fichier |
PATTERN |
Pour définir un modèle permettant de lire uniquement les fichiers dont les noms correspondent au modèle. |
recursiveFileLookup |
Vrai ou faux |
N/A |
Pour analyser de manière récursive un répertoire afin d’y lire des fichiers. La valeur par défaut de cette option est False. |
quote |
Caractère unique à mettre entre guillemets |
FIELD_OPTIONALLY_ENCLOSED_BY |
Permet de mettre entre guillemets les champs/colonnes contenant des champs où le délimiteur/séparateur peut faire partie de la valeur. Ce caractère permet de mettre entre guillemets tous les champs lorsqu’il est utilisé avec l’option quoteAll. La valeur par défaut de cette option est guillemet double (« ). |
nullValue |
Chaîne pour remplacer la valeur nulle |
NULL_IF |
Permet de remplacer les valeurs nulles par la chaîne lors de la lecture et de l’écriture du dataframe. |
dateFormat |
Format de date valide |
DATE_FORMAT |
Permet de définir une chaîne indiquant un format de date. Le format par défaut est yyyy-MM-dd. |
timestampFormat |
Format d’horodatage valide |
TIMESTAMP_FORMAT |
Permet de définir une chaîne indiquant un format d’horodatage. Le format par défaut est yyyy-MM-dd “T’HH: mm:ss. |
escape |
Tout caractère unique |
ESCAPE |
Permet de définir un caractère unique comme caractère d’échappement afin de remplacer le caractère d’échappement par défaut (\). |
inferSchema |
Vrai ou faux |
INFER_SCHEMA |
Détecte automatiquement le schéma de fichier |
mergeSchema |
Vrai ou faux |
N/A |
Pas nécessaire dans Snowflake, car cela se produit chaque fois que infer_schema détermine la structure du fichier parquet |
For modifiedBefore / modifiedAfter option you can achieve the same result in Snowflake by using the metadata columns and then adding a filter like:
df.filter(METADATA_FILE_LAST_MODIFIED > ‘some_date’).For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1083¶
Message : La fonction pyspark.sql.readwriter.DataFrameWriter.save n’est pas prise en charge. La solution consiste à utiliser la méthode Snowpark DataFrameWriter copy_into_location à la place.
Catégorie : Avertissement
Description¶
The pyspark.sql.readwriter.DataFrameWriter.save function is not supported. The workaround is to use Snowpark DataFrameWriter methods instead.
Scénarios¶
The spark signature for this method DataFrameWriter.save(path, format, mode, partitionBy, **options) does not exists in Snowpark. Therefore, any usage of the load function it’s going to have an EWI in the output code.
Scénario 1¶
Code d’entrée
Below is an example that tries to save data with CSV format.
Code de sortie
The tool adds this EWI SPRKPY1083 on the output code to let you know that this function is not supported by Snowpark, but it has a workaround.
Correction recommandée
As a workaround you can use Snowpark DataFrameWriter methods instead.
Fixing
pathandformatparameters:Replace the
loadmethod with csv or copy_into_location method.If you are using
copy_into_locationmethod, you need to specify the format with thefile_format_type parameter.The first parameter
pathmust be in a stage to make an equivalence with Snowpark.
Vous trouverez ci-dessous un exemple qui crée une zone de préparation temporelle et y place le fichier, puis appelle l’une des méthodes mentionnées ci-dessus.
Fixing
modeparameter:Use the mode function from Snowpark DataFrameWriter, as follows:
Below is an example that adds into the daisy chain the mode method with overwrite as a parameter.
Fixing
partitionByparameter:Use the partition_by parameter from the
CSVmethod, as follows:
Below is an example that used the partition_by parameter from the CSV method.
Fixing
optionsparameter:Use the format_type_options parameter from the
CSVmethod, as follows:
The options between spark and snowpark are not the same, in this case lineSep and dateFormat are replaced with RECORD_DELIMITER and DATE_FORMAT, the Additional recommendations section has table with all the Equivalences.
Below is an example that creates a dictionary with RECORD_DELIMITER and DATE_FORMAT, and calls the options method with that dictionary.
Scénario 2¶
Code d’entrée
Below is an example that tries to save data with JSON format.
Code de sortie
The tool adds this EWI SPRKPY1083 on the output code to let you know that this function is not supported by Snowpark, but it has a workaround.
Correction recommandée
As a workaround you can use Snowpark DataFrameReader methods instead.
Fixing
pathandformatparameters:Replace the
loadmethod with json or copy_into_location methodIf you are using
copy_into_locationmethod, you need to specify the format with thefile_format_type parameter.The first parameter
pathmust be in a stage to make an equivalence with Snowpark.
Vous trouverez ci-dessous un exemple qui crée une zone de préparation temporelle et y place le fichier, puis appelle l’une des méthodes mentionnées ci-dessus.
Fixing
modeparameter:Use the mode function from Snowpark DataFrameWriter, as follows:
Below is an example that adds into the daisy chain the mode method with overwrite as a parameter.
Fixing
partitionByparameter:Use the partition_by parameter from the
CSVmethod, as follows:
Below is an example that used the partition_by parameter from the CSV method.
Fixing
optionsparameter:Use the format_type_options parameter from the
CSVmethod, as follows:
The options between spark and snowpark are not the same, in this case dateFormat and timestampFormat are replaced with DATE_FORMAT and TIMESTAMP_FORMAT, the Additional recommendations section has table with all the Equivalences.
Below is an example that creates a dictionary with DATE_FORMAT and TIMESTAMP_FORMAT, and calls the options method with that dictionary.
Scénario 3¶
Code d’entrée
Below is an example that tries to save data with PARQUET format.
Code de sortie
The tool adds this EWI SPRKPY1083 on the output code to let you know that this function is not supported by Snowpark, but it has a workaround.
Correction recommandée
As a workaround you can use Snowpark DataFrameReader methods instead.
Fixing
pathandformatparameters:Replace the
loadmethod with parquet or copy_into_location method.If you are using
copy_into_locationmethod, you need to specify the format with thefile_format_type parameter.The first parameter
pathmust be in a stage to make an equivalence with Snowpark.
Vous trouverez ci-dessous un exemple qui crée une zone de préparation temporelle et y place le fichier, puis appelle l’une des méthodes mentionnées ci-dessus.
Fixing
modeparameter:Use the mode function from Snowpark DataFrameWriter, as follows:
Below is an example that adds into the daisy chain the mode method with overwrite as a parameter.
Fixing
partitionByparameter:Use the partition_by parameter from the
CSVmethod, as follows:
Below is an example that used the partition_by parameter from the parquet method.
Fixing
optionsparameter:Use the format_type_options parameter from the
CSVmethod, as follows:
The options between spark and snowpark are not the same, in this case pathGlobFilter is replaced with PATTERN, the Additional recommendations section has table with all the Equivalences.
Below is an example that creates a dictionary with PATTERN, and calls the options method with that dictionary.
Recommandations supplémentaires¶
Tenez compte du fait que les options entre Spark et Snowpark ne sont pas les mêmes, mais qu’elles peuvent être mappées :
Options Spark |
Valeur possible |
Équivalent Snowpark |
Description |
|---|---|---|---|
header |
Vrai ou faux |
SKIP_HEADER = 1 / SKIP_HEADER = 0 |
Pour utiliser la première ligne d’un fichier comme nom de colonne. |
delimiter |
Tout séparateur de champ à un ou plusieurs caractères |
FIELD_DELIMITER |
Pour spécifier un ou plusieurs caractères comme séparateur pour chaque colonne/champ. |
sep |
Tout séparateur de champ à un caractère |
FIELD_DELIMITER |
Pour spécifier un seul caractère comme séparateur pour chaque colonne/champ. |
encoding |
UTF-8, UTF-16, etc… |
ENCODING |
Pour décoder les fichiers CSV selon le type d’encodage donné. L’encodage par défaut est UTF-8 |
ligneSep |
Tout séparateur de lignes à un caractère |
RECORD_DELIMITER |
Pour définir le séparateur de lignes à utiliser pour l’analyse du fichier. |
pathGlobFilter |
Modèle de fichier |
PATTERN |
Pour définir un modèle permettant de lire uniquement les fichiers dont les noms correspondent au modèle. |
recursiveFileLookup |
Vrai ou faux |
N/A |
Pour analyser de manière récursive un répertoire afin d’y lire des fichiers. La valeur par défaut de cette option est False. |
quote |
Caractère unique à mettre entre guillemets |
FIELD_OPTIONALLY_ENCLOSED_BY |
Permet de mettre entre guillemets les champs/colonnes contenant des champs où le délimiteur/séparateur peut faire partie de la valeur. Ce caractère permet de mettre entre guillemets tous les champs lorsqu’il est utilisé avec l’option quoteAll. La valeur par défaut de cette option est guillemet double (« ). |
nullValue |
Chaîne pour remplacer la valeur nulle |
NULL_IF |
Permet de remplacer les valeurs nulles par la chaîne lors de la lecture et de l’écriture du dataframe. |
dateFormat |
Format de date valide |
DATE_FORMAT |
Permet de définir une chaîne indiquant un format de date. Le format par défaut est yyyy-MM-dd. |
timestampFormat |
Format d’horodatage valide |
TIMESTAMP_FORMAT |
Permet de définir une chaîne indiquant un format d’horodatage. Le format par défaut est yyyy-MM-dd “T’HH: mm:ss. |
escape |
Tout caractère unique |
ESCAPE |
Permet de définir un caractère unique comme caractère d’échappement afin de remplacer le caractère d’échappement par défaut (\). |
inferSchema |
Vrai ou faux |
INFER_SCHEMA |
Détecte automatiquement le schéma de fichier |
mergeSchema |
Vrai ou faux |
N/A |
Pas nécessaire dans Snowflake, car cela se produit chaque fois que infer_schema détermine la structure du fichier parquet |
For modifiedBefore / modifiedAfter option you can achieve the same result in Snowflake by using the metadata columns and then add a filter like:
df.filter(METADATA_FILE_LAST_MODIFIED > ‘some_date’).For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1084¶
This issue code has been deprecated since Spark Conversion Core 4.12.0
Message : pyspark.sql.readwriter.DataFrameWriter.option n’est pas pris en charge.
Catégorie : Avertissement
Description¶
The pyspark.sql.readwriter.DataFrameWriter.option function is not supported.
Scénario¶
Code d’entrée
Below is an example using the option method, this method is used to add additional configurations when writing the data of a DataFrame.
Code de sortie
The tool adds this EWI SPRKPY1084 on the output code to let you know that this function is not supported by Snowpark.
Correction recommandée
La méthode pyspark.sql.readwriter.DataFrameWriter.option n’a pas de correction recommandée.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1085¶
Message : pyspark.ml.feature.VectorAssembler n’est pas pris en charge.
Catégorie : Avertissement
Description¶
The pyspark.ml.feature.VectorAssembler is not supported.
Scénario¶
Code d’entrée
VectorAssembler est utilisé pour combiner plusieurs colonnes en un seul vecteur.
Code de sortie
The tool adds this EWI SPRKPY1085 on the output code to let you know that this class is not supported by Snowpark.
Correction recommandée
pyspark.ml.feature.VectorAssembler n’a pas de correction recommandée.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1086¶
Message : pyspark.ml.linalg.VectorUDT n’est pas pris en charge.
Catégorie : Avertissement
Description¶
The pyspark.ml.linalg.VectorUDT is not supported.
Scénario¶
Code d’entrée
VectorUDT est un type de données permettant de représenter les colonnes d’un vecteur dans un DataFrame.
Code de sortie
The tool adds this EWI SPRKPY1086 on the output code to let you know that this function is not supported by Snowpark.
Correction recommandée
pyspark.ml.linalg.VectorUDT n’a pas de correction recommandée.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1087¶
Message : La fonction pyspark.sql.dataframe.DataFrame.writeTo n’est pas prise en charge, mais une solution de contournement existe.
Catégorie : Avertissement
Description¶
The pyspark.sql.dataframe.DataFrame.writeTo function is not supported. The workaround is to use Snowpark DataFrameWriter SaveAsTable method instead.
Scénario¶
Entrée
Below is an example of a use of the pyspark.sql.dataframe.DataFrame.writeTo function, the dataframe df is written into a table name Personal_info.
Sortie
The SMA adds the EWI SPRKPY1087 to the output code to let you know that this function is not supported, but has a workaround.
Correction recommandée
La solution consiste à utiliser la méthode Snowpark DataFrameWriter SaveAsTable à la place.
Recommandations supplémentaires¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1088¶
Message : Les valeurs de pyspark.sql.readwriter.DataFrameWriter.option dans Snowpark peuvent être différentes. Une validation obligatoire peut donc être nécessaire.
Catégorie : Avertissement
Description¶
The pyspark.sql.readwriter.DataFrameWriter.option values in Snowpark may be different, so validation might be needed to ensure that the behavior is correct.
Scénarios¶
Il existe plusieurs scénarios, selon que les options sont prises en charge ou non, ou selon le format utilisé pour écrire le fichier.
Scénario 1¶
Entrée
Below is an example of the usage of the method option, adding a sep option, which is currently supported.
Sortie
The tool adds the EWI SPRKPY1088 indicating that it is required validation.
Correction recommandée
L’API Snowpark prend en charge ce paramètre, la seule action possible est donc de vérifier le comportement après la migration. Veuillez vous référer à la table des équivalences pour connaître les paramètres pris en charge.
Scénario 2¶
Entrée
Here the scenario shows the usage of option, but adds a header option, which is not supported.
Sortie
The tool adds the EWI SPRKPY1088 indicating that it is required validation is needed.
Correction recommandée
For this scenario it is recommended to evaluate the Snowpark format type options to see if it is possible to change it according to your needs. Also, check the behavior after the change.
Scénario 3¶
Entrée
This scenario adds a sep option, which is supported and uses the JSON method.
Note: this scenario also applies for
PARQUET.
Sortie
The tool adds the EWI SPRKPY1088 indicating that it is required validation is needed.
Correction recommandée
The file format JSON does not support the parameter sep, so it is recommended to evaluate the snowpark format type options to see if it is possible to change it according to your needs. Also, check the behavior after the change.
Recommandations supplémentaires¶
Since there are some
not supportedparameters, it is recommended to check thetable of equivalencesand check the behavior after the transformation.Table des équivalences :
Option PySpark |
Option SnowFlake |
Formats de fichier pris en charge |
Description |
|---|---|---|---|
SEP |
FIELD_DELIMITER |
CSV |
Un ou plusieurs caractères d’un octet ou de plusieurs octets qui séparent les champs d’un fichier d’entrée. |
LINESEP |
RECORD_DELIMITER |
CSV |
Un ou plusieurs caractères qui séparent les enregistrements dans un fichier d’entrée. |
QUOTE |
FIELD_OPTIONALLY_ENCLOSED_BY |
CSV |
Caractère utilisé pour délimiter des chaînes. |
NULLVALUE |
NULL_IF |
CSV |
Chaîne utilisée pour les conversions entrante et sortante de SQL NULL. |
DATEFORMAT |
DATE_FORMAT |
CSV |
Chaîne qui définit le format des valeurs de date dans les fichiers de données à charger. |
TIMESTAMPFORMAT |
TIMESTAMP_FORMAT |
CSV |
Chaîne qui définit le format des valeurs d’horodatage dans les fichiers de données à charger. |
Si le paramètre utilisé ne figure pas dans la liste, l’API génère une erreur.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1089¶
Message : Les valeurs de pyspark.sql.readwriter.DataFrameWriter.options dans Snowpark peuvent être différentes. Une validation obligatoire peut donc être nécessaire.
Catégorie : Avertissement
Description¶
The pyspark.sql.readwriter.DataFrameWriter.options values in Snowpark may be different, so validation might be needed to ensure that the behavior is correct.
Scénarios¶
Il existe plusieurs scénarios, selon que les options sont prises en charge ou non, ou selon le format utilisé pour écrire le fichier.
Scénario 1¶
Entrée
Below is an example of the usage of the method options, adding the options sep and nullValue, which are currently supported.
Sortie
The tool adds the EWI SPRKPY1089 indicating that it is required validation.
Correction recommandée
L’API Snowpark prend en charge ces paramètres, la seule action possible est donc de vérifier le comportement après la migration. Veuillez vous référer à la table des équivalences pour connaître les paramètres pris en charge.
Scénario 2¶
Entrée
Here the scenario shows the usage of options, but adds a header option, which is not supported.
Sortie
The tool adds the EWI SPRKPY1089 indicating that it is required validation is needed.
Correction recommandée
For this scenario it is recommended to evaluate the Snowpark format type options to see if it is possible to change it according to your needs. Also, check the behavior after the change.
Scénario 3¶
Entrée
This scenario adds a sep option, which is supported and uses the JSON method.
Sortie
The tool adds the EWI SPRKPY1089 indicating that it is required validation is needed.
Note: this scenario also applies for
PARQUET.
Correction recommandée
The file format JSON does not support the parameter sep, so it is recommended to evaluate the snowpark format type options to see if it is possible to change it according to your needs. Also, check the behavior after the change.
Recommandations supplémentaires¶
Since there are some
not supportedparameters, it is recommended to check thetable of equivalencesand check the behavior after the transformation.Table des équivalences :
Snowpark peut prendre en charge une liste d”équivalences pour certains paramètres :
Option PySpark |
Option SnowFlake |
Formats de fichier pris en charge |
Description |
|---|---|---|---|
SEP |
FIELD_DELIMITER |
CSV |
Un ou plusieurs caractères d’un octet ou de plusieurs octets qui séparent les champs d’un fichier d’entrée. |
LINESEP |
RECORD_DELIMITER |
CSV |
Un ou plusieurs caractères qui séparent les enregistrements dans un fichier d’entrée. |
QUOTE |
FIELD_OPTIONALLY_ENCLOSED_BY |
CSV |
Caractère utilisé pour délimiter des chaînes. |
NULLVALUE |
NULL_IF |
CSV |
Chaîne utilisée pour les conversions entrante et sortante de SQL NULL. |
DATEFORMAT |
DATE_FORMAT |
CSV |
Chaîne qui définit le format des valeurs de date dans les fichiers de données à charger. |
TIMESTAMPFORMAT |
TIMESTAMP_FORMAT |
CSV |
Chaîne qui définit le format des valeurs d’horodatage dans les fichiers de données à charger. |
Si le paramètre utilisé ne figure pas dans la liste, l’API génère une erreur.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1101¶
Catégorie¶
Erreur d’analyse.
Description¶
Lorsque l’outil détecte une erreur d’analyse, il tente d’y remédier et poursuit le processus à la ligne suivante. Dans ces cas-là, il affiche l’erreur et des commentaires sur la ligne.
Cet exemple montre comment est traitée une erreur de concordance entre les espaces et les tabulations.
Code d’entrée
Code de sortie
Recommandations¶
Essayez de corriger la ligne commentée.
For more support, email us at sma-support@snowflake.com. If you have a support contract with Snowflake, reach out to your sales engineer, who can direct your support needs.