Skip to content

feat(pyspark): expose merge_schema option in create_table #11071

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

Closed
wants to merge 1 commit into from
Closed
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
9 changes: 8 additions & 1 deletion ibis/backends/pyspark/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ def create_table(
overwrite: bool = False,
format: str = "parquet",
partition_by: str | list[str] | None = None,
merge_schema: bool = False,
) -> ir.Table:
"""Create a new table in Spark.

Expand All @@ -631,6 +632,8 @@ def create_table(
Format of the table on disk
partition_by
Name(s) of partitioning column(s)
merge_schema
Forwarded to pyspark's `saveAsTable` method as the `mergeSchema` option.

Returns
-------
Expand Down Expand Up @@ -660,7 +663,11 @@ def create_table(
self._run_pre_execute_hooks(table)
df = self._session.sql(query)
df.write.saveAsTable(
name, format=format, mode=mode, partitionBy=partition_by
name,
format=format,
mode=mode,
partitionBy=partition_by,
mergeSchema=merge_schema,
)
elif schema is not None:
schema = ibis.schema(schema)
Expand Down