Links

SPRKPY1028

pyspark.sql.readwriter.DataFrameReader.orc has a workaround

Category

Warning.

Description

This issue appears when the tool detects the usage of pyspark.sql.readwriter.DataFrameReader.orc which has a workaround.
Input code:
df = (spark.read.orc("dbfs:/mnt/datalake/VMS/raw_data/df.orc", sep=',', inferSchema=True, header=True, multiLine=False, escape='\\', quote='"')
.select('attributename','attributevalue','objecttypecode','value'))
Output code:
#EWI: SPRKPY1028 => pyspark.sql.readwriter.DataFrameReader.orc has a workaround, see documentation for more info
df = (spark.read.orc("dbfs:/mnt/datalake/VMS/raw_data/df.orc", sep=',', inferSchema=True, header=True, multiLine=False, escape='\\', quote='"')
.select('attributename','attributevalue','objecttypecode','value'))

Scenario:

orc(path: str, mode: Optional[str], partitionBy: Optional[Union[str, List[str]]], compression: Optional[str]) Action: The optional parameters "schema", "sep" and "quote" are not supported in snowpark. So try to replace those uses by the following ones: sep(',') -> option("field delimeter", ","), escape = '\\' -> option("escape", "\\"), Quote='"' -> option("FIELD_OPTIONALLY_ENCLOSED_BY",'"'. InferSchema parameter is not supported at all.
import snowflake.snowpark.DataFrameReader as dfr
df = (spark.read.orc("dbfs:/mnt/datalake/VMS/raw_data/df.orc", dfr.option("field delimeter", ","),
header=True, multiLine=False, escape=dfr.option("escape", "\\"), quote=dfr.option("FIELD_OPTIONALLY_ENCLOSED_BY",'"'))
.select('attributename','attributevalue','objecttypecode','value'))

Recommendation