Snowpark Migration Accelerator: Códigos de problema para Python¶
SPRKPY1000¶
Mensagem: A versão do núcleo de projeto spark-core de origem é xx.xx:xx.x.x, a versão do spark-core suportada pelo snowpark é 2.12:3.1.2, portanto, pode haver diferenças funcionais entre os mapeamentos existentes.
Categoria: Aviso.
Descrição¶
Esse problema aparece quando a versão do Pyspark do seu código-fonte não é compatível. Isso significa que pode haver diferenças funcionais entre os mapeamentos existentes.
Recomendações adicionais¶
A versão do pyspark verificada pelo SMA para compatibilidade com o Snowpark é de 2.12 a 3.1.2. Se estiver usando uma versão fora desse intervalo, a ferramenta poderá produzir resultados inconsistentes. Você pode alterar a versão do código-fonte que está verificando.
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.
Descrição¶
Um erro de análise é relatado pelo Snowpark Migration Accelerator (SMA) quando ele não consegue ler ou entender corretamente o código em um arquivo (não consegue «analisar» corretamente o arquivo). Esse código de problema aparece quando um arquivo tem um ou mais erros de análise.
Cenário¶
Entrada: A mensagem EWI é exibida quando o código tem sintaxe inválida, por exemplo:
Saída: O SMA encontra um erro de análise e comenta o erro de análise adicionando a mensagem EWI correspondente:
Recomendações adicionais¶
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.
Descrição¶
Esse problema aparece quando a ferramenta detecta o uso de um elemento que não é compatível com o Snowpark e não tem seu próprio código de erro associado a ele. Esse é o código de erro genérico usado pelo SMA para um elemento sem suporte.
Recomendações adicionais¶
Mesmo que a opção ou o elemento da mensagem não seja compatível, isso não significa que não seja possível encontrar uma solução. Isso significa apenas que a ferramenta em si não consegue encontrar a solução.
Se encontrou um elemento não suportado de uma biblioteca pyspark.ml, considere uma abordagem alternativa. Há guias adicionais disponíveis para solucionar problemas relacionados ao ml, como este do Snowflake.
Verifique se o código-fonte tem a sintaxe correta. (Você pode usar o arquivo issues.csv para determinar onde estão ocorrendo os erros de conversão) Se a sintaxe estiver correta, informe que encontrou um erro de conversão em um elemento específico usando a opção de Relatar um problema no SMA. Inclua a linha de código que estava causando o erro na descrição quando registrar esse problema.
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.
Descrição¶
Esse problema aparece quando há um erro ao processar os símbolos na tabela de símbolos. A tabela de símbolos faz parte da arquitetura subjacente do SMA, permitindo conversões mais complexas. Esse erro pode ser devido a uma declaração inesperada no código-fonte.
Recomendações adicionais¶
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.
Descrição¶
Esse problema aparece quando há um erro inesperado no processo de execução da ferramenta. Como a tabela de símbolos não pode ser carregada, a ferramenta não pode iniciar o processo de avaliação ou conversão.
Recomendações adicionais¶
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¶
Aviso
This issue code has been deprecated since Spark Conversion Core Version 4.8.0
Message**:** pyspark.conf.SparkConf is not required
Category**:** Warning.
Descrição¶
This issue appears when the tool detects the usage of pyspark.conf.SparkConf which is not required.
Cenário¶
Entrada
SparkConf pode ser chamado sem parâmetros ou com loadDefaults.
Saída
For both cases (with or without parameters) SMA creates a Snowpark Session.builder object:
Recomendações adicionais¶
Esse é um parâmetro desnecessário que está sendo removido com a inserção de um comentário de aviso. Não deve haver nenhuma ação adicional por parte do usuário.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1006¶
Aviso
This issue code has been deprecated since Spark Conversion Core Version 4.8.0
Message**:** pyspark.context.SparkContext is not required
Category**:** Warning.
Descrição¶
This issue appears when the tool detects the usage of pyspark.context.SparkContext, which is not required in Snowflake.
Cenário¶
Entrada
Neste exemplo, há dois contextos para criar conexões com um Spark Cluster
Saída
Como não há clusters no Snowflake, o contexto não é necessário. Observe que as variáveis my_sc1 e my_sc2, que contêm propriedades do Spark, podem não ser necessárias ou terão de ser adaptadas para corrigir o código.
Recomendações adicionais¶
Esse é um parâmetro desnecessário que está sendo removido com a inserção de um comentário de aviso. Não deve haver nenhuma ação por parte do usuário.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1007¶
Aviso
This issue code has been deprecated since Spark Conversion Core Version 4.8.0
Message**:** pyspark.sql.context.SQLContext is not required
Category**:** Warning.
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.context.SQLContext, which is not required.
Cenário¶
Entrada
Aqui temos um exemplo com diferentes sobrecargas de SparkContext.
Saída
O código de saída comentou a linha do pyspark.SQLContext, e substitui os cenários por uma referência a uma configuração. Observe que as variáveis my_sc1 e my_sc2 que contêm propriedades do Spark podem não ser necessárias ou terão de ser adaptadas para corrigir o código.
Recomendações adicionais¶
Esse é um parâmetro desnecessário e é removido com um comentário de aviso inserido no código-fonte. Não deve haver nenhuma ação por parte do usuário.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1008¶
Mensagem: pyspark.sql.context.HiveContext não é necessário
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.context.HiveContext, which is not required.
Cenário¶
Entrada
Este é um exemplo para criar uma conexão com um armazenamento do Hive.
Saída
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
Correção recomendada
For the output code in the example you should add the Snow Park Session Object similar to this code:
Recomendações adicionais¶
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.
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.dataframe.DataFrame.approxQuantile which has a workaround.
Cenário¶
Entrada
It’s important understand that Pyspark uses two different approxQuantile functions, here we use the DataFrame approxQuantile version
Saída
O SMA retorna o EWI SPRKPY1009 sobre a linha em que approxQuantile é usado, para que você possa identificar onde corrigir.
Correção recomendada
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:
pyspark.sql.dataframe.DataFrame.approxQuantile relativeError parameter não existe no SnowPark.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1010¶
Mensagem: pyspark.sql.dataframe.DataFrame.checkpoint tem uma solução alternativa
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.dataframe.DataFrame.checkpoint which has a workaround.
Cenário¶
Entrada
Em PySpark, os pontos de controle são usados para truncar o plano lógico de um dataframe, para evitar o crescimento de um plano lógico.
Saída
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.
Correção recomendada
O Snowpark elimina a necessidade de pontos de verificação explícitos: isso ocorre porque o Snowpark trabalha com operações baseadas em SQLque são otimizadas pelo mecanismo de otimização de consultas do Snowflake, eliminando a necessidade de cálculos não correspondidos ou planos lógicos que ficam fora de controle.
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.
Com o uso de uma tabela permanente, o resultado computado pode ser acessado a qualquer momento, mesmo após o término da sessão.
Uma solução alternativa, o uso de uma tabela temporária, tem a vantagem de que a tabela é excluída após o término da sessão:
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1011¶
Mensagem: pyspark.sql.dataframe.DataFrameStatFunctions.approxQuantile tem uma solução alternativa
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.dataframe.DataFrameStatFunctions.approxQuantile which has a workaround.
Cenário¶
Entrada
It’s important understand that Pyspark uses two different approxQuantile functions, here we use the DataFrameStatFunctions approxQuantile version.
Saída
O SMA retorna o EWI SPRKPY1011 sobre a linha em que approxQuantile é usado, para que você possa identificar onde corrigir.
Correção recomendada
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:
pyspark.sql.dataframe.DataFrame.approxQuantile relativeError parameter não existe no SnowPark.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1012¶
Aviso
Este código de problema está obsoleto
Mensagem: pyspark.sql.dataframe.DataFrameStatFunctions.writeTo tem uma solução alternativa
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.dataframe.DataFrameStatFunctions.writeTo which has a workaround.
Cenário¶
Entrada
Neste exemplo, o dataframe df é gravado em uma tabela Spark «table».
Saída
O SMA retorna o EWI SPRKPY1012 sobre a linha em que DataFrameStatFunctions.writeTo é usado, para que você possa identificar o local a ser corrigido.
Correção recomendada
Em vez disso, use df.write.SaveAsTable().
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1013¶
Mensagem: pyspark.sql.functions.acosh tem uma solução alternativa
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.functions.acosh which has a workaround.
Cenário¶
Entrada
On this example pyspark calculates the acosh for a dataframe by using pyspark.sql.functions.acosh
Saída
O SMA retorna o EWI SPRKPY1013 sobre a linha em que acosh é usado, para que você possa identificar onde corrigir.
Correção recomendada
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.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1014¶
Mensagem: pyspark.sql.functions.asinh tem uma solução alternativa
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.functions.asinh which has a workaround.
Cenário¶
Entrada
On this example pyspark calculates the asinh for a dataframe by using pyspark.sql.functions.asinh.
Saída
O SMA retorna o EWI SPRKPY1014 sobre a linha em que o asinh é usado, para que você possa identificar onde corrigir.
Correção recomendada
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.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1015¶
Mensagem: pyspark.sql.functions.atanh tem uma solução alternativa
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.functions.atanh which has a workaround.
Cenário¶
Entrada
On this example pyspark calculates the atanh for a dataframe by using pyspark.sql.functions.atanh.
Saída
SMA retorna o EWI SPRKPY1015 sobre a linha em que atanh é usado, para que você possa usar para identificar onde corrigir.
Correção recomendada
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.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1016¶
Aviso
This issue code has been deprecated since Spark Conversion Core Version 0.11.7
Mensagem: pyspark.sql.functions.collect_set tem uma solução alternativa
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.functions.collect_set which has a workaround.
Cenário¶
Entrada
Using collect*set to get the elements of _colname* without duplicates:
Saída
O SMA retorna o EWI SPRKPY1016 sobre a linha em que collect_set é usado, para que você possa identificar onde corrigir.
Correção recomendada
Use a função array_agg e adicione um segundo argumento com o valor True.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1017¶
Aviso
This issue code has been deprecated since Spark Conversion Core Version 4.8.0
pyspark.sql.functions.date_add tem uma solução alternativa
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.functions.date_add which has a workaround.
Cenário¶
Entrada
Neste exemplo, usamos date_add para calcular a data 5 dias após a data atual para o dataframe df.
Saída
SMA retorna o EWI SPRKPY1017 sobre a linha em que date_add é usado, para que você possa identificar onde corrigir.
Correção recomendada
Import snowflake.snowpark.functions, which contains an implementation for date_add (and alias dateAdd) function.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1018¶
Aviso
This issue code has been deprecated since Spark Conversion Core Version 4.8.0
Mensagem: pyspark.sql.functions.date_sub tem uma solução alternativa
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.functions.date_sub which has a workaround.
Cenário¶
Entrada
Neste exemplo, usamos date_add para calcular a data 5 dias antes da data atual para o dataframe df.
Saída
O SMA retorna o EWI SPRKPY1018 sobre a linha em que date_sub é usado, para que você possa identificar onde corrigir.
Correção recomendada
Import snowflake.snowpark.functions, which contains an implementation for date_sub function.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1019¶
Aviso
This issue code has been deprecated since Spark Conversion Core Version 4.8.0
Mensagem: pyspark.sql.functions.datediff tem uma solução alternativa
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.functions.datediff which has a workaround.
Cenário¶
Entrada
Neste exemplo, usamos o datediff para calcular a diferença de dia entre «today» e outras datas.
Saída
O SMA retorna o EWI SPRKPY1019 sobre a linha em que datediff é usado, para que você possa identificar onde corrigir.
SMA convert pyspark.sql.functions.datediff onto snowflake.snowpark.functions.daydiff that also calculates the diference in days between two dates.
Correção recomendada
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.
Recomendação¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1020¶
Mensagem: pyspark.sql.functions.instr tem uma solução alternativa
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.functions.instr which has a workaround.
Cenário¶
Entrada
Aqui está um exemplo básico de uso do pyspark instr:
Saída:
O SMA retorna o EWI SPRKPY1020 sobre a linha em que o instr é usado, para que você possa identificar onde corrigir.
Correção recomendada
Requires a manual change by using the function charindex and changing the order of the first two parameters.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1021¶
Aviso
Este código de problema está obsoleto
Mensagem: pyspark.sql.functions.last tem uma solução alternativa, consulte a documentação para obter mais informações
Categoria: Aviso
Descrição¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.last function, which has a workaround.
Cenário¶
Entrada
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.
Saída
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.
Correção recomendada
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.
Recomendações adicionais¶
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¶
Mensagem: pyspark.sql.functions.log10 tem uma solução alternativa, consulte a documentação para obter mais informações
Categoria: Aviso
Descrição¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.log10 function, which has a workaround.
Cenário¶
Entrada
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.
Saída
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.
Correção recomendada
As a workaround, you can use the snowflake.snowpark.functions.log function by passing the literal value 10 as the base.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1023¶
Mensagem: pyspark.sql.functions.log1p tem uma solução alternativa, consulte a documentação para obter mais informações
Categoria: Aviso
Descrição¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.log1p function, which has a workaround.
Cenário¶
Entrada
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.
Saída
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.
Correção recomendada
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.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1024¶
Mensagem: pyspark.sql.functions.log2 tem uma solução alternativa, consulte a documentação para obter mais informações
Categoria: Aviso
Descrição¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.log2 function, which has a workaround.
Cenário¶
Entrada
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.
Saída
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.
Correção recomendada
As a workaround, you can use the snowflake.snowpark.functions.log function by passing the literal value 2 as the base.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1025¶
Aviso
Este código de problema está obsoleto
Mensagem: pyspark.sql.functions.ntile tem uma solução alternativa, consulte a documentação para obter mais informações
Categoria: Aviso
Descrição¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.ntile function, which has a workaround.
Cenário¶
Entrada
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.
Saída
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.
Correção recomendada
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.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1026¶
Aviso
This issue code has been deprecated since Spark Conversion Core 4.3.2
Mensagem: pyspark.sql.readwriter.DataFrameReader.csv tem uma solução alternativa, consulte a documentação para obter mais informações
Categoria: Aviso
Descrição¶
This issue appears when the SMA detects a use of the pyspark.sql.readwriter.DataFrameReader.csv function, which has a workaround.
Cenário¶
Entrada
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.
Saída
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.
Correção recomendada
In this section, we explain how to configure the path parameter, the schema parameter and some options to make them work in Snowpark.
1. parâmetro 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. parâmetro 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. parâmetros de 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.
Nota
As seguintes opções não são suportadas pelo Snowpark:
columnNameOfCorruptRecord
emptyValue
enforceSchema
header
ignoreLeadingWhiteSpace
ignoreTrailingWhiteSpace
inferSchema
locale
maxCharsPerColumn
maxColumns
mode
multiLine
nanValue
negativoInf
nullValue
positivoInf
quoteAll
samplingRatio
timestampNTZFormat
unescapedQuoteHandling
Abaixo está o exemplo completo de como o código de entrada deve ficar depois de aplicar as sugestões mencionadas acima para fazê-lo funcionar no Snowpark:
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1027¶
Aviso
This issue code has been deprecated since Spark Conversion Core 4.5.2
Mensagem: pyspark.sql.readwriter.DataFrameReader.json tem uma solução alternativa, consulte a documentação para obter mais informações
Categoria: Aviso
Descrição¶
This issue appears when the SMA detects a use of the pyspark.sql.readwriter.DataFrameReader.json function, which has a workaround.
Cenário¶
Entrada
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.
Saída
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.
Correção recomendada
In this section, we explain how to configure the path parameter, the schema parameter and some options to make them work in Snowpark.
1. parâmetro 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. parâmetro 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. parâmetros de 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.
Nota
As seguintes opções não são suportadas pelo Snowpark:
allowBackslashEscapingAnyCharacter
allowComments
allowNonNumericNumbers
allowNumericLeadingZero
allowSingleQuotes
allowUnquotedControlChars
allowUnquotedFieldNames
columnNameOfCorruptRecord
dropFiledIfAllNull
encoding
ignoreNullFields
lineSep
locale
mode
multiline
prefereDecimal
primitiveAsString
samplingRatio
timestampNTZFormat
timeZone
Abaixo está o exemplo completo de como o código de entrada deve ficar depois de aplicar as sugestões mencionadas acima para fazê-lo funcionar no Snowpark:
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1028¶
Mensagem: pyspark.sql.readwriter.DataFrameReader.orc tem uma solução alternativa, consulte a documentação para obter mais informações
Categoria: Aviso
Descrição¶
This issue appears when the SMA detects a use of the pyspark.sql.readwriter.DataFrameReader.orc function, which has a workaround.
Cenário¶
Entrada
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.
Saída
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.
Correção recomendada
In this section, we explain how to configure the path parameter and the extra options to make them work in Snowpark.
1. parâmetro 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. parâmetros 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.
Nota
As seguintes opções não são suportadas pelo Snowpark:
compression
mergeSchema
Abaixo está o exemplo completo de como o código de entrada deve ficar depois de aplicar as sugestões mencionadas acima para fazê-lo funcionar no Snowpark:
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1029¶
Mensagem: Esse problema aparece quando a ferramenta detecta o uso do pyspark.sql.readwriter.DataFrameReader.parquet. Essa função é compatível, mas algumas das diferenças entre o Snowpark e o Spark API podem exigir algumas alterações manuais.
Categoria: Aviso
Descrição¶
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.
Cenário¶
Entrada
Below is an example of a use of the pyspark.sql.readwriter.DataFrameReader.parquet function that generates this EWI.
Saída
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.
Correção recomendada
In this section, we explain how to configure the paths and options parameters to make them work in Snowpark.
1. parâmetro paths
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. parâmetro 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.
Observe que options do Snowpark não são exatamente iguais a options do PySpark, portanto, pode ser necessário fazer algumas alterações manuais. Veja a seguir uma explicação mais detalhada de como configurar as opções mais comuns do PySpark no Snowpark.
2.1 opção 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 opção 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 opção 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 opção modifiedBefore / modifiedAfter
You can achieve the same result in Snowflake by using the metadata columns.
Nota
As seguintes opções não são suportadas pelo Snowpark:
compression
datetimeRebaseMode
int96RebaseMode
mergeSchema
Abaixo está o exemplo completo de como o código de entrada deve ser transformado para que funcione no Snowpark:
Recomendações adicionais¶
No Snowflake, você pode aproveitar outras abordagens para a ingestão de dados de parquet, como:
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.
Ao fazer uma migração, é uma boa prática aproveitar os relatórios do SMA para tentar criar um inventário de arquivos e determinar, após a modernização, para quais estágios/tabelas os dados serão mapeados.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1030¶
Aviso
Este código de problema está obsoleto
Mensagem: pyspark.sql.session.SparkSession.Builder.appName tem uma solução alternativa, consulte a documentação para obter mais informações
Categoria: Aviso
Descrição¶
This issue appears when the SMA detects a use of the pyspark.sql.session.SparkSession.Builder.appName function, which has a workaround.
Cenário¶
Entrada
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.
Saída
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.
Correção recomendada
As a workaround, you can import the snowpark_extensions package which provides an extension for the appName function.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1031¶
Aviso
This issue code has been deprecated since Spark Conversion Core 2.7.0
Mensagem: pyspark.sql.column.Column.contains tem uma solução alternativa, consulte a documentação para obter mais informações
Categoria: Aviso
Descrição¶
This issue appears when the SMA detects a use of the pyspark.sql.column.Column.contains function, which has a workaround.
Cenário¶
Entrada
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”.
Saída
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.
Correção recomendada
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.
Recomendações adicionais¶
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
Categoria: Erro de conversão
Descrição¶
Esse problema aparece quando o SMA não consegue determinar um status de mapeamento apropriado para um determinado elemento. Isso significa que o SMA ainda não sabe se esse elemento é compatível ou não com o Snowpark. Observe que esse é um código de erro genérico usado pelo SMA para qualquer elemento não definido.
Cenário¶
Entrada
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.
Saída
The SMA adds the EWI SPRKPY1032 to the output code to let you know that this element is not defined.
Correção recomendada
Para tentar identificar o problema, você pode realizar as seguintes validações:
Verifique se o código-fonte tem a sintaxe correta e se está escrito corretamente.
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.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1033¶
Aviso
Este código de problema está obsoleto
Mensagem: pyspark.sql.functions.asc tem uma solução alternativa, consulte a documentação para obter mais informações
Categoria: Aviso
Descrição¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.asc function, which has a workaround.
Cenários¶
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.
Cenário 1¶
Entrada
Below is an example of a use of the pyspark.sql.functions.asc function that takes a column object as parameter.
Saída
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.
Correção recomendada
As a workaround, you can call the snowflake.snowpark.Column.asc function from the column parameter.
Cenário 2¶
Entrada
Below is an example of a use of the pyspark.sql.functions.asc function that takes the name of the column as parameter.
Saída
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.
Correção recomendada
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.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1034¶
Aviso
Este código de problema está obsoleto
Mensagem: pyspark.sql.functions.desc tem uma solução alternativa, consulte a documentação para obter mais informações
Categoria: Aviso
Descrição¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.desc function, which has a workaround.
Cenários¶
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.
Cenário 1¶
Entrada
Below is an example of a use of the pyspark.sql.functions.desc function that takes a column object as parameter.
Saída
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.
Correção recomendada
As a workaround, you can call the snowflake.snowpark.Column.desc function from the column parameter.
Cenário 2¶
Entrada
Below is an example of a use of the pyspark.sql.functions.desc function that takes the name of the column as parameter.
Saída
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.
Correção recomendada
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.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1035¶
Aviso
Este código de problema está obsoleto
Mensagem: pyspark.sql.functions.reverse tem uma solução alternativa, consulte a documentação para obter mais informações
Categoria: Aviso
Descrição¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.reverse function, which has a workaround.
Cenário¶
Entrada
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.
Saída
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.
Correção recomendada
As a workaround, you can import the snowpark_extensions package which provides an extension for the reverse function.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1036¶
Aviso
Este código de problema está obsoleto
Mensagem: pyspark.sql.column.Column.getField tem uma solução alternativa, consulte a documentação para obter mais informações
Categoria: Aviso
Descrição¶
This issue appears when the SMA detects a use of the pyspark.sql.column.Column.getField function, which has a workaround.
Cenário¶
Entrada
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.
Saída
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.
Correção recomendada
As a workaround, you can use the Snowpark column indexer operator with the name of the field as the index.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1037¶
Aviso
Este código de problema está obsoleto
Mensagem: pyspark.sql.functions.sort_array tem uma solução alternativa, consulte a documentação para obter mais informações
Categoria: Aviso
Descrição¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.sort_array function, which has a workaround.
Cenário¶
Entrada
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.
Saída
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.
Correção recomendada
As a workaround, you can import the snowpark_extensions package which provides an extension for the sort_array function.
Recomendações adicionais¶
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
Categoria: Erro de conversão
Descrição¶
Esse problema aparece quando há um elemento PySpark em seu código-fonte que não foi reconhecido pelo SMA. Isso pode ocorrer por diferentes motivos, como:
Um elemento que não existe em PySpark.
Um elemento que foi adicionado em uma versão do PySpark que o SMA ainda não suporta.
Um erro interno do SMA ao processar o elemento.
Esse é um código de erro genérico usado pelo SMA para qualquer elemento não reconhecido.
Cenário¶
Entrada
Abaixo está um exemplo de uso de uma função que não pôde ser reconhecida pelo SMA porque ela não existe em PySpark.
Saída
The SMA adds the EWI SPRKPY1038 to the output code to let you know that this element could not be recognized.
Correção recomendada
Para tentar identificar o problema, você pode realizar as seguintes validações:
Verificar se o elemento existe em PySpark.
Verifique se o elemento está escrito corretamente.
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.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1039¶
Aviso
Este código de problema está obsoleto
Mensagem: pyspark.sql.column.Column.getItem tem uma solução alternativa, consulte a documentação para obter mais informações
Categoria: Aviso
Descrição¶
This issue appears when the SMA detects a use of the pyspark.sql.column.Column.getItem function, which has a workaround.
Cenário¶
Entrada
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.
Saída
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.
Correção recomendada
Como solução alternativa, você pode usar o operador de indexador de coluna Snowpark com o nome ou a posição do campo como índice.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1040¶
Aviso
Este código de problema está obsoleto
Mensagem: pyspark.sql.functions.explode tem uma solução alternativa, consulte a documentação para obter mais informações
Categoria: Aviso
Descrição¶
This issue appears when the SMA detects a use of the pyspark.sql.functions.explode function, which has a workaround.
Cenário¶
Entrada
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.
Saída
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.
Correção recomendada
As a workaround, you can import the snowpark_extensions package which provides an extension for the explode function.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1041¶
Aviso
This issue code has been deprecated since Spark Conversion Core Version 2.9.0
Mensagem: pyspark.sql.functions.explode_outer tem uma solução alternativa
Categoria: Aviso
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.functions.explode_outer which has a workaround.
Cenário¶
Entrada
O exemplo mostra o uso do método explode_outer em uma chamada de seleção.
Saída
The tool adds the EWI SPRKPY1041 indicating that a workaround can be implemented.
Correção recomendada
As a workaround, you can import the snowpark_extensions package, which contains a helper for the explode_outer function.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1042¶
Mensagem: pyspark.sql.functions.posexplode tem uma solução alternativa
Categoria: Aviso
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.functions.posexplode which has a workaround.
Cenários¶
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).
Cenário 1¶
Entrada
Below is an example of the usage of posexplode passing as a parameter of a list of values.
Saída
The tool adds the EWI SPRKPY1042 indicating that a workaround can be implemented.
Correção recomendada
For having the same behavior, use the method functions.flatten, drop extra columns, and rename index and value column names.
Cenário 2¶
Entrada
Below is another example of the usage of posexplode passing as a parameter a map/dictionary (keys/values)
Saída
The tool adds the EWI SPRKPY1042 indicating that a workaround can be implemented.
Correção recomendada
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.
Observação: usar row_number não é totalmente equivalente, pois começa com 1 (não zero como o método spark)
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1043¶
Mensagem: pyspark.sql.functions.posexplode_outer tem uma solução alternativa
Categoria: Aviso
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.functions.posexplode_outer which has a workaround.
Cenários¶
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).
Cenário 1¶
Entrada
Below is an example that shows the usage of posexplode_outer passing a list of values.
Saída
The tool adds the EWI SPRKPY1043 indicating that a workaround can be implemented.
Correção recomendada
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.
Cenário 2¶
Entrada
Abaixo está outro exemplo de uso do posexplode_outer passando um mapa/dicionário (chaves/valores)
Saída
The tool adds the EWI SPRKPY1043 indicating that a workaround can be implemented.
Correção recomendada
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.
Observação: usar row_number não é totalmente equivalente, pois começa com 1 (não zero como o método spark)
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1044¶
Aviso
This issue code has been deprecated since Spark Conversion Core Version 2.4.0
Mensagem: pyspark.sql.functions.split tem uma solução alternativa
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.functions.split which has a workaround.
Cenários¶
Há alguns cenários, dependendo da quantidade de parâmetros passados para o método.
Cenário 1¶
Entrada
Below is an example when the function split has just the str and pattern parameters
Saída
The tool shows the EWI SPRKPY1044 indicating there is a workaround.
Correção recomendada
As a workaround, you can call the function snowflake.snowpark.functions.lit with the pattern parameter and send it into the split.
Cenário 2¶
Entrada
Below is another example when the function split has the str, pattern, and limit parameters.
Saída
The tool shows the EWI SPRKPY1044 indicating there is a workaround.
Correção recomendada
Esse cenário específico não é suportado.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1045¶
Mensagem: pyspark.sql.functions.map_values tem uma solução alternativa
Categoria: Aviso.
Descrição¶
Essa função é usada para extrair a lista de valores de uma coluna que contém um mapa/dicionário (chaves/valores).
The issue appears when the tool detects the usage of pyspark.sql.functions.map_values which has a workaround.
Cenário¶
Entrada
Below is an example of the usage of the method map_values.
Saída
The tool adds the EWI SPRKPY1045 indicating that a workaround can be implemented.
Correção recomendada
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.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1046¶
Aviso
This issue code has been deprecated since Spark Conversion Core Version 2.1.22
Mensagem: pyspark.sql.functions.monotonically_increasing_id tem uma solução alternativa
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.functions.monotonically_increasing_id which has a workaround.
Cenário¶
Entrada
Below is an example of the usage of the method monotonically_increasing_id.
Saída
The tool adds the EWI SPRKPY1046 indicating that a workaround can be implemented.
Correção recomendada
Atualize a versão da ferramenta.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1047¶
Aviso
This issue code has been deprecated since Spark Conversion Core Version 4.6.0
Descrição¶
This issue appears when the tool detects the usage of pyspark.context.SparkContext.setLogLevel which has a workaround.
Cenário¶
Entrada
Below is an example of the usage of the method setLogLevel.
Saída
The tool adds the EWI SPRKPY1047 indicating that a workaround can be implemented.
Correção recomendada
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»:
Tabela de níveis equivalentes
Parâmetro de origem de nível |
Parâmetro de destino de nível |
|---|---|
«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 |
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1048¶
Aviso
This issue code has been deprecated since Spark Conversion Core Version 2.4.0
Mensagem: pyspark.sql.session.SparkSession.conf tem uma solução alternativa
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.session.SparkSession.conf which has a workaround.
Cenário¶
Entrada
Below is an example of how to set a configuration into the property conf .
Saída
The tool adds the EWI SPRKPY1048 indicating that a workaround can be implemented.
Correção recomendada
SparkSession.conf é usado para passar algumas configurações específicas usadas apenas pelo Pyspark e não se aplica ao Snowpark. Você pode remover ou comentar o código
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1049¶
Aviso
This issue code has been deprecated since Spark Conversion Core Version 2.1.9
Mensagem: pyspark.sql.session.SparkSession.sparkContext tem uma solução alternativa
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.session.SparkSession.sparkContext which has a workaround.
Cenário¶
Entrada
Below is an example that creates a spark session and then uses the SparkContext property to print the appName.
Saída
The tool adds the EWI SPRKPY1049 indicating that a workaround can be implemented.
Correção recomendada
O SparkContext não é compatível com SnowPark, mas você pode acessar os métodos e as propriedades de SparkContext diretamente da instância Session.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1050¶
Mensagem: pyspark.conf.SparkConf.set tem uma solução alternativa
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects the usage of pyspark.conf.SparkConf.set which has a workaround.
Cenário¶
Entrada
Below is an example that sets a variable using conf.set.
Saída
The tool adds the EWI SPRKPY1050 indicating that a workaround can be implemented.
Correção recomendada
SparkConf.set é usado para definir uma configuração usada somente pelo Pyspark e não se aplica ao Snowpark. Você pode remover ou comentar o código
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1051¶
Aviso
This issue code has been deprecated since Spark Conversion Core Version 2.4.0
Mensagem: pyspark.sql.session.SparkSession.Builder.master tem uma solução alternativa
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects pyspark.sql.session.SparkSession.Builder.master usage which has a workaround.
Cenário¶
Entrada
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.
Saída
The tool adds the EWI SPRKPY1051 indicating that a workaround can be implemented.
Correção recomendada
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.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1052¶
Aviso
This issue code has been deprecated since Spark Conversion Core Version 2.8.0
Mensagem: pyspark.sql.session.SparkSession.Builder.enableHiveSupport tem uma solução alternativa
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.session.SparkSession.Builder.enableHiveSupport which has a workaround.
Cenário¶
Entrada
Below is an example that configures the SparkSession and enables the hive support using the method enableHiveSupport.
Saída
The tool adds the EWI SPRKPY1052 indicating that a workaround can be implemented.
Correção recomendada
Remove the use of enableHiveSupport function because it is not needed in Snowpark.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1053¶
Mensagem: Ocorreu um erro ao extrair os arquivos dbc.
Categoria: Aviso.
Descrição¶
Esse problema aparece quando um arquivo dbc não pode ser extraído. Esse aviso pode ser causado por um ou mais dos seguintes motivos: muito pesado, inacessível, somente leitura, etc.
Recomendações adicionais¶
Como solução alternativa, você pode verificar o tamanho do arquivo se ele for muito pesado para ser processado. Além disso, analise se a ferramenta pode acessá-la para evitar problemas de acesso.
Para obter mais suporte, envie um e-mail para snowconvert-info@snowflake.com. Se tiver um contrato de suporte com a Snowflake, entre em contato com seu engenheiro de vendas para que ele possa direcionar suas necessidades de suporte.
SPRKPY1080¶
Mensagem: O valor de SparkContext é substituído pela variável “session”.
Categoria: Aviso
Descrição¶
O contexto do Spark é armazenado em uma variável chamada session que cria uma sessão do Snowpark.
Cenário¶
Entrada
Este snippet descreve um SparkContext
Saída
Nesse código de saída, o SMA substituiu o PySpark.SparkContext por um SparkSession, observe que o SMA também adiciona um modelo para substituir a conexão no arquivo «connection.json» e, em seguida, carrega essa configuração na variável connection_parameter.
Correção recomendada
O arquivo de configuração «connection.json» deve ser atualizado com as informações de conexão necessárias:
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1054¶
Mensagem: pyspark.sql.readwriter.DataFrameReader.format não é suportado.
Categoria: Aviso.
Descrição¶
This issue appears when the pyspark.sql.readwriter.DataFrameReader.format has an argument that is not supported by Snowpark.
Cenários¶
There are some scenarios depending on the type of format you are trying to load. It can be a supported , or non-supported format.
Cenário 1¶
Entrada
A ferramenta analisa o tipo de formato que está tentando carregar; os formatos compatíveis são:
Csv
JSON
Parquet
Orc
The below example shows how the tool transforms the format method when passing a Csv value.
Saída
The tool transforms the format method into a Csv method call.
Correção recomendada
Nesse caso, a ferramenta não mostra o EWI, o que significa que não há necessidade de correção.
Cenário 2¶
Entrada
The below example shows how the tool transforms the format method when passing a Jdbc value.
Saída
The tool shows the EWI SPRKPY1054 indicating that the value «jdbc» is not supported.
Correção recomendada
For the not supported scenarios, there is no specific fix since it depends on the files that are trying to be read.
Cenário 3¶
Entrada
The below example shows how the tool transforms the format method when passing a CSV, but using a variable instead.
Saída
Since the tool can not determine the value of the variable in runtime, shows the EWI SPRKPY1054 indicating that the value «» is not supported.
Correção recomendada
As a workaround, you can check the value of the variable and add it as a string to the format call.
Recomendações adicionais¶
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¶
Mensagem: o valor da chave pyspark.sql.readwriter.DataFrameReader.option não é suportado.
Categoria: Aviso.
Descrição¶
This issue appears when the pyspark.sql.readwriter.DataFrameReader.option key value is not supported by SnowFlake.
A ferramenta analisa os parâmetros de chamada de opção e, dependendo do método (CSV ou JSON ou PARQUET), o valor da chave pode ter ou não um equivalente no Snowpark. Se todos os parâmetros tiverem um equivalente, a ferramenta não adicionará o EWI e substituirá o valor da chave pelo seu equivalente; caso contrário, a ferramenta adicionará o EWI.
Lista de equivalências:
Equivalências para CSV:
Chaves de opção do Spark |
Equivalências do Snowpark |
|---|---|
sep |
FIELD_DELIMITER |
header |
PARSE_HEADER |
lineSep |
RECORD_DELIMITER |
pathGlobFilter |
PATTERN |
quote |
FIELD_OPTIONALLY_ENCLOSED_BY |
nullValue |
NULL_IF |
dateFormat |
DATE_FORMAT |
timestampFormat |
TIMESTAMP_FORMAT |
inferSchema |
INFER_SCHEMA |
delimiter |
FIELD_DELIMITER |
Equivalências para JSON:
Chaves de opção do Spark |
Equivalências do Snowpark |
|---|---|
dateFormat |
DATE_FORMAT |
timestampFormat |
TIMESTAMP_FORMAT |
pathGlobFilter |
PATTERN |
Equivalências para PARQUET:
Chaves de opção do Spark |
Equivalências do Snowpark |
|---|---|
pathGlobFilter |
PATTERN |
Qualquer outra opção de chave que não esteja em uma das tabelas acima não é compatível ou não tem um equivalente no Snowpark. Se esse for o caso, a ferramenta adiciona o EWI com as informações do parâmetro e o remove da cadeia.
Cenários¶
Os cenários abaixo se aplicam a CSV, JSON e PARQUET.
There are a couple of scenarios depending on the value of the key used in the option method.
Cenário 1¶
Entrada
Below is an example of a option call using a equivalent key.
Saída
A ferramenta transforma a chave com o equivalente correto.
Correção recomendada
Como a ferramenta transforma o valor da chave, não há necessidade de correção.
Cenário 2¶
Entrada
Below is an example of a option call using a non-equivalent key.
Saída
The tool adds the EWI SPRKPY1055 indicating the key is not supported and removes the option call.
Correção recomendada
Recomenda-se que verifique o comportamento após a transformação.
Recomendações adicionais¶
Quando houver parâmetros não equivalentes, é recomendável verificar o comportamento após a transformação.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1056¶
Aviso
Este código de problema está obsoleto
Mensagem: pyspark.sql.readwriter.DataFrameReader.option argument _ <argument_name> _ não é um literal e não pode ser avaliado
Categoria: Aviso
Descrição¶
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.
Cenário¶
Entrada
Below is an example of a use of the pyspark.sql.readwriter.DataFrameReader.option function that generates this EWI.
Saída
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.
Correção recomendada
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.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1057¶
Aviso
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
Categoria: Aviso.
Descrição¶
Esse código de problema está obsoleto. Se você estiver usando uma versão mais antiga, atualize para a mais recente.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1058¶
Mensagem: < método > com < chave > Não há suporte para a chave específica da plataforma.
Categoria: ConversionError
Descrição¶
The get and set methods from pyspark.sql.conf.RuntimeConfig are not supported with a Platform specific key.
Cenários¶
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.
Cenário 1¶
Entrada
Below is an example of the get or set methods with supported keys in Snowpark.
Saída
Como as chaves são compatíveis com o Snowpark, a ferramenta não adiciona o EWI no código de saída.
Correção recomendada
Não há nenhuma correção recomendada para esse cenário.
Cenário 2¶
Entrada
Abaixo está um exemplo usando chaves não suportadas.
Saída
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.
Correção recomendada
A correção recomendada é remover esses métodos.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1059¶
Aviso
This issue code has been deprecated since Spark Conversion Core Version 2.45.1
Message: pyspark.storagelevel.StorageLevel has a workaround, see documentation.
Categoria: Aviso
Descrição¶
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
Recomendações adicionais¶
Atualize seu aplicativo para a versão mais recente.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1060¶
Mensagem: O mecanismo de autenticação é connection.json (modelo fornecido).
Categoria: Aviso.
Descrição¶
This issue appears when the tool detects the usage of pyspark.conf.SparkConf.
Cenário¶
Entrada
Como o mecanismo de autenticação é diferente no Snowpark, a ferramenta remove os usos e cria um arquivo de configuração de conexão (connection.json) em vez disso.
Saída
The tool adds the EWI SPRKPY1060 indicating that the authentication mechanism is different.
Correção recomendada
To create a connection it is necessary that you fill in the information in the connection.json file.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1061¶
Mensagem: O Snowpark não é compatível com as funções unix_timestamp
Categoria: Aviso
Descrição¶
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.
Cenário¶
Entrada
Below an example that calls the unix_timestamp method without parameters.
Saída
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.
Correção recomendada
Como solução alternativa, você pode adicionar pelo menos o nome ou a coluna da cadeia de caracteres de carimbo de data/hora.
Recomendações adicionais¶
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¶
Mensagem: O Snowpark não é compatível com GroupedData.pivot sem o parâmetro «values».
Categoria: Aviso
Descrição¶
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).
No momento, a função de pivô do Snowpark Python exige que você especifique explicitamente a lista de valores distintos sobre os quais fazer o pivô.
Cenários¶
Cenário 1¶
Entrada
The SMA detects an expression that matches the pattern dataFrame.groupBy("columnX").pivot("columnY") and the pivot does not have the values parameter.
Saída
O SMA adiciona uma mensagem EWI indicando que não há suporte para a função de pivô sem o parâmetro «values».
Além disso, ele adicionará como segundo parâmetro da função de pivô uma compreensão de lista que calcula a lista de valores que serão convertidos em colunas. Lembre-se de que essa operação não é eficiente para grandes conjuntos de dados, e é aconselhável indicar os valores explicitamente.
Correção recomendada
Para esse cenário, o SMA adiciona um segundo parâmetro da função de pivô, uma compreensão de lista que calcula a lista de valores que serão convertidos em colunas, mas você pode usar uma lista de valores distintos para pivotar, como segue:
Cenário 2¶
Entrada
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.
Saída
O SMA adiciona uma mensagem EWI indicando que não há suporte para a função de pivô sem o parâmetro «values».
Correção recomendada
Adicione uma lista de valores distintos para fazer o pivô, como segue:
Recomendações adicionais¶
O cálculo da lista de valores distintos para pivotar não é uma operação eficiente em grandes conjuntos de dados e pode se tornar uma chamada de bloqueio. Considere a possibilidade de indicar explicitamente a lista de valores distintos para dinamizar.
Se não quiser especificar explicitamente a lista de valores distintos para pivotar (o que não é aconselhável), você pode adicionar o seguinte código como o segundo argumento da função pivot para inferir os valores em tempo de execução*
****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¶
Mensagem: pyspark.sql.pandas.functions.pandas_udf tem uma solução alternativa.
Categoria: Aviso
Descrição¶
This issue appears when the tool detects the usage of pyspark.sql.pandas.functions.pandas_udf which has a workaround.
Cenário¶
Entrada
A função pandas_udf é usada para criar funções definidas pelo usuário que trabalham com grandes quantidades de dados.
Saída
O SMA adiciona uma mensagem EWI indicando que o pandas_udf tem uma solução alternativa.
Correção recomendada
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.
Recomendações adicionais¶
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.
Categoria: Aviso
Descrição¶
Esse problema aparece quando a ferramenta detecta o uso de qualquer elemento da biblioteca pyspark.streaming:
pyspark.streaming.listener.StreamingListener.
Cenário¶
Entrada
Abaixo está um exemplo com um dos elementos que acionam esse EWI.
Saída
The SMA adds the EWI SPRKPY1064 on the output code to let you know that this function does not apply.
Correção recomendada
The SMA removes the import statement and adds the issue to the Issues.csv inventory, remove any usages of the Spark element.
Recomendações adicionais¶
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¶
Mensagem: O pyspark.context.SparkContext.broadcast não se aplica, pois o snowflake usa o mecanismo data-clustering para computar os dados.
Categoria: Aviso
Descrição¶
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.
Código de entrada
Neste exemplo, é criada uma variável de transmissão. Essas variáveis permitem que os dados sejam compartilhados de forma mais eficiente por todos os nós.
Código de saída
O SMA adiciona uma mensagem EWI indicando que a transmissão não é necessária.
Correção recomendada
Remova todos os usos de pyspark.context.SparkContext.broadcast.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1066¶
Mensagem: O elemento Spark não se aplica, pois o Snowflake usa o mecanismo de micropartição criado automaticamente.
Categoria: Aviso
Descrição¶
Esse problema aparece quando a ferramenta detecta o uso de elementos relacionados a partições:
Those elements do not apply due the use of micro-partitions of Snowflake.
Código de entrada
In this example sortWithinPartitions it’s used to create a partition in a DataFrame sorted by the specified column.
Código de saída
O SMA adiciona uma mensagem EWI indicando que o elemento Spark não é necessário.
Correção recomendada
Remova o uso do elemento.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1067¶
Mensagem: O pyspark.sql.functions.split tem parâmetros que não são suportados pelo Snowpark.
Categoria: Aviso
Descrição¶
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.
Cenários¶
Cenário 1¶
Código de entrada
Neste exemplo, a função split tem mais de dois parâmetros.
Código de saída
A ferramenta adiciona esse EWI no código de saída para informar que essa função não é suportada quando tem mais de dois parâmetros.
Correção recomendada
Mantenha a função split com apenas dois parâmetros.
Cenário 2¶
Código de entrada
Neste exemplo, a função split tem um padrão regex como parâmetro.
Código de saída
A ferramenta adiciona esse EWI no código de saída para informar que essa função não é suportada quando tem um padrão regex como parâmetro.
Correção recomendada
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.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1068¶
Mensagem: toPandas contém colunas do tipo ArrayType que não são suportadas e têm uma solução alternativa.
Categoria: Aviso
Descrição¶
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.
Cenário¶
Entrada
ToPandas retorna os dados do DataFrame original como um Pandas DataFrame.
Saída
A ferramenta adiciona este EWI para que você saiba que o toPandas não é suportado se houver colunas do tipo ArrayType, mas tem uma solução alternativa.
Correção recomendada
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1069¶
Mensagem: Se o parâmetro partitionBy for uma lista, o Snowpark lançará um erro.
Categoria: Aviso
Descrição¶
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.
Cenários¶
Cenário 1¶
Código de entrada:
Para esse cenário, o parâmetro partitionBy não é uma lista.
Código de saída:
The tool adds the EWI SPRKPY1069 to let you know that Snowpark throws an error if parameter is a list.
Correção recomendada
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.
Cenário 2¶
Código de entrada:
Para esse cenário, o parâmetro partitionBy é uma lista.
Código de saída:
The tool adds the EWI SPRKPY1069 to let you know that Snowpark throws an error if parameter is a list.
Correção recomendada
If the value of the parameter is a list, then replace it with a ColumnOrSqlExpr.
Recomendações adicionais¶
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.
Categoria: Aviso
Descrição¶
Quando há um uso de:
The tool analyzes the parameter mode to determinate if the value is overwrite.
Cenários¶
Cenário 1¶
Código de entrada
Para esse cenário, a ferramenta detecta que o parâmetro mode pode definir o valor bool correspondente.
Código de saída:
The SMA tool analyzes the mode parameter, determinate that the value is overwrite and set the corresponding bool value
Correção recomendada
Não há uma correção recomendada para esse cenário porque a ferramenta realizou a transformação correspondente.
Cenário 2:
Código de entrada
In this scenario the tool can not validate the value is overwrite.
Código de saída:
O SMA adiciona uma mensagem EWI indicando que o parâmetro mode foi transformado em “overwrite”, mas também serve para que você saiba que é melhor verificar o valor da variável e definir o valor bool correto.
Correção recomendada
Check for the value of the parameter mode and add the correct value for the parameter overwrite.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1071¶
Mensagem: A função pyspark.rdd.RDD.getNumPartitions não é necessária no Snowpark. Portanto, você deve remover todas as referências.
Categoria: Aviso
Descrição¶
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.
Cenário¶
Entrada
O getNumPartitions retorna a quantidade de partições em um RDD.
Saída
A ferramenta adiciona esse EWI para que você saiba que o getNumPartitions não é necessário.
Correção recomendada
Remover todos os usos dessa função.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1072¶
Mensagem: O uso do StorageLevel não é obrigatório no Snowpark.
Categoria: Aviso.
Descrição¶
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.
Recomendações adicionais¶
Remover todos os usos dessa função.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1073¶
Mensagem: pyspark.sql.functions.udf sem parâmetros ou parâmetro de tipo de retorno não são suportados
Categoria: Aviso.
Descrição¶
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.
Cenários¶
Cenário 1¶
Entrada
No Pyspark, você pode criar uma Função Definida pelo Usuário sem parâmetros de entrada ou de tipo de retorno:
Saída
O Snowpark requer os tipos de entrada e retorno para a função Udf. Porque eles não são fornecidos e o SMA não pode usar esses parâmetros.
Correção recomendada
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*.
Cenário 2¶
No PySpark, você pode usar um decorador @udf sem parâmetros
Entrada
Saída
In Snowpark all the parameters of a udf decorator are required.
Correção recomendada
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.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1074¶
Mensagem: O arquivo tem indentação mista (espaços e tabulações).
Categoria: Erro de análise.
Descrição¶
Esse problema aparece quando a ferramenta detecta que o arquivo tem um recuo misto. Isso significa que o arquivo tem uma combinação de espaços e tabulações para recuar as linhas de código.
Cenário¶
Entrada
No Pyspark, você pode misturar espaços e tabulações para o nível de identificação.
Saída
O SMA não pode lidar com marcadores de recuo mistos. Quando isso é detectado em um arquivo de código python, o SMA adiciona o EWI SPRKPY1074 na primeira linha.
Correção recomendada
A solução é fazer com que todos os símbolos de recuo sejam iguais.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1075¶
Categoria
Aviso.
Descrição¶
O parse_json não aplica validação de esquema; se precisar filtrar/validar com base no esquema, talvez seja necessário introduzir alguma lógica.
Exemplo¶
Entrada
Saída
Para a função from_json, o esquema não é realmente passado para inferência, mas é usado para validação. Veja estes exemplos:
Exemplo 1: Aplicar tipos de dados e alterar nomes de colunas:
Exemplo 2: Selecionar colunas específicas:
Recomendações¶
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.
Categoria: Aviso.
Descrição¶
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:
Todos os parâmetros correspondem ao seu nome equivalente no Snowpark: nesse caso, a ferramenta transformará o parâmetro em uma chamada .option(). Nesse caso, o parâmetro não adicionará esse EWI.
Alguns parâmetros não correspondem ao equivalente no Snowpark: nesse caso, a ferramenta adicionará esse EWI com as informações do parâmetro e o removerá da chamada do método.
Lista de equivalências:
Equivalências para CSV:
Chaves do Spark |
Equivalências do Snowpark |
|---|---|
sep |
FIELD_DELIMITER |
header |
PARSE_HEADER |
lineSep |
RECORD_DELIMITER |
pathGlobFilter |
PATTERN |
quote |
FIELD_OPTIONALLY_ENCLOSED_BY |
nullValue |
NULL_IF |
dateFormat |
DATE_FORMAT |
timestampFormat |
TIMESTAMP_FORMAT |
inferSchema |
INFER_SCHEMA |
delimiter |
FIELD_DELIMITER |
Equivalências para JSON:
Chaves do Spark |
Equivalências do Snowpark |
|---|---|
dateFormat |
DATE_FORMAT |
timestampFormat |
TIMESTAMP_FORMAT |
pathGlobFilter |
PATTERN |
Equivalências para PARQUET:
Chaves do Spark |
Equivalências do Snowpark |
|---|---|
pathGlobFilter |
PATTERN |
Cenários¶
Cenário 1¶
Entrada
Para CVS, aqui estão alguns exemplos:
Saída
No código convertido, os parâmetros são adicionados como opções individuais à função cvs
Cenário 2¶
Entrada
Para JSON, aqui estão alguns exemplos:
Saída
No código convertido, os parâmetros são adicionados como opções individuais à função json
Cenário 3¶
Entrada
Para PARQUET, aqui estão alguns exemplos:
Saída
No código convertido, os parâmetros são adicionados como opções individuais à função parquet
Recomendações adicionais¶
Quando houver parâmetros não equivalentes, é recomendável verificar o comportamento após a transformação.
Além disso, a documentação pode ser útil para encontrar um ajuste melhor:
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¶
Mensagem: o código SQL incorporado não pode ser processado.
Categoria: Aviso.
Descrição¶
Esse problema aparece quando a ferramenta detecta um código SQL incorporado que não pode ser convertido para o Snowpark.
Consulte a seção de código SQL incorporado para obter mais informações.
Cenário¶
Entrada
Neste exemplo, o código SQL está incorporado em uma variável chamada query, que é usada como parâmetro para o método Pyspark.sql.
Saída
O SMA detecta que o parâmetro PySpark.sql é uma variável e não um código SQL, portanto, a mensagem EWI SPRKPY1077 é adicionada à linha PySpark.sql.
Recomendações adicionais¶
Para a transformação de SQL, esse código deve estar diretamente dentro como parâmetro do método apenas como valores de cadeia de caracteres e sem interpolação. Verifique o envio de SQL para a função PySpark.SQL para validar sua funcionalidade no Snowflake.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1078¶
Mensagem: O argumento da função pyspark.context.SparkContext.setLogLevel não é um valor literal e, portanto, não pôde ser avaliado
Categoria: Aviso
Descrição¶
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.
O SMA faz uma análise estática do seu código-fonte e, portanto, não é possível avaliar o conteúdo desse argumento e determinar um equivalente no Snowpark.
Cenário¶
Entrada
Neste exemplo, o logLevel é definido na variável my_log_level e, em seguida, my_log_level é usado como parâmetro pelo método setLogLevel.
Saída
O SMA não consegue avaliar o argumento do parâmetro de nível de registro, portanto, o EWI SPRKPY1078 é adicionado sobre a linha do registro transformado:
Correção recomendada
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:
Nível de registro do PySpark |
Nível de registro do Snowpark equivalente |
|---|---|
ALL |
logging.NOTSET |
DEBUG |
logging.DEBUG |
ERROR |
logging.ERROR |
FATAL |
logging.CRITICAL |
INFO |
logging.INFO |
OFF |
logging.WARNING |
TRACE |
logging.NOTSET |
WARN |
logging.WARNING |
Assim, a correção recomendada será semelhante:
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1079¶
Mensagem: O argumento da função pyspark.context.SparkContext.setLogLevel não é um nível de registro PySpark válido
Categoria: Aviso
Descrição¶
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.
Cenário¶
Entrada
aqui o nível de registro usa «INVALID_LOG_LEVEL», que não é um nível de registro válido do Pyspark.
Saída
O SMA não consegue reconhecer o nível de registro «INVALID_LOG_LEVEL», embora o SMA faça a conversão, o EWI SPRKPY1079 é adicionado para indicar um possível problema.
Correção recomendada
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.
Recomendações adicionais¶
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
Mensagem: pyspark.sql.readwriter.DataFrameWriter.partitionBy tem uma solução alternativa.
Categoria: Aviso
Descrição¶
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.
Cenário¶
Entrada
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.
Código de saída
Correção recomendada
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:
Código do Spark:
O código do Snowpark foi ajustado manualmente:
copy_into_location tem os seguintes parâmetros
location: The Snowpark location only accepts cloud locations using an snowflake stage.
_partition_by_: Pode ser um nome de coluna ou uma expressão SQL, portanto, você precisará convertê-la em uma coluna ou em uma expressão SQL, usando col ou sql_expr.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1082¶
Mensagem: A função pyspark.sql.readwriter.DataFrameReader.load não é suportada. Uma solução alternativa é usar o método específico do formato do Snowpark DataFrameReader (avro csv, json, orc, parquet). O parâmetro path deve ser um local de estágio.
Categoria: Aviso
Descrição¶
The pyspark.sql.readwriter.DataFrameReader.load function is not supported. The workaround is to use Snowpark DataFrameReader methods instead.
Cenários¶
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.
Cenário 1¶
Entrada
Below is an example that tries to load data from a CSV source.
Saída
The SMA adds the EWI SPRKPY1082 to let you know that this function is not supported by Snowpark, but it has a workaround.
Correção recomendada
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.
Cenário 2¶
Entrada
Below is an example that tries to load data from a JSON source.
Saída
The SMA adds the EWI SPRKPY1082 to let you know that this function is not supported by Snowpark, but it has a workaround.
Correção recomendada
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.
Cenário 3¶
Entrada
Below is an example that tries to load data from a PARQUET source.
Saída
The SMA adds the EWI SPRKPY1082 to let you know that this function is not supported by Snowpark, but it has a workaround.
Correção recomendada
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.
Recomendações adicionais¶
Leve em conta que as opções entre o spark e o snowpark não são as mesmas, mas podem ser mapeadas:
Opções do Spark |
Valor possível |
Equivalente do Snowpark |
Descrição |
|---|---|---|---|
header |
Verdadeiro ou falso |
SKIP_HEADER = 1 / SKIP_HEADER = 0 |
Para usar a primeira linha de um arquivo como nomes de colunas. |
delimiter |
Qualquer separador de campo de um ou vários caracteres |
FIELD_DELIMITER |
Para especificar caractere(s) único(s)/múltiplo(s) como separador para cada coluna/campo. |
sep |
Qualquer separador de campo de caractere único |
FIELD_DELIMITER |
Para especificar um único caractere como separador para cada coluna/campo. |
encoding |
UTF-8, UTF-16, etc… |
ENCODING |
Para decodificar os arquivos CSV pelo tipo de codificação fornecido. A codificação padrão é UTF-8 |
lineSep |
Qualquer separador de linha de caractere único |
RECORD_DELIMITER |
Para definir o separador de linha que deve ser usado na análise de arquivos. |
pathGlobFilter |
Padrão de arquivo |
PATTERN |
Para definir um padrão para ler arquivos somente com nomes de arquivos que correspondam ao padrão. |
recursiveFileLookup |
Verdadeiro ou falso |
N/A |
Para examinar recursivamente um diretório para ler arquivos. O valor padrão dessa opção é False. |
quote |
Caractere único a ser citado |
FIELD_OPTIONALLY_ENCLOSED_BY |
Para citar campos/colunas que contêm campos em que o delimitador/separador pode fazer parte do valor. Esse caractere Para citar todos os campos quando usado com a opção quoteAll. O valor padrão dessa opção é aspas duplas («). |
nullValue |
Cadeia de caracteres para substituir null |
NULL_IF |
Para substituir os valores nulos pela cadeia de caracteres durante a leitura e gravação do dataframe. |
dateFormat |
Formato de data válido |
DATE_FORMAT |
Para definir uma cadeia de caracteres que indica um formato de data. O formato padrão é yyyy-MM-dd. |
timestampFormat |
Formato de carimbo de data/hora válido |
TIMESTAMP_FORMAT |
Para definir uma cadeia de caracteres que indica um formato de carimbo de data/hora. O formato padrão é yyyy-MM-dd “T’HH:mm:ss. |
escape |
Qualquer caractere único |
ESCAPE |
Para definir um único caractere como caractere de escape para substituir o caractere de escape padrão (\). |
inferSchema |
Verdadeiro ou falso |
INFER_SCHEMA |
Detecta automaticamente o esquema do arquivo |
mergeSchema |
Verdadeiro ou falso |
N/A |
Não é necessário no snowflake, pois isso acontece sempre que o infer_schema determina a estrutura do arquivo 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¶
Mensagem: A função pyspark.sql.readwriter.DataFrameWriter.save não é suportada. Uma solução alternativa é usar o método copy_into_location do Snowpark DataFrameWriter.
Categoria: Aviso
Descrição¶
The pyspark.sql.readwriter.DataFrameWriter.save function is not supported. The workaround is to use Snowpark DataFrameWriter methods instead.
Cenários¶
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.
Cenário 1¶
Código de entrada
Below is an example that tries to save data with CSV format.
Código de saída
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.
Correção recomendada
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.
Abaixo está um exemplo que cria um estágio temporal e coloca o arquivo nele, depois chama um dos métodos mencionados acima.
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.
Cenário 2¶
Código de entrada
Below is an example that tries to save data with JSON format.
Código de saída
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.
Correção recomendada
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.
Abaixo está um exemplo que cria um estágio temporal e coloca o arquivo nele, depois chama um dos métodos mencionados acima.
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.
Cenário 3¶
Código de entrada
Below is an example that tries to save data with PARQUET format.
Código de saída
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.
Correção recomendada
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.
Abaixo está um exemplo que cria um estágio temporal e coloca o arquivo nele, depois chama um dos métodos mencionados acima.
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.
Recomendações adicionais¶
Leve em conta que as opções entre o spark e o snowpark não são as mesmas, mas podem ser mapeadas:
Opções do Spark |
Valor possível |
Equivalente do Snowpark |
Descrição |
|---|---|---|---|
header |
Verdadeiro ou falso |
SKIP_HEADER = 1 / SKIP_HEADER = 0 |
Para usar a primeira linha de um arquivo como nomes de colunas. |
delimiter |
Qualquer separador de campo de um ou vários caracteres |
FIELD_DELIMITER |
Para especificar caractere(s) único(s)/múltiplo(s) como separador para cada coluna/campo. |
sep |
Qualquer separador de campo de caractere único |
FIELD_DELIMITER |
Para especificar um único caractere como separador para cada coluna/campo. |
encoding |
UTF-8, UTF-16, etc… |
ENCODING |
Para decodificar os arquivos CSV pelo tipo de codificação fornecido. A codificação padrão é UTF-8 |
lineSep |
Qualquer separador de linha de caractere único |
RECORD_DELIMITER |
Para definir o separador de linha que deve ser usado na análise de arquivos. |
pathGlobFilter |
Padrão de arquivo |
PATTERN |
Para definir um padrão para ler arquivos somente com nomes de arquivos que correspondam ao padrão. |
recursiveFileLookup |
Verdadeiro ou falso |
N/A |
Para examinar recursivamente um diretório para ler arquivos. O valor padrão dessa opção é False. |
quote |
Caractere único a ser citado |
FIELD_OPTIONALLY_ENCLOSED_BY |
Para citar campos/colunas que contêm campos em que o delimitador/separador pode fazer parte do valor. Esse caractere Para citar todos os campos quando usado com a opção quoteAll. O valor padrão dessa opção é aspas duplas («). |
nullValue |
Cadeia de caracteres para substituir null |
NULL_IF |
Para substituir os valores nulos pela cadeia de caracteres durante a leitura e gravação do dataframe. |
dateFormat |
Formato de data válido |
DATE_FORMAT |
Para definir uma cadeia de caracteres que indica um formato de data. O formato padrão é yyyy-MM-dd. |
timestampFormat |
Formato de carimbo de data/hora válido |
TIMESTAMP_FORMAT |
Para definir uma cadeia de caracteres que indica um formato de carimbo de data/hora. O formato padrão é yyyy-MM-dd “T’HH:mm:ss. |
escape |
Qualquer caractere único |
ESCAPE |
Para definir um único caractere como caractere de escape para substituir o caractere de escape padrão (\). |
inferSchema |
Verdadeiro ou falso |
INFER_SCHEMA |
Detecta automaticamente o esquema do arquivo |
mergeSchema |
Verdadeiro ou falso |
N/A |
Não é necessário no snowflake, pois isso acontece sempre que o infer_schema determina a estrutura do arquivo 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
Mensagem: pyspark.sql.readwriter.DataFrameWriter.option não é compatível.
Categoria: Aviso
Descrição¶
The pyspark.sql.readwriter.DataFrameWriter.option function is not supported.
Cenário¶
Código de entrada
Below is an example using the option method, this method is used to add additional configurations when writing the data of a DataFrame.
Código de saída
The tool adds this EWI SPRKPY1084 on the output code to let you know that this function is not supported by Snowpark.
Correção recomendada
O método pyspark.sql.readwriter.DataFrameWriter.option não tem uma correção recomendada.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1085¶
Mensagem: pyspark.ml.feature.VectorAssembler não é compatível.
Categoria: Aviso
Descrição¶
The pyspark.ml.feature.VectorAssembler is not supported.
Cenário¶
Código de entrada
VectorAssembler é usado para combinar várias colunas em um único vetor.
Código de saída
The tool adds this EWI SPRKPY1085 on the output code to let you know that this class is not supported by Snowpark.
Correção recomendada
O pyspark.ml.feature.VectorAssembler não tem uma correção recomendada.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1086¶
Mensagem: pyspark.ml.linalg.VectorUDT não é compatível.
Categoria: Aviso
Descrição¶
The pyspark.ml.linalg.VectorUDT is not supported.
Cenário¶
Código de entrada
VectorUDT é um tipo de dados para representar colunas de vetores em um DataFrame.
Código de saída
The tool adds this EWI SPRKPY1086 on the output code to let you know that this function is not supported by Snowpark.
Correção recomendada
O pyspark.ml.linalg.VectorUDT não tem uma correção recomendada.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1087¶
Mensagem: A função pyspark.sql.dataframe.DataFrame.writeTo não é suportada, mas tem uma solução alternativa.
Categoria: Aviso.
Descrição¶
The pyspark.sql.dataframe.DataFrame.writeTo function is not supported. The workaround is to use Snowpark DataFrameWriter SaveAsTable method instead.
Cenário¶
Entrada
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.
Saída
The SMA adds the EWI SPRKPY1087 to the output code to let you know that this function is not supported, but has a workaround.
Correção recomendada
A solução alternativa é usar o método do Snowpark DataFrameWriter SaveAsTable.
Recomendações adicionais¶
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1088¶
Mensagem: Os valores de pyspark.sql.readwriter.DataFrameWriter.option no Snowpark podem ser diferentes, portanto, pode ser necessária uma validação.
Categoria: Aviso
Descrição¶
The pyspark.sql.readwriter.DataFrameWriter.option values in Snowpark may be different, so validation might be needed to ensure that the behavior is correct.
Cenários¶
Há alguns cenários, dependendo da opção ser suportada ou não, ou do formato usado para gravar o arquivo.
Cenário 1¶
Entrada
Below is an example of the usage of the method option, adding a sep option, which is currently supported.
Saída
The tool adds the EWI SPRKPY1088 indicating that it is required validation.
Correção recomendada
O Snowpark API oferece suporte a esse parâmetro, portanto, a única ação pode ser verificar o comportamento após a migração. Consulte a tabela Equivalências para ver os parâmetros compatíveis.
Cenário 2¶
Entrada
Here the scenario shows the usage of option, but adds a header option, which is not supported.
Saída
The tool adds the EWI SPRKPY1088 indicating that it is required validation is needed.
Correção recomendada
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.
Cenário 3¶
Entrada
This scenario adds a sep option, which is supported and uses the JSON method.
Note: this scenario also applies for
PARQUET.
Saída
The tool adds the EWI SPRKPY1088 indicating that it is required validation is needed.
Correção recomendada
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.
Recomendações adicionais¶
Since there are some
not supportedparameters, it is recommended to check thetable of equivalencesand check the behavior after the transformation.Tabela de equivalências:
Opção PySpark |
Opção SnowFlake |
Formatos de arquivo suportados |
Descrição |
|---|---|---|---|
SEP |
FIELD_DELIMITER |
CSV |
Um ou mais caracteres de byte único ou de vários bytes que separam os campos em um arquivo de entrada. |
LINESEP |
RECORD_DELIMITER |
CSV |
Um ou mais caracteres que separam registros em um arquivo de entrada. |
QUOTE |
FIELD_OPTIONALLY_ENCLOSED_BY |
CSV |
Caractere usado para delimitar as cadeias de caracteres. |
NULLVALUE |
NULL_IF |
CSV |
String usada para converter de e para SQL NULL. |
DATEFORMAT |
DATE_FORMAT |
CSV |
String que define o formato dos valores de data nos arquivos de dados a serem carregados. |
TIMESTAMPFORMAT |
TIMESTAMP_FORMAT |
CSV |
String que define o formato dos valores de carimbo de data/hora nos arquivos de dados a serem carregados. |
Se o parâmetro usado não estiver na lista, a API gera um erro.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1089¶
Mensagem: Os valores de pyspark.sql.readwriter.DataFrameWriter.options no Snowpark podem ser diferentes, portanto, pode ser necessária uma validação.
Categoria: Aviso
Descrição¶
The pyspark.sql.readwriter.DataFrameWriter.options values in Snowpark may be different, so validation might be needed to ensure that the behavior is correct.
Cenários¶
Há alguns cenários, dependendo do fato de as opções terem suporte ou não, ou do formato usado para gravar o arquivo.
Cenário 1¶
Entrada
Below is an example of the usage of the method options, adding the options sep and nullValue, which are currently supported.
Saída
The tool adds the EWI SPRKPY1089 indicating that it is required validation.
Correção recomendada
O Snowpark API é compatível com esses parâmetros, portanto, a única ação a ser tomada é verificar o comportamento após a migração. Consulte a tabela Equivalências para ver os parâmetros compatíveis.
Cenário 2¶
Entrada
Here the scenario shows the usage of options, but adds a header option, which is not supported.
Saída
The tool adds the EWI SPRKPY1089 indicating that it is required validation is needed.
Correção recomendada
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.
Cenário 3¶
Entrada
This scenario adds a sep option, which is supported and uses the JSON method.
Saída
The tool adds the EWI SPRKPY1089 indicating that it is required validation is needed.
Note: this scenario also applies for
PARQUET.
Correção recomendada
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.
Recomendações adicionais¶
Since there are some
not supportedparameters, it is recommended to check thetable of equivalencesand check the behavior after the transformation.Tabela de equivalências:
O Snowpark pode oferecer suporte a uma lista de equivalências para alguns parâmetros:
Opção PySpark |
Opção SnowFlake |
Formatos de arquivo suportados |
Descrição |
|---|---|---|---|
SEP |
FIELD_DELIMITER |
CSV |
Um ou mais caracteres de byte único ou de vários bytes que separam os campos em um arquivo de entrada. |
LINESEP |
RECORD_DELIMITER |
CSV |
Um ou mais caracteres que separam registros em um arquivo de entrada. |
QUOTE |
FIELD_OPTIONALLY_ENCLOSED_BY |
CSV |
Caractere usado para delimitar as cadeias de caracteres. |
NULLVALUE |
NULL_IF |
CSV |
String usada para converter de e para SQL NULL. |
DATEFORMAT |
DATE_FORMAT |
CSV |
String que define o formato dos valores de data nos arquivos de dados a serem carregados. |
TIMESTAMPFORMAT |
TIMESTAMP_FORMAT |
CSV |
String que define o formato dos valores de carimbo de data/hora nos arquivos de dados a serem carregados. |
Se o parâmetro usado não estiver na lista, a API gera um erro.
For more support, you can email us at sma-support@snowflake.com or post an issue in the SMA.
SPRKPY1101¶
Categoria¶
Erro de análise.
Descrição¶
Quando a ferramenta reconhece um erro de análise, ela tenta se recuperar dele e continua o processo na próxima linha. Nesses casos, ele mostra o erro e os comentários sobre a linha.
Este exemplo mostra como é tratado um erro de incompatibilidade entre espaços e tabulações.
Código de entrada
Código de saída
Recomendações¶
Tente corrigir a linha comentada.
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.