Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(pyspark): use normalize_filenames() from util #10521

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 @@
)
inferSchema = kwargs.pop("inferSchema", True)
header = kwargs.pop("header", True)
source_list = normalize_filenames(source_list)
source_list = util.normalize_filenames(source_list)

Check warning on line 868 in ibis/backends/pyspark/__init__.py

View check run for this annotation

Codecov / codecov/patch

ibis/backends/pyspark/__init__.py#L868

Added line #L868 was not covered by tests
spark_df = self._session.read.csv(
source_list, inferSchema=inferSchema, header=header, **kwargs
)
Expand Down Expand Up @@ -912,7 +905,7 @@
"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)

Check warning on line 908 in ibis/backends/pyspark/__init__.py

View check run for this annotation

Codecov / codecov/patch

ibis/backends/pyspark/__init__.py#L908

Added line #L908 was not covered by tests
spark_df = self._session.read.json(source_list, **kwargs)
table_name = table_name or util.gen_name("read_json")

Expand Down