Skip to content

Commit

Permalink
chore(pyspark): use normalize_filenames() from util (#10521)
Browse files Browse the repository at this point in the history
Small little improvement I found while doing something else
  • Loading branch information
NickCrews authored Nov 22, 2024
1 parent 15df633 commit b32a6f3
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions ibis/backends/pyspark/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@ class SparkConnectGrpcException(Exception):
ConnectionMode = Literal["streaming", "batch"]


def normalize_filenames(source_list):
# Promote to list
source_list = util.promote_list(source_list)

return list(map(util.normalize_filename, source_list))


@F.pandas_udf(returnType=DoubleType(), functionType=F.PandasUDFType.SCALAR)
def unwrap_json_float(s: pd.Series) -> pd.Series:
import json
Expand Down Expand Up @@ -872,7 +865,7 @@ def read_csv(
)
inferSchema = kwargs.pop("inferSchema", True)
header = kwargs.pop("header", True)
source_list = normalize_filenames(source_list)
source_list = util.normalize_filenames(source_list)
spark_df = self._session.read.csv(
source_list, inferSchema=inferSchema, header=header, **kwargs
)
Expand Down Expand Up @@ -912,7 +905,7 @@ def read_json(
"Pyspark in streaming mode does not support direction registration of JSON files. "
"Please use `read_json_dir` instead."
)
source_list = normalize_filenames(source_list)
source_list = util.normalize_filenames(source_list)
spark_df = self._session.read.json(source_list, **kwargs)
table_name = table_name or util.gen_name("read_json")

Expand Down

0 comments on commit b32a6f3

Please sign in to comment.